Skip to content

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

Merged
merged 3 commits into from
Jul 24, 2025
Merged

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 22, 2025

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

  • Added the migrated test files to the include config in vitest.config.browser.mts
  • Added the migrated test files to the modulePathIgnorePatterns config in jest.config.js to exclude them from Jest

Test File Migrations

  • Replaced Jest imports with Vitest equivalents (describe, expect, it, vi)
  • Updated render imports to use @testing-library/react instead of utils/testing
  • Removed behavesAsComponent usage as specified in migration guidelines
  • Removed checkExports usage as specified in migration guidelines
  • Removed axe accessibility tests with toHaveNoViolations as specified in migration guidelines
  • Replaced jest.useFakeTimers() and jest.runAllTimers() with vi.useFakeTimers() and vi.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.

Copy link

changeset-bot bot commented Jul 22, 2025

⚠️ No Changeset found

Latest commit: 1c93ea9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Copilot Copilot AI changed the title [WIP] Update batch of components from Jest to Vitest Migrate batch of components from Jest to Vitest Jul 22, 2025
@Copilot Copilot AI requested a review from joshblack July 22, 2025 18:30
Copilot finished work on behalf of joshblack July 22, 2025 18:30
@joshblack joshblack added the skip changeset This change does not need a changelog label Jul 22, 2025
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 22, 2025
Copy link
Contributor

👋 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!

@github-actions github-actions bot requested a deployment to storybook-preview-6354 July 22, 2025 18:34 Abandoned
Copy link
Contributor

github-actions bot commented Jul 22, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 92.21 KB (0%)
packages/react/dist/browser.umd.js 92.39 KB (0%)

@joshblack joshblack marked this pull request as ready for review July 24, 2025 21:43
@Copilot Copilot AI review requested due to automatic review settings July 24, 2025 21:43
@joshblack joshblack requested a review from a team as a code owner July 24, 2025 21:43
@joshblack joshblack requested a review from TylerJDev July 24, 2025 21:43
Copy link
Contributor

@Copilot Copilot AI left a 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',
Copy link
Preview

Copilot AI Jul 24, 2025

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.

Suggested change
'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',
Copy link
Preview

Copilot AI Jul 24, 2025

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.

Suggested change
'src/__tests__/theme.test.ts',

Copilot uses AI. Check for mistakes.

@joshblack joshblack merged commit 4e5f437 into main Jul 24, 2025
41 checks passed
@joshblack joshblack deleted the copilot/fix-6353 branch July 24, 2025 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update batch of components from Jest to Vitest
3 participants