Repository navigation
Test: Migrate Node unit tests to Vitest - #82211
Conversation
|
Size Change: 0 B Total Size: 7.91 MB |
|
Flaky tests detected in 0c78ff1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33405341092 two users concurrently move list items (RTC WebSocket) in
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
manzoorwanijk
left a comment
There was a problem hiding this comment.
Given the size of the PR, I relied fully on the AI review for this.
There was a problem hiding this comment.
Pull request overview
Migrates deterministic Node unit tests from Jest to Vitest while retaining Jest for jsdom tests.
Changes:
- Adds explicit Vitest imports, mocks, matcher types, and snapshots.
- Routes Node tests through shared Vitest configuration and CI.
- Adds direct Vitest workspace dependencies while preserving jsdom’s Jest dependencies.
Reviewed changes
Copilot reviewed 298 out of 639 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Node test files and snapshots | Migrates test APIs and expected snapshots to Vitest. |
| Workspace manifests and lockfile | Declares consistent direct Vitest dependencies. |
test/unit/* |
Configures routing, setup, conventions, and matcher types. |
test/integration/* |
Supports both transitional Jest and Vitest timers. |
tools/eslint/config.mjs |
Applies test linting to migrated Node tests. |
packages/jest-console/* |
Preserves console spies and supports Vitest-driven tests. |
.github/workflows/*, bin/unit-test-date.sh |
Runs migrated tests through Vitest in CI. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🤖 PR meta 🤖📦 Bundle sizeSize Change: 0 B Total Size: 7.91 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
|
| @@ -1,17 +1,36 @@ | |||
| import { spyOn } from 'jest-mock'; | |||
There was a problem hiding this comment.
@aduth looks like copilot is picking up repo skills while reviewing 🎉
There was a problem hiding this comment.
Added an isolated real-Jest subprocess test for jest.restoreAllMocks() in 7f81705, then made it load the source entry through the repository transformer in c192bc3
manzoorwanijk
left a comment
There was a problem hiding this comment.
Looks good to me now. Thank you for this effort.
What?
Part of #80855.
Follows #82210.
Migrate deterministic Node unit tests from Jest to Vitest. This also adds the direct workspace dependencies and shared runner configuration used by the following jsdom migration.
jsdom tests and their Jest-only dependencies stay on Jest until the next PR in this stack.
Why?
Separating Node and jsdom tests keeps the migration reviewable and leaves DOM-specific setup out of this layer.
How?
Note
This is a large PR, but 99% of the changes are mechanical.
If reviewers feel strongly about the PR size being too large, I could split it into 3/4 PRs (or more).
Route the migrated Node tests through Vitest, convert Jest imports and mocks, preserve the remaining Jest test route and its package dependencies, and declare project matchers through Vitest's
Matchersinterface.Follow-up cleanup
@wordpress/vitest-consoleown the console matcher implementation and types.Testing Instructions
npm run --workspace @wordpress/unit-tests test:unit:routing.npm run --workspace @wordpress/unit-tests test:unit:conventions.npm run test:unit:vitest -- --project=node.npm run test:unit -- --runInBand --shard=1/4through--shard=4/4.npm run typecheck.Testing Instructions for Keyboard
Not applicable; this PR does not change the UI.
Use of AI Tools
Codex helped split, verify, and document the changes. I reviewed the result.