Migrate Block Editor Package Tests to Vitest - #80981
Draft
ciampo wants to merge 1 commit into
Draft
Conversation
|
Size Change: 0 B Total Size: 7.76 MB |
|
Flaky tests detected in 8d974eb. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/30556666583
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Follow up to #80855.
TL;DR: This migrates all 133
@wordpress/block-editorunit-test files from Jest to Vitest. The necessary change classes are explicit Vitest imports, ESM-aware module mocks and module lifecycle, public-package partial mocks in place of deep source mocks, modern fake timers, and Vitest snapshot metadata.Why?
This is the next bounded package slice in the repository-wide Jest-to-Vitest migration. Keeping the package migration in one independently revertible PR preserves the exactly-one-runner invariant while making its module-mocking and snapshot differences reviewable in context.
How?
packages/block-editorto the Vitest jsdom project and adds the package-local Vitest development dependency.vi.mock( import( … ) )factories.@wordpress/dataand@wordpress/blockssource mocks with public-package partial mocks.@ariakit/testconsumers remain on jsdom intentionally and will move to Vitest Browser Mode in a separate browser-focused PR.Testing Instructions
npm run test:unit:vitest -- --project jsdom packages/block-editornpm run --workspace @wordpress/unit-tests test:unit:routingnpm run --workspace @wordpress/unit-tests test:unit:conventionsnpm run lint:pkg-json -- packages/block-editor/package.jsonnpm run lint:lockfilenpm run test:unit:vitestVerified locally:
Testing Instructions for Keyboard
Not applicable; this changes test infrastructure only.
Screenshots or screencast
Not applicable.
Use of AI Tools
Codex was used to inventory the package tests, apply the mechanical runner conversion, investigate Vitest-specific module differences, and run the verification commands. The resulting diff and snapshot entries were reviewed directly.