-
Notifications
You must be signed in to change notification settings - Fork 425
feat(repo): Re-enable unit tests for clerk-js and ui packages #7605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Rename test:disabled to test in both package.json files - Add vitest.config.mts for @clerk/ui with cross-package aliases - Fix relative imports in UI tests to use @/ aliases Note: Some UI tests still have import resolution issues due to cross-package dependencies that need further work.
🦋 Changeset detectedLatest commit: d5510f6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
📝 WalkthroughWalkthroughThis pull request re-enables unit tests for the UI package. Changes include: replacing 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
…nization_creation_defaults - Create UI-specific test fixtures (create-fixtures.tsx, fixtures.ts, fixture-helpers.ts, etc.) - Add ModuleManagerProvider to test wrapper to fix useModuleManager context errors - Add organization_creation_defaults property to base organization settings - Update vitest alias configuration to use local test utilities - Fix @/utils alias ordering to prioritize UI package utils over clerk-js Reduces test failures from 123 to 13.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/ui/src/test/fixtures.ts`:
- Around line 238-240: The fixture createBaseClientJSON currently returns an
empty object cast to ClientJSON which can cause runtime errors in tests; update
createBaseClientJSON to return a minimal scaffolded ClientJSON object containing
the expected properties (e.g. sessions array/object and sign_in, sign_up
structures) populated with sensible defaults or empty arrays/objects so tests
can safely access those keys; locate the function createBaseClientJSON in
packages/ui/src/test/fixtures.ts and replace the empty cast with a concrete
object matching the ClientJSON shape used by tests.
🧹 Nitpick comments (1)
packages/ui/src/test/create-fixtures.tsx (1)
1-2: Consider removing blanket suppressions after stabilization.The
eslint-disableand@ts-nocheckdirectives suppress all linting and type checking. Given the PR objective is to iteratively fix remaining issues, this is acceptable for now, but these should be removed or narrowed once the cross-package import issues are resolved.
📜 Review details
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (7)
packages/ui/src/test/core-fixtures.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/utils.tspackages/ui/vitest.config.mts
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
All code must pass ESLint checks with the project's configuration
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Follow established naming conventions (PascalCase for components, camelCase for variables)
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
packages/**/src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
**/*.ts?(x)
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)
**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Implement type guards forunknowntypes using the patternfunction isType(value: unknown): value is Type
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details in classes
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like<T extends { id: string }>
Use utility types likeOmit,Partial, andPickfor data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including@param,@returns,@throws, and@exampletags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Useconst assertionswithas constfor literal types
Usesatisfiesoperator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use ESLint with custom configurations tailored for different package types
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use Prettier for code formatting across all packages
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
packages/ui/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/clerk-ui-theming.mdc)
packages/ui/src/**/*.{ts,tsx}: Use element descriptors for all themable elements by applyingelementDescriptorprop to components and importing descriptors frompackages/ui/src/customizables/elementDescriptors.ts
Use theme-aware functions inelementsconfiguration to access design tokens (e.g.,{ theme } => ({ backgroundColor: theme.colors.$primary500 }))
Prefer CSS variables (e.g.,--clerk-color-primary,--clerk-spacing) for runtime customization via theclerkCssVarutility
Automatically generate color scales using the color scale generation process rather than manually defining all lightness and alpha variations (25, 50, 100, 150, 200, 300, 400, 500, 600, 700, 750, 800, 850, 900, 950 shades)
Use thecreateVariantsfunction frompackages/ui/src/styledSystem/createVariants.tsfor type-safe variant-based styling with base, variants, defaultVariants, and compoundVariants configuration
Wrap primitive components withmakeCustomizableHOC frompackages/ui/src/customizables/makeCustomizable.tsxto enable element descriptor support and theming
Apply thesxprop using either a theme-aware function(theme: InternalTheme) => StyleRuleor static style object to components for theme-aware CSS
Use state props (isLoading, hasError, isOpen, isActive) to automatically generate state classes (cl-loading, cl-error, cl-open, cl-active) for styling
Use CSSlight-dark()function via thelightDarkutility frompackages/ui/src/utils/lightDark.tsfor automatic light/dark mode support with fallbacks
Use Emotion'scssprop andThemeProviderviaInternalThemeProviderfrompackages/ui/src/styledSystem/InternalThemeProvider.tsxfor styling and theme context
UsemakeResponsivefrompackages/ui/src/customizables/makeResponsive.tsxwith breakpoints defined inpackages/ui/src/styledSystem/breakpoints.tsxfor responsive design support
UseuseDeepEqualMemoin AppearanceProvider to prevent unnecessary re-renders when appearance configuration changes
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
**/*
⚙️ CodeRabbit configuration file
If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.
**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.
Files:
packages/ui/src/test/utils.tspackages/ui/src/test/create-fixtures.tsxpackages/ui/vitest.config.mtspackages/ui/src/test/fixture-helpers.tspackages/ui/src/test/fixtures.tspackages/ui/src/test/mock-helpers.tspackages/ui/src/test/core-fixtures.ts
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components
**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components
Files:
packages/ui/src/test/create-fixtures.tsx
**/*.{md,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Update documentation for API changes
Files:
packages/ui/src/test/create-fixtures.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g.,UserProfile,NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...
Files:
packages/ui/src/test/create-fixtures.tsx
🧬 Code graph analysis (6)
packages/ui/src/test/create-fixtures.tsx (8)
packages/ui/src/test/fixture-helpers.ts (2)
createEnvironmentFixtureHelpers(25-33)createClientFixtureHelpers(35-41)packages/ui/src/test/mock-helpers.ts (2)
mockRouteContextValue(108-126)mockClerkMethods(45-106)packages/clerk-js/src/core/resources/Environment.ts (1)
Environment(19-112)packages/ui/src/test/core-fixtures.ts (1)
clerkMock(249-256)packages/ui/src/contexts/CoreClerkContextWrapper.tsx (1)
CoreClerkContextWrapper(22-71)packages/ui/src/contexts/ModuleManagerContext.tsx (1)
ModuleManagerProvider(6-11)packages/ui/src/customizables/AppearanceContext.tsx (1)
AppearanceProvider(22-22)packages/ui/src/elements/contexts/index.tsx (1)
FlowMetadataProvider(138-142)
packages/ui/vitest.config.mts (3)
scripts/notify.mjs (1)
process(6-6)integration/presets/react.ts (1)
react(25-28)packages/dev-cli/src/utils/getClerkPackages.js (1)
JSON(22-22)
packages/ui/src/test/fixture-helpers.ts (7)
packages/shared/src/types/json.ts (1)
EnvironmentJSON(84-94)packages/ui/src/test/core-fixtures.ts (3)
OrgParams(21-24)getOrganizationId(38-38)createUser(133-172)packages/react/src/isomorphicClerk.ts (1)
session(722-728)packages/clerk-js/src/core/resources/SignIn.ts (1)
identifier(664-666)packages/ui/src/test/fixtures.ts (1)
createUserFixture(260-267)packages/clerk-js/src/core/resources/SignUp.ts (2)
emailAddress(639-641)phoneNumber(643-645)packages/shared/src/types/userSettings.ts (1)
UserSettingsJSON(106-120)
packages/ui/src/test/fixtures.ts (4)
packages/shared/src/types/json.ts (2)
EnvironmentJSON(84-94)AuthConfigJSON(328-333)packages/shared/src/types/displayConfig.ts (1)
DisplayConfigJSON(10-48)packages/shared/src/types/userSettings.ts (1)
UserSettingsJSON(106-120)packages/shared/src/types/commerceSettings.ts (1)
CommerceSettingsJSON(5-17)
packages/ui/src/test/mock-helpers.ts (2)
packages/clerk-js/src/core/query-core.ts (1)
QueryClient(3-3)packages/shared/src/types/session.ts (1)
ActiveSessionResource(269-272)
packages/ui/src/test/core-fixtures.ts (1)
packages/shared/src/types/organizationMembership.ts (2)
OrganizationCustomRoleKey(78-82)OrganizationPermissionKey(97-101)
🪛 Gitleaks (8.30.0)
packages/ui/src/test/create-fixtures.tsx
[high] 71-71: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
packages/ui/src/test/fixture-helpers.ts
[high] 71-71: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
packages/ui/src/test/core-fixtures.ts
[high] 19-19: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.
(jwt)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (26)
- GitHub Check: Integration Tests (custom, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 15)
- GitHub Check: Integration Tests (billing, chrome, RQ)
- GitHub Check: Integration Tests (sessions:staging, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 16)
- GitHub Check: Integration Tests (handshake:staging, chrome)
- GitHub Check: Integration Tests (tanstack-react-start, chrome)
- GitHub Check: Integration Tests (express, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (machine, chrome, RQ)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
- GitHub Check: Integration Tests (nextjs, chrome, 16)
- GitHub Check: Integration Tests (handshake, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (7)
packages/ui/vitest.config.mts (1)
1-72: Looks good.The Vitest configuration is well-structured with appropriate alias ordering to resolve cross-package dependencies correctly.
packages/ui/src/test/mock-helpers.ts (1)
1-126: Looks good.Test mocking utilities are well-implemented with proper null checks and recursive mocking support.
packages/ui/src/test/core-fixtures.ts (1)
18-19: Test JWT is safe to use.The static analysis flagged this JWT, but it's an intentionally expired test token (exp: Oct 2022) used only for fixture data. This is not a leaked credential.
packages/ui/src/test/create-fixtures.tsx (1)
70-72: Test publishable key is safe.The static analysis flagged this as an API key, but decoding the base64 portion reveals it's a fake domain (
clerk.abcef.12345.prod.lclclerk.com). This is intentionally used to bypass dev initialization flows during testing and poses no security risk.packages/ui/src/test/utils.ts (1)
1-72: Looks good.Test utilities are well-organized with proper cleanup in beforeAll/afterAll hooks.
packages/ui/src/test/fixtures.ts (1)
1-2: Blanket type-safety bypasses on new test fixtures file.Disabling ESLint and TypeScript checking (
/* eslint-disable */,//@ts-nocheck``) hides type mismatches between fixtures and actual interfaces. This could lead to runtime errors in tests that are difficult to diagnose. Consider removing these directives and addressing type issues explicitly, or at minimum adding a TODO comment tracking when these should be removed.packages/ui/src/test/fixture-helpers.ts (1)
89-91: Static analysis false positive — JWT is test fixture data.The Gitleaks warning about an API key is a false positive. The JWT payload decodes to
{"exp":1675876790,"data":"foobar","iat":1675876730}— clearly dummy test data with an expired timestamp (Feb 2023). Safe for test fixtures.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| export const createBaseClientJSON = (): ClientJSON => { | ||
| return {} as ClientJSON; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createBaseClientJSON returns empty object — potential runtime errors.
Returning {} as ClientJSON provides no actual structure. Tests relying on this fixture may fail or behave unexpectedly when accessing expected properties like sessions, sign_in, or sign_up.
Suggested minimal scaffold
export const createBaseClientJSON = (): ClientJSON => {
- return {} as ClientJSON;
+ return {
+ object: 'client',
+ id: 'client_test',
+ sessions: [],
+ sign_in: null,
+ sign_up: null,
+ last_active_session_id: null,
+ created_at: Date.now(),
+ updated_at: Date.now(),
+ } as ClientJSON;
};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export const createBaseClientJSON = (): ClientJSON => { | |
| return {} as ClientJSON; | |
| }; | |
| export const createBaseClientJSON = (): ClientJSON => { | |
| return { | |
| object: 'client', | |
| id: 'client_test', | |
| sessions: [], | |
| sign_in: null, | |
| sign_up: null, | |
| last_active_session_id: null, | |
| created_at: Date.now(), | |
| updated_at: Date.now(), | |
| } as ClientJSON; | |
| }; |
🤖 Prompt for AI Agents
In `@packages/ui/src/test/fixtures.ts` around lines 238 - 240, The fixture
createBaseClientJSON currently returns an empty object cast to ClientJSON which
can cause runtime errors in tests; update createBaseClientJSON to return a
minimal scaffolded ClientJSON object containing the expected properties (e.g.
sessions array/object and sign_in, sign_up structures) populated with sensible
defaults or empty arrays/objects so tests can safely access those keys; locate
the function createBaseClientJSON in packages/ui/src/test/fixtures.ts and
replace the empty cast with a concrete object matching the ClientJSON shape used
by tests.
…properties Fixes TypeError when organizationCreationDefaults has advisory but no form property
…anization tests - Add beforeEach to clear useFetch cache between tests - Use findByDisplayValue instead of findByText for input value assertions - Add withOrganizationSlug(true) to enable slug field in prefill test
… tests The clearFetchCache in beforeEach was interfering with other tests.
…Organization - Fix formatting in package.json - InviteMembersPage: add waitFor for async role loading before interactions - OrganizationMembers: use regex to match both curly and straight apostrophes - TaskChooseOrganization: add clearFetchCache, fix regex escaping, use findByDisplayValue for form inputs, fix snake_case property names in mocks
Add organization_memberships to user fixture so the component properly detects that user has reached max allowed memberships
Use findByText instead of queryByText to wait for async loading to complete before asserting on the OrganizationCreationDisabledScreen content
…rors Revert signals.ts to original behavior - raw should contain the full ClerkAPIResponseError so consumers can access any property they need. Fix test to match actual intended behavior per Dylan's clarification.
01cd813 to
e2b57c6
Compare
The visibleFields filter was hiding email/phone fields when both are optional (emailOrPhone toggle mode). This bug has existed since 2022 when the filter was introduced in e41fe7f. Fixes the filter to always show email/phone fields when in toggle mode.
organizationCreationDefaults can have an advisory property but no form property. Added optional chaining to prevent TypeError. Fixes regression from #7488.
Summary
Re-enables unit tests for
@clerk/clerk-jsand@clerk/uipackages that were disabled when the UI package was split out.Changes
test:disabled→testin both packagesvitest.config.mtsfor@clerk/uiwith cross-package aliases@/aliasesBug Fixes
Re-enabling the tests uncovered bugs in the following files:
packages/shared/src/internal/clerk-js/redirectUrls.tspackages/ui/src/components/PricingTable/utils/pricing-footer-state.tspackages/ui/src/components/SignUp/SignUpStart.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxTest Plan
Fixes: USER-4359