Skip to content

Update SelectPanel2 tests from Jest to Vitest #6393

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 2 commits into from
Jul 28, 2025
Merged

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 25, 2025

This PR migrates the SelectPanel2 test suite from Jest to Vitest as part of the broader effort to modernize our testing infrastructure.

Changes Made

Configuration Updates

  • Updated vitest.config.browser.mts: Changed the include pattern from a specific file (SelectPanelLoading.test.tsx) to include all SelectPanel2 tests (src/experimental/SelectPanel2/**/*.test.?(c|m)[jt]s?(x))
  • Updated jest.config.js: Added the entire SelectPanel2 directory to modulePathIgnorePatterns to exclude it from Jest runs

Test Migration

  • Migrated SelectPanel.test.tsx from Jest to Vitest syntax:
    • Added describe, expect, it, vi imports from vitest
    • Replaced all jest.fn() calls with vi.fn()
    • Replaced all jest.spyOn() calls with vi.spyOn()
    • Removed manual matchMedia mock setup (Vitest handles browser APIs differently)

Validation

  • ✅ All 13 tests pass under Vitest (11 in SelectPanel.test.tsx + 2 in SelectPanelLoading.test.tsx)
  • ✅ Jest no longer runs SelectPanel2 tests (properly excluded)
  • ✅ No linting errors
  • ✅ Files formatted with Prettier

The migration maintains full test coverage while following the established patterns from other migrated components like Banner.

Fixes #6386.


💬 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 25, 2025

⚠️ No Changeset found

Latest commit: 05cb1c0

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 SelectPanel2 tests from Jest to Vitest Update SelectPanel2 tests from Jest to Vitest Jul 25, 2025
Copilot finished work on behalf of liuliu-dev July 25, 2025 16:49
@Copilot Copilot AI requested a review from liuliu-dev July 25, 2025 16:49
@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 25, 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!

@liuliu-dev liuliu-dev added the skip changeset This change does not need a changelog label Jul 25, 2025
Copy link
Contributor

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 92.21 KB (-0.13% 🔽)
packages/react/dist/browser.umd.js 92.39 KB (-0.1% 🔽)

@liuliu-dev liuliu-dev marked this pull request as ready for review July 25, 2025 17:43
@Copilot Copilot AI review requested due to automatic review settings July 25, 2025 17:43
@liuliu-dev liuliu-dev requested a review from a team as a code owner July 25, 2025 17: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 the SelectPanel2 test suite from Jest to Vitest as part of modernizing the testing infrastructure. The migration ensures all SelectPanel2 tests run under Vitest while being properly excluded from Jest.

  • Updated Vitest configuration to include all SelectPanel2 tests instead of just one specific file
  • Migrated SelectPanel.test.tsx from Jest to Vitest syntax by replacing Jest functions with Vitest equivalents
  • Updated Jest configuration to exclude the entire SelectPanel2 directory from Jest runs

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/react/vitest.config.browser.mts Expanded include pattern to cover all SelectPanel2 tests
packages/react/src/experimental/SelectPanel2/SelectPanel.test.tsx Migrated test syntax from Jest to Vitest
packages/react/jest.config.js Added SelectPanel2 directory to Jest ignore patterns
Comments suppressed due to low confidence (1)

packages/react/src/experimental/SelectPanel2/SelectPanel.test.tsx:117

  • The function selectUnselectedOption is being called without await on lines 127, 141, 155, and 187, but it's defined as an async function. This will cause the function to return a Promise that isn't being awaited, potentially leading to timing issues in tests.
  const selectUnselectedOption = async (container: RenderResult, user: UserEvent) => {

@joshblack joshblack self-requested a review July 28, 2025 18:14
@liuliu-dev liuliu-dev added this pull request to the merge queue Jul 28, 2025
Merged via the queue into main with commit 60713cf Jul 28, 2025
47 of 48 checks passed
@liuliu-dev liuliu-dev deleted the copilot/fix-6386 branch July 28, 2025 18:23
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 SelectPanel2 tests from Jest to Vitest
3 participants