Skip to content

Test: Use native Vite transforms for unit tests - #80997

Draft
ciampo wants to merge 1 commit into
codex/vitest-consolidated-05-browser-modefrom
codex/vitest-consolidated-06-native-vite
Draft

Test: Use native Vite transforms for unit tests#80997
ciampo wants to merge 1 commit into
codex/vitest-consolidated-05-browser-modefrom
codex/vitest-consolidated-06-native-vite

Conversation

@ciampo

@ciampo ciampo commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Part of #80855.

What?

TL;DR — transform changes: replace the private Babel-wide Vitest transform with Vite's official React/SWC path, remove the Jest-only block metadata transformer, and migrate the remaining internal agent-tool test to Vitest.

Why?

The final runner should use native Vite module handling rather than carry the legacy Jest/Babel execution pipeline into Vitest.

How?

  • Use @vitejs/plugin-react-swc with the official Emotion SWC plugin.
  • Preserve readable Emotion labels and normalize generated hashes only in diff snapshots.
  • Replace Babel parsing in the conventions validator with typescript-eslint.
  • Migrate tools/agents tests to explicit Vitest imports.
  • Replace the Jest cache-key transformer with a Vite module-graph test proving block.json invalidation.
  • Remove the unit workspace's direct Babel transform dependencies.
Runtime requirements

@vitejs/plugin-react-swc@4.3.2 requires Node ^20.19.0 || >=22.12.0, matching Gutenberg's existing Node floor. The npm minimum remains >=10.2.3.

Testing Instructions

  1. Run npm run test:unit:routing and npm run test:unit:conventions.
  2. Run the Node project, all four jsdom shards, and the Browser project.
  3. Run npm run test:unit -- --runInBand.
  4. Run focused lint for test/unit and tools/agents.

Testing Instructions for Keyboard

Not applicable; this changes test infrastructure only.

Use of AI Tools

Codex assisted with implementation, compatibility checks, and verification. The resulting changes and snapshots were reviewed by the author.

@github-actions github-actions Bot added the [Package] Components /packages/components label Jul 30, 2026
@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 7.76 MB

compressed-size-action

@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from d779272 to 86413d3 Compare July 30, 2026 23:48
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from 01dd9ff to 9a765e2 Compare July 30, 2026 23:48
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown

Flaky tests detected in ccc5142.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/30598125515
📝 Reported issues:

@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from 86413d3 to 1551ea0 Compare July 31, 2026 00:38
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from 9a765e2 to adcc20e Compare July 31, 2026 00:38
@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from 1551ea0 to 9529651 Compare July 31, 2026 01:12
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from adcc20e to e0a5a42 Compare July 31, 2026 01:12
@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from 9529651 to d5e3139 Compare July 31, 2026 01:20
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from e0a5a42 to 5e35c37 Compare July 31, 2026 01:20
@github-actions github-actions Bot added [Package] Core data /packages/core-data [Package] Editor /packages/editor labels Jul 31, 2026
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from 7bf6188 to 987e70b Compare July 31, 2026 01:45
@github-actions github-actions Bot removed the [Package] Editor /packages/editor label Jul 31, 2026
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from 987e70b to ccc5142 Compare July 31, 2026 02:06
@github-actions github-actions Bot removed the [Package] Core data /packages/core-data label Jul 31, 2026
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from ccc5142 to f9f8ded Compare July 31, 2026 02:57
@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from 4e3dd77 to 3eec742 Compare July 31, 2026 02:57
@ciampo ciampo self-assigned this Jul 31, 2026
@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from 3eec742 to 8f70fba Compare July 31, 2026 19:21
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from f9f8ded to e75e488 Compare July 31, 2026 19:21
@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from 8f70fba to 7ce22c8 Compare July 31, 2026 19:36
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from e75e488 to ddc3d8e Compare July 31, 2026 19:36
@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from 7ce22c8 to 3b5ef70 Compare July 31, 2026 19:46
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from ddc3d8e to 8f6a343 Compare July 31, 2026 19:46
@ciampo
ciampo force-pushed the codex/vitest-consolidated-05-browser-mode branch from 3b5ef70 to 474050f Compare July 31, 2026 20:01
@ciampo
ciampo force-pushed the codex/vitest-consolidated-06-native-vite branch from 8f6a343 to b563371 Compare July 31, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant