Skip to content

Test: Migrate deterministic JSDOM tests and harden Vitest isolation - #82212

Merged
ciampo merged 15 commits into
trunkfrom
codex/vitest-consolidated-04-test-migration
Sep 7, 2026
Merged

ciampo merged 15 commits into
trunkfrom
codex/vitest-consolidated-04-test-migration

Conversation

@ciampo

@ciampo ciampo commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Part of #80855. Builds on #82299.

What?

Moves 562 deterministic JSDOM test files from Jest to Vitest. The remaining 39 Jest files stay on Jest.

Why?

Continues the migration after #82299 established runner ownership. Browser-dependent suites remain in #80995.

How?

Converts eligible tests and package test types, adds deterministic isolation, and runs Vitest in a fixed shuffled order with seed 80855.

Testing Instructions

npm run test:unit:routing
npm run test:unit:conventions
npm run test:unit:vitest:shuffled -- --maxWorkers=4
npm run test:unit -- --runInBand
npm run typecheck
npm run build

Routing should report 1,066 Vitest files and 39 Jest files.

Use of AI Tools

Codex was used to implement, test, and review this change. I reviewed the result and take responsibility for it.

@ciampo ciampo added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Aug 29, 2026
@ciampo ciampo self-assigned this Aug 29, 2026
@github-actions github-actions Bot added [Package] Element /packages/element [Package] Data /packages/data [Package] Server Side Render /packages/server-side-render [Package] A11y /packages/a11y [Package] DOM ready /packages/dom-ready [Package] Hooks /packages/hooks [Package] Url /packages/url [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] Block library /packages/block-library [Package] Notices /packages/notices [Package] Format library /packages/format-library [Package] Rich text /packages/rich-text [Package] Block editor /packages/block-editor [Package] Edit Post /packages/edit-post [Package] Priority Queue /packages/priority-queue [Package] Edit Widgets /packages/edit-widgets [Package] Interface /packages/interface [Package] Media Utils /packages/media-utils [Package] Interactivity /packages/interactivity labels Aug 29, 2026
@github-actions

github-actions Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@@ -315,8 +317,8 @@ describe( 'Tooltip', () => {
}, 10_000 );

it( 'should not show tooltip if the mouse leaves the tooltip anchor before set delay', async () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test has recently shown flakiness, let's see if it continues to be flaky under vitest.

We can also consider to convert the test to a browser test, in case.

@ciampo

ciampo commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@manzoorwanijk I added the "Require pr update" label, we can test it on this PR too

@manzoorwanijk

Copy link
Copy Markdown
Member

Great. We noticed some minor issues with the require PR update check. I am creating a PR to fix them for subsequent uses.

@manzoorwanijk

Copy link
Copy Markdown
Member

#82359 is the PR to fix the issues found after Node 24 upgrade merge

@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include @coderabbitai review in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 78830a4c-36e9-4e6c-b5c5-805baa21eddc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@ciampo

ciampo commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

#82359 is the PR to fix the issues found after Node 24 upgrade merge

Is #82359 blocking for this PR to land?

@ciampo

ciampo commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@manzoorwanijk @WordPress/gutenberg-components @sirreal @Mamaduka

I know this is a large PR, but it's mostly a mechanical refactor of Jest => Vitest.

I'd love to merge this PR ASAP since trunk is currently in a weird position where jsdom tests have to be added to Vitest, while we haven't landed the refactor yet.

Could you give this PR a look?

Comment thread packages/global-styles-engine/tsconfig.test.json
Comment thread packages/editor/src/components/post-publish-panel/test/index.jsdom.test.jsx Outdated
Comment thread packages/server-side-render/tsconfig.json Outdated
@Mamaduka

Mamaduka commented Sep 7, 2026

Copy link
Copy Markdown
Member

I think similar PRs require a "leap of faith" (little Indy Jones reference here). The migration looks straightforward, and as long as unit test jobs are passing on CI, it should be good to merge.

We can also follow up with minor fixes as needed.

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] 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 data /packages/core-data [Package] Data /packages/data [Package] DataViews /packages/dataviews [Package] Deprecated packages/deprecated [Package] DOM ready /packages/dom-ready [Package] DOM /packages/dom [Package] Edit Post /packages/edit-post [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] HTML entities /packages/html-entities [Package] i18n /packages/i18n [Package] Image Cropper Related to packages/image-cropper [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] Rich text /packages/rich-text [Package] Server Side Render /packages/server-side-render [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] Widget Dashboard /packages/widget-dashboard [Package] Widget primitives /packages/widget-primitives [Package] Word count /packages/wordcount Require PR update Forces open PRs to update from trunk [Tool] Env /packages/env [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.

4 participants