-
Notifications
You must be signed in to change notification settings - Fork 620
Migrate batch of components from Jest to Vitest #6354
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
|
Co-authored-by: joshblack <[email protected]>
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
size-limit report 📦
|
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 four component test files from Jest to Vitest as part of an ongoing test suite migration effort. The migration includes updating imports, removing deprecated test utilities, and updating configuration files to reflect the changes.
- Updated test imports to use Vitest equivalents (
describe
,expect
,it
,vi
) - Replaced Jest-specific utilities with Vitest equivalents and removed deprecated test helpers
- Updated configuration files to include migrated tests in Vitest and exclude them from Jest
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/react/vitest.config.browser.mts | Added migrated test files to Vitest include configuration |
packages/react/jest.config.js | Added migrated test files to Jest ignore patterns |
packages/react/src/experimental/SelectPanel2/tests/SelectPanelLoading.test.tsx | Migrated from Jest to Vitest with timer API updates |
packages/react/src/tests/deprecated/FilteredSearch.test.tsx | Migrated from Jest to Vitest, removed deprecated test utilities |
packages/react/src/tests/deprecated/ActionList.test.tsx | Migrated from Jest to Vitest, simplified test structure |
@@ -94,7 +94,11 @@ export default defineConfig({ | |||
'src/__tests__/filterObject.test.ts', |
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.
The specific test file 'src/tests/deprecated/ActionList.test.tsx' is being added individually, but line 97 already includes the pattern 'src/deprecated/**/*.test.?(c|m)[jt]s?(x)' which would match this file. This creates redundant configuration.
'src/__tests__/filterObject.test.ts', | |
Copilot uses AI. Check for mistakes.
@@ -94,7 +94,11 @@ export default defineConfig({ | |||
'src/__tests__/filterObject.test.ts', | |||
'src/__tests__/theme.test.ts', |
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.
The specific test file 'src/tests/deprecated/FilteredSearch.test.tsx' is being added individually, but this path doesn't match the existing pattern on line 97. However, having both specific files and patterns can lead to maintenance overhead and confusion about which files are included.
'src/__tests__/theme.test.ts', |
Copilot uses AI. Check for mistakes.
This PR migrates four component test files from Jest to Vitest as part of the ongoing test suite migration:
packages/react/src/__tests__/deprecated/ActionList.test.tsx
packages/react/src/__tests__/deprecated/FilteredSearch.test.tsx
packages/react/src/experimental/SelectPanel2/__tests__/SelectPanelLoading.test.tsx
packages/react/src/deprecated/UnderlineNav/UnderlineNavLink.test.tsx
Changes Made
Configuration Updates
include
config invitest.config.browser.mts
modulePathIgnorePatterns
config injest.config.js
to exclude them from JestTest File Migrations
describe
,expect
,it
,vi
)render
imports to use@testing-library/react
instead ofutils/testing
behavesAsComponent
usage as specified in migration guidelinescheckExports
usage as specified in migration guidelinestoHaveNoViolations
as specified in migration guidelinesjest.useFakeTimers()
andjest.runAllTimers()
withvi.useFakeTimers()
andvi.runAllTimers()
All tests are now running successfully in the Vitest browser environment with 7 tests passing across the 4 migrated files.
Fixes #6353.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.