feat: extract shared DOM/testing core to @pokujs/dom + benchmark suite#14
Merged
feat: extract shared DOM/testing core to @pokujs/dom + benchmark suite#14
Conversation
…uite with teardown-skew fix - Move shared infrastructure (screen proxy, metrics emitter, getNow, DOM env\n setup, plugin internals) to @pokujs/dom dependency\n- All src/ modules now re-export from @pokujs/dom; react-specific logic retained\n- Add @pokujs/dom ^0.1.0 as a runtime dependency\n- Add full benchmark suite (Poku vs Jest vs Vitest, happy-dom & jsdom)\n- Fix benchmark happy-dom timing: parse Poku reported Duration from stdout\n to exclude Happy DOM async-teardown overhead from wall-clock measurements\n- benchmark/results.json and benchmark/REPORT.md included with latest results
Deno with isolation:none loads all test files in the same npm:poku process. In that context bare specifiers like @pokujs/dom are not resolved from node_modules automatically. Adding an explicit import map entry pointing to npm:@pokujs/dom fixes resolution for all test files that transitively import @pokujs/dom.
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.
Summary
This PR extracts the shared DOM and testing infrastructure from
@pokujs/reactinto the new@pokujs/dompackage, and introduces a full benchmark suite comparing Poku against Jest and Vitest.Changes
Source — extract to
@pokujs/domAll modules that were duplicated across
@pokujs/reactand the upcoming@pokujs/vuehave been moved to@pokujs/dom:src/plugin-setup.tsexport { setupInProcessEnvironment } from '@pokujs/dom'src/plugin-metrics.ts@pokujs/domsrc/plugin-command.ts@pokujs/domsrc/plugin-types.ts@pokujs/domsrc/plugin.ts@pokujs/domsrc/dom-setup-happy.ts@pokujs/domsrc/dom-setup-jsdom.ts@pokujs/domsrc/runtime-options.ts@pokujs/domsrc/react-testing.tsgetNow, metrics state, screen proxy inlinecreateRenderMetricsEmitter,createScreen,getNowfrom@pokujs/domNet: −815 lines / +111 lines in
src/.Dependency
"dependencies": { + "@pokujs/dom": "^0.1.0", "@testing-library/dom": "^10.4.1" }Benchmark suite (
benchmark/)New benchmark comparing five scenarios across 7 runs (trim ±1):
Timing methodology — Happy DOM teardown skew:
When measuring Poku scenarios with
/usr/bin/timewall-clock, Happy DOM'sGlobalRegistrator.register()overwrites Node globals and keeps async task queues open after tests finish, inflating the wall-clock reading by ~3 s while Poku's own suite timer correctly reports ~0.1 s.Fix: parse Poku's reported
Duration › Xmsfrom stdout (ANSI-stripped) for Poku scenarios instead of using the outerperformance.now()wrap. Jest and Vitest scenarios continue using wall-clock timing.Testing
npm run checkpasses (typecheck + all tests)BENCH_RUNS=3and fullBENCH_RUNS=7run