-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Migrate test suite from Jest to Vitest #4049
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
base: main
Are you sure you want to change the base?
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Co-authored-by: jaredpalmer <[email protected]>
Co-authored-by: jaredpalmer <[email protected]>
Co-authored-by: jaredpalmer <[email protected]>
Co-authored-by: jaredpalmer <[email protected]>
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
This PR migrates the Formik project from Jest to Vitest as the testing framework. The migration includes updating test scripts, configuration files, dependencies, and converting all Jest-specific API calls to their Vitest equivalents.
Key changes:
- Replaced Jest with Vitest as the test runner
- Migrated all
jest.fn(),jest.spyOn(), andjest.Mockreferences to Vitest equivalents - Added Vitest configuration files for both formik and formik-native packages
- Updated test scripts and removed Jest-specific configuration from package.json
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Added Vitest and related dependencies, removed Jest types |
| packages/formik/vitest.config.ts | New Vitest configuration with jsdom environment and coverage settings |
| packages/formik-native/vitest.config.ts | New Vitest configuration for native package |
| packages/formik/package.json | Updated test scripts and dependencies for Vitest |
| packages/formik-native/package.json | Updated test scripts and added Vitest dependency |
| packages/formik/test/*.test.tsx | Migrated Jest API calls to Vitest equivalents |
| packages/formik/test/setupTests.ts | Updated with Vitest imports and jest-dom configuration |
| .github/CONTRIBUTING.md | Updated documentation to reference Vitest |
| package.json | Removed @types/jest from root dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Migrated the test suite from Jest (via tsdx) to Vitest, aligning with React 19 testing best practices and modern tooling.
Changes
packages/formik
vitest,@vitest/ui,@vitest/coverage-v8,jsdom,@testing-library/jest-domvitest.config.tswith jsdom environment, globals enabled, and coverage configurationtest/setupTests.tsto import fromvitestand filter React act() warningsjest.fn()→vi.fn()jest.spyOn()→vi.spyOn()jest.Mock→vi.Mockfdescribe→describetest,test:watch,test:ui,test:coveragepackages/formik-native
Root
@types/jestdependencyBefore/After
Results
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.