Skip to content

chore: migrate core, react, shadow-dom, update-shorthands to vitest#786

Open
layershifter wants to merge 8 commits intomicrosoft:mainfrom
layershifter:chore/migrate-vitest
Open

chore: migrate core, react, shadow-dom, update-shorthands to vitest#786
layershifter wants to merge 8 commits intomicrosoft:mainfrom
layershifter:chore/migrate-vitest

Conversation

@layershifter
Copy link
Member

@layershifter layershifter commented Mar 6, 2026

Summary

  • Migrate @griffel/core, @griffel/react, @griffel/shadow-dom, and @griffel/update-shorthands from Jest to Vitest
  • Fix @griffel/webpack-plugin executor from @nx/vite:test to @nx/vitest:test
  • Use explicit import { ... } from 'vitest' in all test files (no globals)
  • Replace jest.* APIs with vi.* equivalents, update snapshot serializer types
  • Disable import/first for test files in ESLint config (vi.mock() hoisting requires imports after mock setup)
  • Add **/vitest.config.ts to ESLint import/no-extraneous-dependencies override

Test plan

  • nx run @griffel/core:test — 67 files, 429 tests pass
  • nx run @griffel/react:test — 9 files, 17 tests pass
  • nx run @griffel/shadow-dom:test — 2 files, 22 tests pass
  • nx run @griffel/update-shorthands:test — 5 files, 12 tests pass
  • nx run-many --target=type-check passes for all 4 packages
  • nx run @griffel/core:lint passes
  • nx run @griffel/react:lint passes

🤖 Generated with Claude Code

Replace Jest with Vitest for @griffel/core, @griffel/react,
@griffel/shadow-dom, and @griffel/update-shorthands. Also fix
webpack-plugin executor from @nx/vite:test to @nx/vitest:test.

- Add vitest.config.ts for each package
- Update project.json test targets to @nx/vitest:test
- Update tsconfig.spec.json with vitest types
- Delete jest.config.ts from each package
- Replace jest.* APIs with vi.* (jest.fn → vi.fn, jest.mock → vi.mock, etc.)
- Use explicit `import { ... } from 'vitest'` instead of globals
- Update snapshot serializers to use vitest's SnapshotSerializer type
- Fix @jest-environment annotations to @vitest-environment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@layershifter layershifter requested a review from a team as a code owner March 6, 2026 17:08
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

📊 Bundle size report

✅ No changes found

layershifter and others added 7 commits March 6, 2026 18:19
- Remove unused `test` import from 11 files (only `it` is used)
- Add `**/vitest.config.ts` to eslint no-extraneous-dependencies override
- Add eslint-disable for pre-existing empty arrow function patterns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e.test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
vi.mock() hoisting in vitest requires imports after mock setup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant