-
Notifications
You must be signed in to change notification settings - Fork 417
test(clerk-js): Add initial support for vitest #6069
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
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 62b1e89 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 |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
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.
Pull Request Overview
Adds initial support for Vitest alongside existing Jest tests in the clerk-js package to enable incremental migration.
- Introduces Vitest setup and configuration files.
- Migrates select test files (
*.spec.ts/.tsx) to Vitest, updating imports and mocks. - Updates package scripts and dependencies to include Vitest commands and plugins.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/clerk-js/vitest.setup.mts | Global cleanup after each Vitest test |
| packages/clerk-js/vitest.config.mts | Vitest configuration with React plugin and include patterns |
| packages/clerk-js/src/utils/tests/email.spec.ts | Switched email utility tests to Vitest imports |
| packages/clerk-js/src/ui/router/tests/HashRouter.spec.tsx | Migrated router tests from Jest to Vitest (vi.fn, vi.mock) |
| packages/clerk-js/package.json | Updated test script to run Jest and Vitest; added test:vitest |
| package.json | Added @vitejs/plugin-react dependency |
| .changeset/every-cows-think.md | Added empty changeset placeholder |
Comments suppressed due to low confidence (1)
.changeset/every-cows-think.md:1
- This changeset file is empty. Please add a summary and version bump (major/minor/patch) in the frontmatter so releases are correctly generated.
---
jacekradko
left a comment
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.
![]()
Description
This PR adds initial support for Vitest in
clerk-js.Right now,
clerk-jsmakes extensive use of Jest for unit tests, and it's not feasible to perform a full replacement in a single PR. So, to support incremental adoption, this PR introduces Vitest support in*.spec.tsfiles (whereas Jest uses*.test.tsfiles). This allows us to write tests specifically for Vitest, and move Jest tests to Vitest file by file.To run both Jest and Vitest tests, you can run
pnpm test. Vitest tests can be run in watch mode withpnpm test:vitest.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change