Skip to content

chore(jest-serializer): migrate from jest to vitest#940

Merged
layershifter merged 2 commits into
microsoft:mainfrom
layershifter:chore/jest-serializer-vitest
May 6, 2026
Merged

chore(jest-serializer): migrate from jest to vitest#940
layershifter merged 2 commits into
microsoft:mainfrom
layershifter:chore/jest-serializer-vitest

Conversation

@layershifter

Copy link
Copy Markdown
Member

Summary

  • Replace `jest.config.ts` with `vitest.config.mts`; `jest.setup.ts` with `vitest.setup.ts`.
  • Switch project test target to `@nx/vitest:test`.
  • Update `tsconfig.spec.json` types to vitest.
  • Replace the `@testing-library/jest-dom` setup import with `@testing-library/jest-dom/vitest` — the dedicated vitest entry point registers the matchers via vitest's `expect.extend`.
  • Test file uses explicit `import { describe, it, expect } from 'vitest'` — matching `@griffel/core`'s style.
  • Inline snapshots regenerated in vitest's format (`Object` framing dropped).
  • Allow `vitest.setup.ts` under the existing `import-x/no-extraneous-dependencies: off` scope in the root `eslint.config.mjs` (parallel to the existing `jest.setup.ts` entry).

Test plan

  • `nx run @griffel/jest-serializer:test` (5 tests pass)
  • `nx run @griffel/jest-serializer:lint`
  • `nx run @griffel/jest-serializer:type-check`

🤖 Generated with Claude Code

layershifter and others added 2 commits May 6, 2026 22:24
- Replace jest.config.ts with vitest.config.mts; jest.setup.ts with vitest.setup.ts
- Switch project test target to @nx/vitest:test
- Update tsconfig.spec.json types to vitest
- Replace \`@testing-library/jest-dom\` setup with \`@testing-library/jest-dom/vitest\`
  (the dedicated vitest entry point registers the matchers via vitest's expect.extend)
- Add explicit \`import { describe, it, expect } from 'vitest'\` in the test (matching @griffel/core style)
- Inline snapshots regenerated in vitest's format (\`Object\` framing dropped)
- Allow vitest.setup.ts under the existing \`import-x/no-extraneous-dependencies: off\`
  scope in the root eslint config (parallel to jest.setup.ts)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@layershifter layershifter requested a review from a team as a code owner May 6, 2026 20:24
@layershifter layershifter enabled auto-merge (squash) May 6, 2026 20:25
@github-actions

github-actions Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

📊 Bundle size report

✅ No changes found

@layershifter layershifter merged commit ff38cd1 into microsoft:main May 6, 2026
5 checks passed
layershifter added a commit to layershifter/griffel that referenced this pull request May 7, 2026
All packages have been migrated to vitest (microsoft#935-microsoft#940). This drops the
jest runtime entirely:

- Remove root jest.config.ts and jest.preset.js
- Remove @nx/jest:jest target config from nx.json
- Drop devDependencies: @nx/jest, @types/jest, babel-jest,
  eslint-plugin-jest, jest, jest-chrome, jest-environment-jsdom,
  jest-util, ts-jest
- Drop the eslint-plugin-jest plugin and its no-focused-tests rule
  registration from the root eslint config
- Drop **/jest.setup.{js,ts} from the root eslint config's
  no-extraneous-dependencies override scope
- Drop **/jest.config.js from beachball ignorePatterns
- Update lockfile

Note: this PR depends on microsoft#935, microsoft#936, microsoft#937, microsoft#938, microsoft#939, microsoft#940 — merge
those first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
layershifter added a commit that referenced this pull request May 7, 2026
* chore: remove jest, ts-jest, @nx/jest, and related dev dependencies

All packages have been migrated to vitest (#935-#940). This drops the
jest runtime entirely:

- Remove root jest.config.ts and jest.preset.js
- Remove @nx/jest:jest target config from nx.json
- Drop devDependencies: @nx/jest, @types/jest, babel-jest,
  eslint-plugin-jest, jest, jest-chrome, jest-environment-jsdom,
  jest-util, ts-jest
- Drop the eslint-plugin-jest plugin and its no-focused-tests rule
  registration from the root eslint config
- Drop **/jest.setup.{js,ts} from the root eslint config's
  no-extraneous-dependencies override scope
- Drop **/jest.config.js from beachball ignorePatterns
- Update lockfile

Note: this PR depends on #935, #936, #937, #938, #939, #940 — merge
those first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(devtools): use explicit vitest imports

@types/jest was previously providing global describe/it/expect types for
@griffel/devtools' tests. With it removed, switch the tests to explicit
`import { describe, it, expect, vi } from 'vitest'` and drop the now-unused
`vitest/globals` types entry / `globals: true` from vite.config.ts —
matching @griffel/core's style.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Change files

---------

Co-authored-by: Claude Opus 4.7 (1M context) <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.

2 participants