Repository navigation
[code-infra] Replace jsdom with warpdom in the unit tests - #49503
Draft
sonukapoor wants to merge 1 commit into
Draft
sonukapoor wants to merge 1 commit into
sonukapoor wants to merge 1 commit into
Conversation
Switch the Vitest environment of the projects that use jsdom to warpdom, a DOM implementation for tests that aims at jsdom's results, and remove the direct jsdom dev dependency, which nothing else imports. Node and browser projects are unchanged.
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
This branch has not been deployed
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.
Proof of concept for #49502; the discussion is there. Opened as a draft.
This replaces jsdom with warpdom, a DOM implementation for tests that aims at jsdom's results, only faster, in the Vitest projects that use jsdom:
package.json,pnpm-lock.yaml: addwarpdom(0.1.3) andvitest-environment-warpdom(0.1.0) as dev dependencies and remove the directjsdomdev dependency, which nothing else imports;vitest.shared.mts:environment: jsdom ? 'warpdom' : 'node'. I kept thejsdomoption name to keep the diff to one line; happy to rename it.Nothing else changes: no test edits, and Node and browser projects are unchanged. jsdom stays in
pnpm-lock.yamlonly as Vitest's optional peer, which pnpm resolves; nothing loads it. No@vitest-environment jsdomcomments in test files needed switching (the one inrating.mdis a docs example).Results
pnpm test:node runwith this change and without it, on master f3fb528 (2026-10-14; local, Apple M4 Pro, Node 22.23.3; one run each on a busy machine, so the times are indicative only):Rebased on today's master (f24a0df), the branch gives 6,918 passed and 895 skipped (master added one test).
On a GitHub-hosted Ubuntu runner with 2 workers (5 rounds,
mui-material,mui-system,mui-utils,mui-lab), the same switch took 267.3 s down to 144.3 s (1.85x, 95% CI 1.83-1.87x), with 0 tests changing in every round; details in #49502.How to reproduce
On
master, afterpnpm install:It runs the suite on jsdom and on warpdom, alternating, and writes
.warpdom-compare/report.mdwith every test whose status changes and the speedup. It changes no files. Or check out this branch and runpnpm test:node run.Caveats
XMLHttpRequest.Happy to close this if it's not wanted.