-
Notifications
You must be signed in to change notification settings - Fork 624
Update SelectPanel test from Jest to Vitest #6433
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: pksjce <[email protected]>
return liveRegion as LiveRegionElement | ||
} | ||
throw new Error('No live-region found') | ||
} |
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.
@copilot - All this liveregion additions are not required. remove them
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.
Removed the local live region implementation and restored the original import from ../utils/testing
as requested. (1d11df5)
…ls/testing Co-authored-by: pksjce <[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! |
@copilot - Its just test file changes. Integration tests are not needed. Remove the tag |
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 SelectPanel test file from Jest to Vitest as part of the broader test framework migration effort. The changes ensure proper configuration separation between Jest and Vitest while maintaining test functionality.
Key changes:
- Updated test framework imports and mocking functions from Jest to Vitest syntax
- Configured Vitest to include SelectPanel tests and Jest to exclude them
- Replaced browser compatibility issues with globalThis instead of global
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
vitest.config.browser.mts |
Added SelectPanel test inclusion pattern for Vitest |
SelectPanel.test.tsx |
Migrated all Jest syntax to Vitest equivalents and removed Node.js dependencies |
jest.config.js |
Added SelectPanel directory to Jest ignore patterns |
Comments suppressed due to low confidence (1)
packages/react/src/SelectPanel/SelectPanel.test.tsx:10
- The import from '../utils/testing' may cause issues in the browser environment as mentioned in the PR description. Consider implementing a local version of getLiveRegion or ensure this import is compatible with Vitest's browser environment.
import {getLiveRegion} from '../utils/testing'
size-limit report 📦
|
…t file changes Co-authored-by: pksjce <[email protected]>
Co-authored-by: pksjce <[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! |
This PR migrates the SelectPanel test file from Jest to Vitest as part of the broader test suite migration effort.
Changes Made
Configuration Updates:
<rootDir>/src/SelectPanel/
to the Jest modulePathIgnorePatterns injest.config.js
to exclude it from Jest runsTest File Migration:
describe
,expect
,it
,vi
,beforeEach
) instead of Jestjest.fn()
→vi.fn()
jest.useFakeTimers()
→vi.useFakeTimers()
jest.runAllTimers()
→vi.runAllTimers()
jest.useRealTimers()
→vi.useRealTimers()
jest.advanceTimersByTime
→vi.advanceTimersByTime
global.Element.prototype.scrollTo = jest.fn()
withglobalThis.Element.prototype.scrollTo = vi.fn()
for browser compatibilitysetupMatchMedia()
usage and import as specified in migration guidelines../utils/testing
for thegetLiveRegion
utilityTesting
The SelectPanel test file has been successfully migrated to Vitest and added to the browser test configuration. The tests will now run as part of the Vitest component test suite using the browser environment.
Fixes #6381.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.