-
Notifications
You must be signed in to change notification settings - Fork 621
Update SelectPanel2 tests from Jest to Vitest #6393
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: liuliu-dev <[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 the SelectPanel2 test suite from Jest to Vitest as part of modernizing the testing infrastructure. The migration ensures all SelectPanel2 tests run under Vitest while being properly excluded from Jest.
- Updated Vitest configuration to include all SelectPanel2 tests instead of just one specific file
- Migrated SelectPanel.test.tsx from Jest to Vitest syntax by replacing Jest functions with Vitest equivalents
- Updated Jest configuration to exclude the entire SelectPanel2 directory from Jest runs
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
packages/react/vitest.config.browser.mts | Expanded include pattern to cover all SelectPanel2 tests |
packages/react/src/experimental/SelectPanel2/SelectPanel.test.tsx | Migrated test syntax from Jest to Vitest |
packages/react/jest.config.js | Added SelectPanel2 directory to Jest ignore patterns |
Comments suppressed due to low confidence (1)
packages/react/src/experimental/SelectPanel2/SelectPanel.test.tsx:117
- The function
selectUnselectedOption
is being called withoutawait
on lines 127, 141, 155, and 187, but it's defined as an async function. This will cause the function to return a Promise that isn't being awaited, potentially leading to timing issues in tests.
const selectUnselectedOption = async (container: RenderResult, user: UserEvent) => {
This PR migrates the SelectPanel2 test suite from Jest to Vitest as part of the broader effort to modernize our testing infrastructure.
Changes Made
Configuration Updates
vitest.config.browser.mts
: Changed the include pattern from a specific file (SelectPanelLoading.test.tsx
) to include all SelectPanel2 tests (src/experimental/SelectPanel2/**/*.test.?(c|m)[jt]s?(x)
)jest.config.js
: Added the entire SelectPanel2 directory tomodulePathIgnorePatterns
to exclude it from Jest runsTest Migration
SelectPanel.test.tsx
from Jest to Vitest syntax:describe
,expect
,it
,vi
imports fromvitest
jest.fn()
calls withvi.fn()
jest.spyOn()
calls withvi.spyOn()
matchMedia
mock setup (Vitest handles browser APIs differently)Validation
SelectPanel.test.tsx
+ 2 inSelectPanelLoading.test.tsx
)The migration maintains full test coverage while following the established patterns from other migrated components like Banner.
Fixes #6386.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.