Skip to content

Migrate Details, Token, and CounterLabel tests from Jest to Vitest #6369

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 23, 2025

This PR migrates the test files for Details, Token, and CounterLabel components from Jest to Vitest as part of the ongoing effort to modernize our test suite.

Changes Made

Test Files Migrated

  • packages/react/src/Details/__tests__/Details.test.tsx
  • packages/react/src/Token/__tests__/Token.test.tsx
  • packages/react/src/CounterLabel/CounterLabel.test.tsx

Migration Updates

  • ✅ Added vitest imports (describe, expect, it, vi)
  • ✅ Removed behavesAsComponent usage
  • ✅ Removed checkExports usage
  • ✅ Removed axe accessibility tests with toHaveNoViolations
  • ✅ Converted jest.fn() to vi.fn()
  • ✅ Updated render imports to use @testing-library/react instead of utils/testing
  • ✅ Removed snapshot tests that relied on custom render function

Configuration Updates

  • ✅ Added component paths to vitest.config.browser.mts include list
  • ✅ Added component paths to jest.config.js modulePathIgnorePatterns

Test Results

  • All 40 tests are passing with no act() warnings
  • Jest no longer runs these test files (confirmed with --testPathPattern)
  • Build and linting pass successfully
  • 23 obsolete snapshots cleaned up (no longer needed after migration)

Verification

# Vitest runs the migrated tests
npx vitest --run packages/react/src/Details/__tests__/Details.test.tsx
npx vitest --run packages/react/src/Token/__tests__/Token.test.tsx
npx vitest --run packages/react/src/CounterLabel/CounterLabel.test.tsx

# Jest no longer runs these tests
npm test -- --testPathPattern="Details|Token|CounterLabel" --passWithNoTests

Fixes #6368.


💡 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.

Copy link

changeset-bot bot commented Jul 23, 2025

⚠️ No Changeset found

Latest commit: e6be94b

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 Details, Token, and CounterLabel tests from Jest to Vitest Jul 23, 2025
@Copilot Copilot AI requested a review from pksjce July 23, 2025 01:31
Copilot finished work on behalf of pksjce July 23, 2025 01:31
@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 23, 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-6369 July 23, 2025 03:58 Abandoned
@github-actions github-actions bot requested a deployment to storybook-preview-6369 July 23, 2025 04:07 Abandoned
@pksjce
Copy link
Contributor

pksjce commented Jul 25, 2025

@copilot - I think these tests are already converted. Can you check and if so close this PR

Copy link
Contributor Author

Copilot AI commented Jul 25, 2025

@copilot - I think these tests are already converted. Can you check and if so close this PR

You're absolutely right! I can confirm that these test files have already been converted to Vitest in the main branch. All three files (Details, Token, and CounterLabel) were migrated in commit d349e34 via PR #6348. My PR was based on an older commit and is therefore redundant. This PR should be closed since the work is already completed.

Copilot finished work on behalf of pksjce July 25, 2025 13:35
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update batch of components from Jest to Vitest
2 participants