Skip to content

Move tests for SplitPageLayout and PageLayout to vitest #6310

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 6 commits into from
Jul 10, 2025
Merged

Conversation

pksjce
Copy link
Contributor

@pksjce pksjce commented Jul 9, 2025

Works on https://github.com/github/primer/issues/5336
Made necessary changes for this.

@Copilot Copilot AI review requested due to automatic review settings July 9, 2025 05:12
@pksjce pksjce requested a review from a team as a code owner July 9, 2025 05:12
@pksjce pksjce requested a review from jonrohan July 9, 2025 05:12
Copy link

changeset-bot bot commented Jul 9, 2025

⚠️ No Changeset found

Latest commit: a506923

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

@pksjce pksjce requested a review from joshblack July 9, 2025 05:12
@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 9, 2025
Copy link
Contributor

github-actions bot commented Jul 9, 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!

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 tests for PageLayout and SplitPageLayout components from Jest to Vitest, updating test configurations, snapshot files, and test code to be compatible with the new testing framework.

  • Updates vitest.config.browser.mts to include PageLayout and SplitPageLayout test patterns
  • Converts Jest snapshots to Vitest format with updated class names and test structure
  • Removes Jest-specific dependencies and replaces with Vitest equivalents

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/react/vitest.config.browser.mts Adds test patterns for PageLayout and SplitPageLayout components
packages/react/src/SplitPageLayout/SplitPageLayout.test.tsx Updates imports and removes Jest-specific MatchMedia mock setup
packages/react/src/SplitPageLayout/snapshots/SplitPageLayout.test.tsx.snap Converts Jest snapshots to Vitest format with updated class names
packages/react/src/PageLayout/PageLayout.test.tsx Migrates test code from Jest to Vitest with updated mocking and browser APIs
packages/react/src/PageLayout/snapshots/PageLayout.test.tsx.snap Updates snapshots with Vitest format and new CSS class names

Comment on lines 8 to 9
import {client} from '@figma/code-connect'

Copy link
Preview

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

This import appears to be unused in the test file. Consider removing it to keep the imports clean.

Suggested change
import {client} from '@figma/code-connect'

Copilot uses AI. Check for mistakes.

@@ -91,7 +84,7 @@ describe('PageLayout', () => {
it.skip('shows all subcomponents by default', () => {
// Set regular viewport
act(() => {
matchMedia.useMediaQuery(viewportRanges.regular)
matchMedia(viewportRanges.regular)
Copy link
Preview

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

This line appears to be calling matchMedia as a function without window prefix, but matchMedia should be window.matchMedia() to be consistent with line 68.

Suggested change
matchMedia(viewportRanges.regular)
window.matchMedia(viewportRanges.regular)

Copilot uses AI. Check for mistakes.

@@ -170,13 +163,18 @@ describe('PageLayout', () => {
const placeholder = await screen.findByText('Pane')
const pane = placeholder.parentNode
const initialWidth = (pane as HTMLElement).style.getPropertyValue('--pane-width')

console.log('initialWidth', initialWidth)
Copy link
Preview

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

Debug console.log statement should be removed from the test code.

Suggested change
console.log('initialWidth', initialWidth)
// Removed debug statement logging initialWidth

Copilot uses AI. Check for mistakes.

const finalWidth = (pane as HTMLElement).style.getPropertyValue('--pane-width')
console.log('finalWidth', finalWidth)
Copy link
Preview

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

Debug console.log statement should be removed from the test code.

Suggested change
console.log('finalWidth', finalWidth)

Copilot uses AI. Check for mistakes.

Copy link
Contributor

github-actions bot commented Jul 9, 2025

size-limit report 📦

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

@pksjce pksjce added the skip changeset This change does not need a changelog label Jul 9, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-6310 July 9, 2025 05:18 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-6310 July 9, 2025 05:28 Inactive
@pksjce pksjce enabled auto-merge July 9, 2025 21:22
@pksjce pksjce added this pull request to the merge queue Jul 10, 2025
Merged via the queue into main with commit 32876d4 Jul 10, 2025
43 checks passed
@pksjce pksjce deleted the pk/vitest branch July 10, 2025 00:59
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.

3 participants