Skip to content

Test: Migrate active unit tests from Jest to Vitest - #80992

Closed
ciampo wants to merge 3 commits into
trunkfrom
codex/vitest-consolidated-04-test-migration
Closed

ciampo wants to merge 3 commits into
trunkfrom
codex/vitest-consolidated-04-test-migration

Conversation

@ciampo

@ciampo ciampo commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Part of #80855.

What?

Migrate active Node and jsdom unit tests from Jest to Vitest.

Why?

Make Vitest own deterministic package and integration coverage without hiding browser requirements behind global mocks.

How?

  • Use explicit Vitest imports and scoped browser-signal helpers.
  • Validate every routed test and its TypeScript graph.

The final partition is 1,038 Vitest files and 41 Jest suites. Vitest passes 35,203 tests; Jest passes 596 tests.

Out of scope

This PR moves only tests that can run in Node or jsdom without browser emulation. The remaining stack handles:

Testing Instructions

  1. Run npm run test:unit:routing.
  2. Run npm run test:unit:conventions.
  3. Run npm run test:unit:vitest -- --maxWorkers=2.
  4. Run npm run test:unit -- --runInBand.
  5. Run npm run typecheck and npm run build.

Testing Instructions for Keyboard

Not applicable; this changes tests and infrastructure only.

Use of AI Tools

Codex assisted with implementation and verification. The author reviewed the changes and test output.

@github-actions github-actions Bot added [Package] Element /packages/element [Package] Date /packages/date [Package] Data /packages/data [Package] Server Side Render /packages/server-side-render [Package] A11y /packages/a11y [Package] Autop /packages/autop [Package] DOM ready /packages/dom-ready [Package] Hooks /packages/hooks [Package] i18n /packages/i18n [Package] is-shallow-equal /packages/is-shallow-equal [Package] Url /packages/url [Package] Word count /packages/wordcount [Package] Deprecated packages/deprecated [Package] Blob /packages/blob [Package] Compose /packages/compose [Package] Core data /packages/core-data [Package] API fetch /packages/api-fetch [Package] Viewport /packages/viewport [Package] DOM /packages/dom [Package] Keycodes /packages/keycodes [Package] Plugins /packages/plugins [Package] Components /packages/components [Package] Blocks /packages/blocks [Package] Editor /packages/editor [Package] Redux Routine /packages/redux-routine [Package] Block library /packages/block-library [Package] Notices /packages/notices [Package] Token List /packages/token-list [Package] Format library /packages/format-library [Package] Rich text /packages/rich-text labels Jul 30, 2026
@github-actions github-actions Bot added [Package] Patterns /packages/patterns [Package] DataViews /packages/dataviews [Package] Interactivity Router /packages/interactivity-router [Package] Fields /packages/fields [Package] Theme /packages/theme [Package] UI /packages/ui [Package] Sync /packages/sync labels Jul 30, 2026
@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Size Change: +6 B (0%)

Total Size: 7.92 MB

📦 View Changed
Filename Size Change
build/scripts/compose/index.min.js 11.7 kB +3 B (+0.03%)
build/scripts/editor/index.min.js 580 kB +3 B (0%)

compressed-size-action

@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

Flaky tests detected in ccde47f.
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/33241217686
📝 Reported tests:

two users concurrently move list items (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-stress.spec.ts, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Move up"i]')
    - locator resolved to <button id=":rq:" type="button" tabindex="-1" aria-label="Move up" data-toolbar-item="true" aria-describedby="block-editor-block-mover-button__description-0" class="components-button block-editor-block-mover-button is-up-button is-next-40px-default-size has-icon">…</button>
  - attempting click action
    - waiting for element to be visible, enabled and stable
    - element is not stable
  - retrying click action
    - waiting for element to be visible, enabled and stable
  - element was detached from the DOM, retrying

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-stress.spec.ts:623:7
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-stress.spec.ts:602:3

@ciampo
ciampo force-pushed the codex/vitest-consolidated-03-projects-browser branch from d81f25e to f9682b1 Compare July 30, 2026 23:46
@ciampo
ciampo force-pushed the codex/vitest-consolidated-04-test-migration branch from 58ecf75 to 59f56a3 Compare July 30, 2026 23:47
@ciampo
ciampo force-pushed the codex/vitest-consolidated-03-projects-browser branch from f9682b1 to 45dbb01 Compare July 31, 2026 00:38
@ciampo
ciampo force-pushed the codex/vitest-consolidated-04-test-migration branch from 59f56a3 to 8a81022 Compare July 31, 2026 00:38
@ciampo
ciampo force-pushed the codex/vitest-consolidated-03-projects-browser branch from 45dbb01 to 3a61746 Compare July 31, 2026 01:12
@ciampo
ciampo force-pushed the codex/vitest-consolidated-04-test-migration branch from 8a81022 to 6093aa4 Compare July 31, 2026 01:12
@ciampo
ciampo force-pushed the codex/vitest-consolidated-03-projects-browser branch from 3a61746 to 9878da6 Compare July 31, 2026 02:57
@ciampo
ciampo force-pushed the codex/vitest-consolidated-04-test-migration branch from 56286a1 to 212550f Compare July 31, 2026 02:57
@ciampo
ciampo force-pushed the codex/vitest-consolidated-03-projects-browser branch from 9878da6 to d542198 Compare July 31, 2026 19:21
@ciampo
ciampo force-pushed the codex/vitest-consolidated-04-test-migration branch 3 times, most recently from ff71976 to 34a139f Compare July 31, 2026 19:46
@ciampo
ciampo force-pushed the codex/vitest-consolidated-03-projects-browser branch from 5d74e5a to aa8d0ba Compare July 31, 2026 20:00
@ciampo
ciampo force-pushed the codex/vitest-consolidated-04-test-migration branch from 34a139f to ace2c35 Compare July 31, 2026 20:01
@ciampo
ciampo force-pushed the codex/vitest-consolidated-03-projects-browser branch from aa8d0ba to 9097318 Compare August 11, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] A11y /packages/a11y [Package] Abilities /packages/abilities [Package] Admin UI /packages/admin-ui [Package] API fetch /packages/api-fetch [Package] Autop /packages/autop [Package] Blob /packages/blob [Package] Block editor /packages/block-editor [Package] Block library /packages/block-library [Package] Blocks /packages/blocks [Package] Components /packages/components [Package] Compose /packages/compose [Package] Core commands /packages/core-commands [Package] Core data /packages/core-data [Package] Data Controls /packages/data-controls [Package] Data /packages/data [Package] DataViews /packages/dataviews [Package] Date /packages/date [Package] Deprecated packages/deprecated [Package] Design System MCP /packages/design-system-mcp [Package] DOM ready /packages/dom-ready [Package] DOM /packages/dom [Package] Edit Post /packages/edit-post [Package] Edit Site /packages/edit-site [Package] Edit Widgets /packages/edit-widgets [Package] Editor /packages/editor [Package] Element /packages/element [Package] Escape HTML /packages/escape-html [Package] Fields /packages/fields [Package] Format library /packages/format-library [Package] Grid /packages/grid [Package] Hooks /packages/hooks [Package] i18n /packages/i18n [Package] Icons /packages/icons [Package] Interactivity Router /packages/interactivity-router [Package] Interactivity /packages/interactivity [Package] Interface /packages/interface [Package] is-shallow-equal /packages/is-shallow-equal [Package] Keycodes /packages/keycodes [Package] Media Utils /packages/media-utils [Package] Notices /packages/notices [Package] Plugins /packages/plugins [Package] Preferences /packages/preferences [Package] Priority Queue /packages/priority-queue [Package] Private APIs /packages/private-apis [Package] Project management automation /packages/project-management-automation [Package] Redux Routine /packages/redux-routine [Package] Rich text /packages/rich-text [Package] Server Side Render /packages/server-side-render [Package] Style Engine /packages/style-engine [Package] Sync /packages/sync [Package] Theme /packages/theme [Package] Token List /packages/token-list [Package] UI /packages/ui [Package] Url /packages/url [Package] Viewport /packages/viewport [Package] Views /packages/views [Package] Warning /packages/warning [Package] Widget Dashboard /packages/widget-dashboard [Package] Widget primitives /packages/widget-primitives [Package] Word count /packages/wordcount [Package] wp-build /packages/wp-build [Tool] Babel plugin import JSX pragma /packages/babel-plugin-import-jsx-pragma [Tool] Babel plugin makepot /packages/babel-plugin-makepot [Tool] Babel preset /packages/babel-preset-default [Tool] Browserslist config /packages/browserslist-config [Tool] Dependency Extraction Webpack Plugin /packages/dependency-extraction-webpack-plugin [Tool] Docgen /packages/docgen [Tool] Env /packages/env [Tool] ESLint plugin /packages/eslint-plugin [Tool] npm-package-json-lint config /packages/npm-package-json-lint-config [Tool] Prettier config /packages/prettier-config [Tool] Readable JS Assets Webpack Plugin /packages/readable-js-assets-webpack-plugin [Tool] stylelint config /packages/stylelint-config [Tool] WP Scripts /packages/scripts [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant