Repository navigation
Test: Classify and enforce unit test environments by filename - #80991
Conversation
|
Size Change: 0 B Total Size: 7.92 MB |
6c16f00 to
57a0bf5
Compare
d81f25e to
f9682b1
Compare
|
Flaky tests detected in 29de986. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33212055973 Should save the changes in
|
57a0bf5 to
83736a6
Compare
f9682b1 to
45dbb01
Compare
83736a6 to
2216a5f
Compare
3a61746 to
9878da6
Compare
6f0d9f5 to
59d27ae
Compare
9878da6 to
d542198
Compare
59d27ae to
842e177
Compare
5d74e5a to
aa8d0ba
Compare
842e177 to
5fadb3d
Compare
aa8d0ba to
9097318
Compare
bd5eee3 to
49cabc0
Compare
b17afc1 to
46b3c70
Compare
49cabc0 to
c103b50
Compare
46b3c70 to
7667c4b
Compare
c103b50 to
2cf71e5
Compare
0b00df6 to
7ce5a3f
Compare
2cf71e5 to
c493a8c
Compare
c493a8c to
8d127a2
Compare
|
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. |
Part of #80855.
What?
Classify every unit test by the environment in its filename, and make that filename select the environment:
*.test.*runs in Node.js.*.jsdom.test.*runs in jsdom.*.browser.test.*runs in a real browser.This PR does not move tests from Jest to Vitest. The migration manifest still decides which runner owns a test; the filename now decides which environment that runner uses.
Why?
Vitest uses Node.js by default, while Jest previously ran every test in jsdom. Explicit filenames prevent tests from silently running in the wrong environment during the migration.
The convention is also enforced for future changes. The routing check verifies that every discovered test belongs to exactly one runner and the correct filename-selected project. Per-file
@jest-environmentand@vitest-environmentoverrides are rejected.How?
*.jsdom.test.*, while keeping Node-compatible tests unsuffixed and existing Browser Mode tests as*.browser.test.*.Files that mix DOM-only and browser-dependent assertions are intentionally not split here. A later Browser Mode PR will split them after Browser Mode is enabled for those tests, so the new
*.browser.test.*files run in Chromium instead of Jest's jsdom environment.Testing Instructions
npm run test:unit:routing, andnpm run test:unit:conventionspass. The routing check must report every discovered test in exactly one runner and the correct filename-selected project; the four Jest shards must cover the complete inventory once.Testing Instructions for Keyboard
Not applicable. This PR changes test infrastructure and filenames, with no user-facing or keyboard behavior changes.
Use of AI Tools
Codex assisted with the environment audit, mechanical renames, enforcement, reference updates, verification, and adversarial self-review. The author reviewed the resulting changes and test output.