Skip to content

Migrate batch of components from Jest to Vitest #6356

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 22, 2025

This PR migrates a batch of components from Jest to Vitest testing framework as part of the ongoing migration effort.

Components Migrated

  • Link - Migrated successfully (8 tests passing)
  • Popover - Migrated successfully (14 tests passing)
  • Header - Migrated successfully (6 tests passing)
  • UnderlineNav - Already migrated (7 tests passing)
  • Hidden - Already migrated (3 tests passing, snapshot updated)

Changes Made

Configuration Updates

  • Added Link, Popover, and Header to vitest.config.browser.mts include patterns
  • Added Link, Popover, and Header to jest.config.js modulePathIgnorePatterns

Test File Migrations

  • Updated imports from Jest to Vitest (describe, expect, it, vi)
  • Replaced render from utils/testing with @testing-library/react
  • Removed behavesAsComponent usage (replaced with direct component tests)
  • Removed checkExports usage (no longer needed in Vitest migration)
  • Removed axe accessibility tests with toHaveNoViolations
  • Replaced snapshot-based tests with actual DOM assertions for better reliability
  • Fixed console spy usage for browser environment (globalThis.console instead of global.console)

Test Improvements

  • Link tests now properly assert on DOM attributes and styles instead of snapshots
  • Popover tests verify caret positioning through data attributes
  • Header tests check actual DOM structure and accessibility attributes
  • Updated Hidden component snapshot due to CSS module hash changes

All 38 tests across the 5 components are now passing with Vitest! 🎉

Fixes #6355.


💬 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: c325650

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:39
Copilot finished work on behalf of joshblack July 22, 2025 18:39
@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!

@joshblack joshblack added the skip changeset This change does not need a changelog label Jul 22, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-6356 July 22, 2025 18:42 Abandoned
Copy link
Contributor

github-actions bot commented Jul 22, 2025

size-limit report 📦

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

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
2 participants