Skip to content

refactor: update tests to vitest, move all component tests to folders #6018

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 17 commits into from
May 9, 2025

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented May 7, 2025

This PR continues our move to vitest by migrating several components from Jest to Vitest. This also moves component tests that were defined in src/__tests__ to their respective component folder.

Changelog

New

Changed

  • Update the following test suites to vitest:
    • ActionBar
    • AnchoredOverlay
    • ToggleSwitch
    • Truncate
    • UnderlineNav
  • Update the following tests to be in their component folder:
    • ActionMenu
    • AnchoredOverlay
    • Autocomplete
    • AvatarStack
    • Box
    • CheckboxGroup
    • CircleBadge
    • CircleOcticon
    • CounterLabel
    • Header
    • KeybindingHint
    • Label
    • LabelGroup
    • Pagination
    • PointerBox
    • Popover
    • Portal
    • ProgressBar
    • Radio
    • RadioGroup
    • RelativeTime
    • Select
    • SelectPanel
    • Spinner
    • SubNav
    • TextInput
    • TextInputWithTokens
    • Textarea
    • ToggleSwitch
    • Truncate
    • UnderlineNav

Removed

Rollout strategy

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

This is a change to our internal testing structure

@Copilot Copilot AI review requested due to automatic review settings May 7, 2025 17:16
@joshblack joshblack requested a review from a team as a code owner May 7, 2025 17:16
@joshblack joshblack requested a review from hectahertz May 7, 2025 17:17
Copy link

changeset-bot bot commented May 7, 2025

⚠️ No Changeset found

Latest commit: b69e941

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

@github-actions github-actions bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels May 7, 2025
Copy link
Contributor

github-actions bot commented May 7, 2025

👋 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 May 7, 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 component test suites from Jest to Vitest and reorganizes test file locations.

  • Migrated ActionBar, AnchoredOverlay, ToggleSwitch, Truncate, and UnderlineNav tests from Jest to Vitest.
  • Moved component tests out of src/__tests__ into their respective component folders.
  • Updated snapshot headers and class/hash outputs for Vitest compatibility.

Reviewed Changes

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

Show a summary per file
File Description
packages/react/src/CounterLabel/CounterLabel.types.test.tsx Removed TS type test functions and cleaned up unused imports
packages/react/src/AnchoredOverlay/snapshots/AnchoredOverlay.test.tsx.snap Updated snapshot format, class hashes, and inline style values
packages/react/src/AnchoredOverlay/AnchoredOverlay.test.tsx Replaced Jest utilities with Vitest imports, removed legacy tests
packages/react/src/ActionBar/ActionBar.test.tsx Switched to Vitest, updated testing-library usage, dropped Axe tests
packages/react/jest.config.js Updated modulePathIgnorePatterns to ignore migrated test folders
Comments suppressed due to low confidence (3)

packages/react/src/CounterLabel/CounterLabel.types.test.tsx:10

  • Tests for ref forwarding and custom span prop acceptance were removed. Consider reintroducing showAcceptARef and shouldPassThroughSpanProps to maintain verification of these typings.
export function showAcceptARef() {

packages/react/src/AnchoredOverlay/AnchoredOverlay.test.tsx:3

  • Axe accessibility tests were removed in this migration. Reintroduce accessibility checks or an equivalent approach to preserve a11y coverage for AnchoredOverlay.
import {AnchoredOverlay} from '../AnchoredOverlay'

packages/react/src/ActionBar/ActionBar.test.tsx:2

  • Accessibility (axe) test cases were removed. Ensure you add back accessibility validations to catch regressions in the ActionBar component.
import {describe, expect, it, afterEach, vi} from 'vitest'

Copy link
Contributor

github-actions bot commented May 7, 2025

size-limit report 📦

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

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

nice 🤘🏻

@joshblack joshblack enabled auto-merge May 7, 2025 21:01
@joshblack joshblack disabled auto-merge May 9, 2025 15:03
@joshblack joshblack added this pull request to the merge queue May 9, 2025
Merged via the queue into main with commit 6b28a4a May 9, 2025
45 checks passed
@joshblack joshblack deleted the refactor/update-tests-to-vitest branch May 9, 2025 15:16
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