Skip to content

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Jan 15, 2026

Summary

Re-enables unit tests for @clerk/clerk-js and @clerk/ui packages that were disabled when the UI package was split out.

Changes

  • Rename test:disabledtest in both packages
  • Add vitest.config.mts for @clerk/ui with cross-package aliases
  • Fix test imports to use @/ aliases

Bug Fixes

Re-enabling the tests uncovered bugs in the following files:

  • packages/shared/src/internal/clerk-js/redirectUrls.ts
  • packages/ui/src/components/PricingTable/utils/pricing-footer-state.ts
  • packages/ui/src/components/SignUp/SignUpStart.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx

Test Plan

  • All clerk-js unit tests pass
  • All UI unit tests pass
  • CI green

Fixes: USER-4359

- 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-bot
Copy link

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: d5510f6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@vercel
Copy link

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 16, 2026 9:19pm

Request Review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 15, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7605

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7605

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7605

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7605

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7605

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7605

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7605

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7605

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7605

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7605

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7605

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7605

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7605

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7605

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7605

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7605

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7605

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7605

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7605

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7605

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7605

commit: d5510f6

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

This pull request re-enables unit tests for the UI package. Changes include: replacing test:disabled with test in package.json for clerk-js and ui; adding @emotion/react devDependency; adding a Vitest config for packages/ui; adding extensive test fixtures, helpers, and mocks across packages/ui and packages/clerk-js; converting relative test imports to path aliases; updating multiple tests for async waits and fixture usage; small runtime fixes in redirect URL flattening and error-parsing test expectations.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the main objective: re-enabling unit tests for clerk-js and ui packages after the UI package split.
Linked Issues check ✅ Passed The PR comprehensively addresses USER-4359 by restoring test configurations, adding vitest setup, fixing import paths, and updating tests to run post-UI-package-split.
Out of Scope Changes check ✅ Passed All changes align with test re-enablement: vitest config, import fixes, test utility exports, and bug fixes (pricing-footer, emailOrPhone visibility, optional chaining) address test infrastructure and known issues.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

…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.
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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-disable and @ts-nocheck directives 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.

📥 Commits

Reviewing files that changed from the base of the PR and between b47a44c and 97d44ef.

📒 Files selected for processing (7)
  • packages/ui/src/test/core-fixtures.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/ui/src/test/utils.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Implement type guards for unknown types using the pattern function isType(value: unknown): value is Type
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details in classes
Use protected for inheritance hierarchies
Use public explicitly 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 like Omit, Partial, and Pick for 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 @example tags
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
Use const assertions with as const for literal types
Use satisfies operator 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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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 applying elementDescriptor prop to components and importing descriptors from packages/ui/src/customizables/elementDescriptors.ts
Use theme-aware functions in elements configuration 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 the clerkCssVar utility
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 the createVariants function from packages/ui/src/styledSystem/createVariants.ts for type-safe variant-based styling with base, variants, defaultVariants, and compoundVariants configuration
Wrap primitive components with makeCustomizable HOC from packages/ui/src/customizables/makeCustomizable.tsx to enable element descriptor support and theming
Apply the sx prop using either a theme-aware function (theme: InternalTheme) => StyleRule or 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 CSS light-dark() function via the lightDark utility from packages/ui/src/utils/lightDark.ts for automatic light/dark mode support with fallbacks
Use Emotion's css prop and ThemeProvider via InternalThemeProvider from packages/ui/src/styledSystem/InternalThemeProvider.tsx for styling and theme context
Use makeResponsive from packages/ui/src/customizables/makeResponsive.tsx with breakpoints defined in packages/ui/src/styledSystem/breakpoints.tsx for responsive design support
Use useDeepEqualMemo in AppearanceProvider to prevent unnecessary re-renders when appearance configuration changes

Files:

  • packages/ui/src/test/utils.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.ts
  • packages/ui/src/test/create-fixtures.tsx
  • packages/ui/vitest.config.mts
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/test/fixtures.ts
  • packages/ui/src/test/mock-helpers.ts
  • packages/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.

Comment on lines +238 to +240
export const createBaseClientJSON = (): ClientJSON => {
return {} as ClientJSON;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
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.
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.
@jacekradko jacekradko merged commit d72955e into main Jan 16, 2026
50 checks passed
@jacekradko jacekradko deleted the jacek/user-4359-re-enable-unit-tests branch January 16, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants