Repository navigation
[RFC] Run the jsdom unit tests on warpdom (about 1.85x faster on CI, same results) #49502
Description
What's the problem?
The node-scope unit tests (pnpm test:node) spend a large share of their time in jsdom. On a GitHub-hosted Ubuntu runner with 2 workers, mui-material, mui-system, mui-utils and mui-lab take about 4.5 minutes per run.
I maintain warpdom, a DOM implementation for unit and component tests, written from the WHATWG specifications with the goal that every test gets the same result as on jsdom, only faster. It plugs into Vitest as an environment. I measured MUI's node-scope tests with it on your current master and wanted to share the numbers, in case they are useful. I've also opened a small draft PR, #49503, so you can see the change and CI on it.
What are the requirements?
- Every test keeps its result.
- A small, easily reverted change: no test edits.
- Node projects and browser-mode tests are unaffected.
What are our options?
- Keep jsdom.
- Switch the projects that use jsdom to warpdom (the draft PR, [code-infra] Replace jsdom with warpdom in the unit tests #49503).
- Optionally, later: warpdom's fast mode (below), a bigger change.
Proposed solution
Option 2. Measured on master (f3fb528, 2026-10-14), Vitest 5.0.0, jsdom 30.1.2:
| Where | Scope | jsdom | warpdom | Speedup | Tests with a different result |
|---|---|---|---|---|---|
| GitHub-hosted Ubuntu runner, 2 workers, 5 rounds | mui-material, mui-system, mui-utils, mui-lab (6,776 tests) |
267.3 s | 144.3 s | 1.85x (95% CI 1.83-1.87x) | 0, in every round |
Laptop (Apple M4 Pro, 14 cores), npx warpdom compare --rounds 3 |
TEST_SCOPE=node, all 21 projects (6,979 jsdom tests compared) |
38.7 s | 22.5 s | 1.72x (rounds 1.71-1.78x) | 0 |
Times are Vitest's reported duration; jsdom and warpdom alternate round by round. On the runner that is about two minutes less per run, most of it in mui-material (207.6 s to 112.3 s). In the laptop run, the 6 projects on Node (833 tests) run unchanged in both runs and are included in the times.
The change itself (the draft PR) is two dev dependencies, warpdom and vitest-environment-warpdom, in place of jsdom, and environment: jsdom ? 'warpdom' : 'node' in vitest.shared.mts. With it, pnpm test:node run on the same commit gives the same 6,917 passed and 895 skipped tests as on jsdom, with no test changing status.
A possible second step, not in the PR: warpdom's optional fast mode for Vitest 3.2+ (warpdom vitest run) runs files without isolation, resets the window between them, and keeps any file that leaks state isolated. In a separate 5-round run on the same kind of runner, on the same four packages, it took 38.9 s against 273.2 s for jsdom's default: 6.99x (95% CI 6.97-7.08x), again with no test changing.
Reproduce it in a checkout of master, after pnpm install:
TZ=UTC TEST_SCOPE=node npx warpdom compare --rounds 3(the environment of pnpm test). It runs your suite on jsdom and on warpdom, alternating, and writes .warpdom-compare/report.md with every test whose status changes and the speedup with its spread. It changes no files: it uses a temporary wrapper config and removes it afterwards. Only projects on jsdom switch; Node projects run unchanged, and browser-mode projects are left out.
Caveats, honestly:
- warpdom is new (0.1.3; the numbers above were measured with 0.1.1, whose DOM is the same) and pre-1.0. It is tested against 23 open-source suites and the Web Platform Tests, but it has far less mileage than jsdom.
- It differs from jsdom deliberately in a few places, listed in the README under Differences from jsdom. None of them changed an MUI test.
- Like jsdom it has no layout (sizes are 0), and it does not implement
XMLHttpRequest. Your browser-mode tests are unaffected. - The PR removes the direct
jsdomdev dependency. Going back means adding it again and changing one line invitest.shared.mts.
Would you be interested in trying it? I'm happy to adjust the PR or answer questions, and equally happy to close both if it's not a fit.
Resources and benchmarks
- Draft PR: [code-infra] Replace jsdom with warpdom in the unit tests #49503
- warpdom: https://github.com/sonukapoor/warpdom (README "Setup" and "Check your suite first:
warpdom compare")
Activity
Janpot commentedon Oct 23, 2026
We're considering dropping JSDOM altogether and relying uniquely on real browser testing. As
warpdomis two weeks old and mostly AI generated. I don't see us replace JSDOM with it any time soon. Putting on hold for now, let's see once the library matures.