Repository navigation
test: run unit tests on warpdom instead of jsdom - #1700
Open
sonukapoor wants to merge 1 commit into
Open
sonukapoor wants to merge 1 commit into
sonukapoor wants to merge 1 commit into
Conversation
Set testEnvironment to warpdom in the unit and build test configs and add warpdom and jest-environment-warpdom as dev dependencies. All 1,110 unit and 8 build tests keep their result, with 100% coverage.
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.
Pull Request
What
Runs the Jest unit tests (
test:cover) and the build tests (test:build) on warpdom instead of jsdom. warpdom is a DOM implementation for unit tests that I maintain; it is written from the WHATWG specifications with the goal that every test gets the same result as on jsdom, only faster. This is a proposal: happy to adjust it or close it if it is not wanted.Why
The unit tests run about 1.6x faster, with every test keeping its result.
On a GitHub-hosted Ubuntu runner, 2 workers, one warm-up and 5 timed rounds alternating jsdom and warpdom, at
master(2026-10-16):Locally (Apple M4 Pro, Node 22.23,
--maxWorkers=2), on this branch and on its parent commit with jsdom, compared test by test with Jest's--jsonoutput:jest --coverage)other/misc-tests)Coverage stays at 100%; the thresholds pass on both. One local run each, so the local times are indicative only.
How
testEnvironment: 'warpdom'replaces thejsdomenvironment thatkcd-scripts/jestpicks for React projects, and thejsdominother/misc-tests/jest.config.js.jest-environment-warpdomlets Jest find warpdom by that name.Changes
jest.config.js:testEnvironment: 'warpdom'.other/misc-tests/jest.config.js:testEnvironment: 'warpdom'instead of'jsdom'.other/ssr/jest.config.js: the comment says the other tests run with a DOM (warpdom); the SSR test stays on Node.package.json:warpdom(^0.1.3) andjest-environment-warpdom(^0.1.0) as dev dependencies. Both are MIT licensed; their only new dependencies areparse58 and@rgrove/parse-xml5.No test changes. downshift has no direct jsdom dependency to remove: jsdom 20 stays installed through
kcd-scripts, which depends onjest-environment-jsdom29; nothing loads it after this change.To reproduce the comparison on
master, afternpm 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 uses a temporary wrapper config and changes no files. Or check out this branch and runnpm run test:coverandnpm run build-and-test.Caveats:
Checklist
Happy to close this if it's not wanted.