Enable HotTestCases on Deno - #21524
Conversation
Deno's HTTP request socket has no setNoDelay; calling it unconditionally crashed the lazy-compilation backend. It's only a latency optimization, so skip it when absent (mirrors the adjacent timer.unref guard).
- Force-close lazy-compilation backend connections on dispose so compiler.close doesn't hang on Deno (its HTTP server doesn't emit "connection"). - Bind the original postMessage in the fake worker bootstrap (Deno aliases parentPort.postMessage to the global self.postMessage, causing recursion). - Skip ESM-output hot cases where vm.SourceTextModule is unavailable (Deno). - Skip lazy-compilation https/wasm cases on Deno (HTTPS + WebAssembly interop). - Stop ignoring test/HotTestCases in the Deno test run.
🦋 Changeset detectedLatest commit: 0941699 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR SummaryLow Risk Overview Lazy-compilation SSE backend ( Node read-file wasm loaders ( Test worker shim ( Patch notes are recorded in the changeset. Reviewed by Cursor Bugbot for commit 0941699. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
This PR is packaged and the instant preview is available (4efcd73). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@4efcd73
yarn add -D webpack@https://pkg.pr.new/webpack@4efcd73
pnpm add -D webpack@https://pkg.pr.new/webpack@4efcd73 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21524 +/- ##
=======================================
Coverage 93.79% 93.79%
=======================================
Files 620 620
Lines 73798 73799 +1
Branches 21306 21308 +2
=======================================
+ Hits 69220 69221 +1
Misses 4578 4578
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Return a real ArrayBuffer from the Node async/sync wasm loader so WebAssembly.instantiate accepts it (Deno rejects a Node Buffer view as "not a buffer source"); also fixes real Deno users of async-node wasm. - Drop the vm.SourceTextModule ESM skip: Node (with the flag), Bun and Deno all expose it, so the guard was dead code on every CI runtime. - Un-skip lazy-compilation wasm and https on Deno; the wasm loader fix and the earlier setNoDelay guard cover the failures those skips masked.
Merging this PR will regress 2 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | benchmark "asset-modules-resource", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
843.3 KB | 1,204.2 KB | -29.97% |
| ❌ | Memory | benchmark "cache-filesystem", scenario '{"name":"mode-production","mode":"production"}' |
3.8 MB | 4.9 MB | -22.12% |
| ⚡ | Memory | benchmark "wasm-modules-async", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
814.3 KB | 192.7 KB | ×4.2 |
| ⚡ | Memory | benchmark "css-modules", scenario '{"name":"mode-production","mode":"production"}' |
13.5 MB | 10.1 MB | +32.96% |
| ⚡ | Memory | benchmark "devtool-eval", scenario '{"name":"mode-production","mode":"production"}' |
14.2 MB | 11.5 MB | +23.98% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/hot-testcases-on-deno (0941699) with main (2f18ee0)
|
The It crashed during the unit-test files ( Generated by Claude Code |
Summary
The
HotTestCasessuites were entirely skipped under Deno (test:deno) because the run crashed and hung. This enables them. It fixes two real Deno-compat issues and skips the few cases that depend on capabilities Deno doesn't provide:lib/hmr/lazyCompilationBackend.js: force-close connections on dispose (server.closeAllConnections()+ destroy sockets beforeserver.close) socompiler.close()doesn't hang on Deno, whose HTTP server doesn't emit"connection"; also guardreq.socket.setNoDelay(absent on Deno).test/helpers/createFakeWorker.js: bind the originalpostMessagebefore overridingself.postMessage— Deno aliasesparentPort.postMessageto the globalself.postMessage, so the override recursed infinitely.test/HotTestCases.template.js: skip ESM-output cases wherevm.SourceTextModuleis unavailable (Deno'snode:vm); no-op where it exists (Node).lazy-compilation/httpsandlazy-compilation/wasmcases on Deno (HTTPS + WebAssembly interop limitations), matching their existing per-runtime gates.All five HotTestCases suites now pass on Deno locally (Node/Web/WebWorker/AsyncNode/Universal).
What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes — this re-enables the existing
HotTestCasessuites under Deno; the lazy-compilation backend fixes are exercised by the now-enabled lazy-compilation hot cases.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Yes — Claude Code was used to reproduce the Deno failures, identify the root causes, and implement the fixes; all changes were reviewed and verified locally on Node, Bun, and Deno.
Generated by Claude Code