Skip to content

refactor: update tests from Jest to Vitest #6335

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

Conversation

joshblack
Copy link
Member

Part of: https://github.com/github/primer/issues/5336

Changelog

New

Changed

  • Update test files from Jest to Vitest

Removed

Rollout strategy

  • None; if selected, include a brief description as to why

@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 17:50
@joshblack joshblack requested a review from a team as a code owner July 17, 2025 17:50
@joshblack joshblack requested a review from francinelucca July 17, 2025 17:50
Copy link

changeset-bot bot commented Jul 17, 2025

⚠️ No Changeset found

Latest commit: dc14a86

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

@joshblack joshblack added the skip changeset This change does not need a changelog label Jul 17, 2025
@github-actions github-actions bot added the staff Author is a staff member label Jul 17, 2025
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 test files from Jest to Vitest as part of a broader testing framework transition. The changes update test imports, configuration files, and snapshot formats to be compatible with Vitest while maintaining the same test functionality.

Key changes include:

  • Adding Vitest imports (describe, it, expect) to test files
  • Updating Jest configuration and Vitest configuration to include newly migrated test paths
  • Converting Jest snapshot format to Vitest snapshot format

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/react/vitest.config.browser.mts Added test paths for Hidden and deprecated components, reordered existing paths alphabetically
packages/react/jest.config.js Added corresponding test paths and reordering to match Vitest config
packages/react/src/deprecated/utils/createSlots.test.tsx Added Vitest imports and reordered React import
packages/react/src/deprecated/utils/snapshots/createSlots.test.tsx.snap Updated snapshot format from Jest to Vitest
packages/react/src/deprecated/UnderlineNav/UnderlineNavLink.test.tsx Migrated from custom testing utils to standard testing-library with Vitest imports
packages/react/src/deprecated/UnderlineNav/UnderlineNav.test.tsx Migrated from custom testing utils to standard testing-library, removed accessibility tests
packages/react/src/Hidden/snapshots/Hidden.test.tsx.snap Updated snapshot format and class name expectations
packages/react/src/Hidden/Hidden.test.tsx Simplified test file by removing custom testing utilities and accessibility checks

import axe from 'axe-core'
import {render} from '@testing-library/react'
import {describe, it, expect} from 'vitest'
import UnderlineNav from '../UnderlineNav'
Copy link
Preview

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import path '../UnderlineNav' is inconsistent with the original import pattern. It should be 'import {UnderlineNav} from '../../deprecated'' to maintain consistency with the UnderlineNavLink test file and ensure the correct component is imported.

Suggested change
import UnderlineNav from '../UnderlineNav'
import {UnderlineNav} from '../../deprecated'

Copilot uses AI. Check for mistakes.

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 added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 17, 2025
Copy link
Contributor

size-limit report 📦

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

@joshblack joshblack added this pull request to the merge queue Jul 22, 2025
Merged via the queue into main with commit dc24bb7 Jul 22, 2025
49 of 50 checks passed
@joshblack joshblack deleted the refactor/update-tests-to-vitest-jul-17 branch July 22, 2025 17:48
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 staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants