-
Notifications
You must be signed in to change notification settings - Fork 61
test: migrate jest to vitest #3541
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
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 test infrastructure from Jest to Vitest across all packages in the monorepo. The migration brings improved performance through native ESM support and eliminates the need for Babel transpilation, while maintaining feature parity with the Jest-based tests.
Key Changes
- Replaced Jest with Vitest as the test runner across 9 packages (plugin-manifest-validator, profile-loader, customize-uploader, webpack-plugin-kintone-plugin, dts-gen, plugin-packer, create-plugin, rest-api-client, and root workspace)
- Added
vitest.config.tsfiles for each package with appropriate test configurations - Migrated test API calls from Jest to Vitest equivalents (
jest.fn()→vi.fn(),jest.mock()→vi.mock(), etc.) - Introduced
tsconfig.test.jsonfiles in each package for better TypeScript integration with Vitest globals - Consolidated vitest as a root dependency (removed from individual packages for hoisting)
- Added eslint-plugin-vitest for enhanced test code linting
Reviewed changes
Copilot reviewed 69 out of 72 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts (root) | Root-level Vitest configuration |
| tsconfig.test.json (root) | TypeScript configuration for test files |
| tsconfig.json (root) | Updated to exclude test files and reference test config |
| pnpm-lock.yaml | Dependency changes: removed Jest packages, added Vitest and related packages |
| packages/*/vitest.config.ts | Package-specific Vitest configurations |
| packages/*/tsconfig.test.json | Package-specific TypeScript test configurations |
| packages/*/tsconfig.json | Updated to exclude test files and add test config references |
| packages/*/package.json | Updated test scripts from Jest to Vitest |
| packages//**/.test.ts | Updated test files with Vitest API equivalents |
| packages/*/jest.config.js | Removed Jest configuration files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/rest-api-client/src/client/__tests__/record/AllRecords.test.ts
Outdated
Show resolved
Hide resolved
packages/rest-api-client/src/client/__tests__/record/AllRecords.test.ts
Outdated
Show resolved
Hide resolved
packages/rest-api-client/src/client/__tests__/record/AllRecords.test.ts
Outdated
Show resolved
Hide resolved
packages/rest-api-client/src/client/__tests__/record/AllRecords.test.ts
Outdated
Show resolved
Hide resolved
52a6636 to
663382b
Compare
Why
Migrating from Jest to Vitest provides the following benefits:
Faster test execution without Babel transpilation
Simplified configuration with native ESM support
Native TypeScript support
What
jest.fn()→vi.fn()jest.mock()→vi.mock()jest.spyOn()→vi.spyOn()jest.clearAllMocks()→vi.clearAllMocks()etc.How to test
Checklist
pnpm lintandpnpm teston the root directory.