Skip to content

Migrate Avatar and AvatarStack test files from Jest to Vitest #6217

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 Jun 18, 2025

This PR migrates the test files for Avatar and AvatarStack components from Jest to Vitest as part of the ongoing testing framework migration.

Changes Made

Configuration Updates

  • packages/react/vitest.config.browser.mts: Added Avatar and AvatarStack to the include patterns
  • packages/react/jest.config.js: Added Avatar and AvatarStack to the modulePathIgnorePatterns to exclude them from Jest

Test File Migrations

Avatar.test.tsx

  • ✅ Updated imports to use Vitest (describe, expect, it)
  • ✅ Updated render imports to use @testing-library/react for DOM testing
  • ✅ Maintained testRender from utils/testing for component prop testing
  • ✅ Removed behavesAsComponent usage
  • ✅ Removed checkExports usage
  • ✅ Removed axe accessibility test with toHaveNoViolations
  • ✅ Preserved all functional tests (size, src, margin props, style support)

AvatarStack.test.tsx

  • ✅ Updated imports to use Vitest (describe, expect, it)
  • ✅ Updated all render calls to use @testing-library/react
  • ✅ Removed behavesAsComponent usage
  • ✅ Removed checkExports usage
  • ✅ Removed axe accessibility test with toHaveNoViolations
  • ✅ Replaced snapshot test with specific assertion for alignRight behavior
  • ✅ Fixed describe block name from "Avatar" to "AvatarStack"
  • ✅ Preserved all tabindex and style prop tests

Code Quality

  • All files pass prettier formatting
  • All files pass eslint validation
  • TypeScript compilation successful
  • Minimal changes: 24 insertions, 52 deletions total

Test Coverage

All original test functionality is preserved while removing deprecated testing patterns. The components now run under Vitest instead of Jest, maintaining comprehensive coverage for:

  • Component rendering and props
  • DOM interactions and attributes
  • Style and className support
  • Accessibility features (tabindex behavior)

Fixes #6212.


💡 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 Jun 18, 2025

⚠️ No Changeset found

Latest commit: e3d68be

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

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Update Avatar test files from Jest to Vitest Migrate Avatar and AvatarStack test files from Jest to Vitest Jun 18, 2025
@Copilot Copilot AI requested a review from joshblack June 18, 2025 16:12
Copilot finished work on behalf of joshblack June 18, 2025 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Avatar test files from Jest to Vitest
2 participants