Title: Test runner with isolation=none does not work in child process · Issue #60020 · nodejs/node · GitHub
Open Graph Title: Test runner with isolation=none does not work in child process · Issue #60020 · nodejs/node
X Title: Test runner with isolation=none does not work in child process · Issue #60020 · nodejs/node
Description: Version v24.9.0 Platform Linux home 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the bug? runner.js import cluster from 'node:cluster'; impo...
Open Graph Description: Version v24.9.0 Platform Linux home 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the bug? runner.js ...
X Description: Version v24.9.0 Platform Linux home 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the bug? runner.js ...
Opengraph URL: https://github.com/nodejs/node/issues/60020
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Test runner with isolation=none does not work in child process","articleBody":"### Version\n\nv24.9.0\n\n### Platform\n\n```text\nLinux home 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\nrunner.js\n\n```js\nimport cluster from 'node:cluster';\nimport { run } from \"node:test\";\n\nif (cluster.isPrimary) {\n cluster.fork();\n} else {\n const stream = run({\n isolation: \"none\",\n });\n\n stream.on(\"data\", (data) => {\n console.log(\"on data\", data.type);\n });\n\n stream.on(\"end\", () => {\n console.log(\"on end\")\n process.exit(0);\n });\n\n stream.on(\"error\", (err) => {\n console.log(\"on error\", err);\n });\n}\n```\n\ndummy.test.js\n\n```js\nimport { describe, it } from \"node:test\";\nimport * as assert from \"node:assert\";\n\ndescribe(\"suite\", () => {\n it(\"works\", () => {\n assert.ok(true);\n });\n});\n\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways. No.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nWith `isolation: \"process\"` (the default), here's the output:\n\n```\non data test:enqueue\non data test:dequeue\non data test:enqueue\non data test:dequeue\non data test:enqueue\non data test:dequeue\non data test:complete\non data test:start\non data test:start\non data test:pass\non data test:complete\non data test:plan\non data test:pass\non data test:summary\non data test:complete\non data test:plan\non data test:diagnostic\non data test:diagnostic\non data test:diagnostic\non data test:diagnostic\non data test:diagnostic\non data test:diagnostic\non data test:diagnostic\non data test:diagnostic\non data test:summary\non end\n\nProcess finished with exit code 0\n```\n\nThe process cleanly exits at the end of the tests.\n\n### What do you see instead?\n\nWith `isolation: \"none\"`, here's the output:\n\n```\non data test:enqueue\non data test:dequeue\non data test:enqueue\non data test:dequeue\non data test:complete\non data test:start\non data test:start\non data test:pass\non data test:complete\non data test:plan\non data test:pass\n```\n\nAnd the process hangs.\n\n### Additional information\n\nThe goal was to use the \"cluster\" module to run the tests in parallel with the `shard` option:\n\n```js\nimport { run } from \"node:test\";\nimport { spec } from \"node:test/reporters\";\nimport { PassThrough } from \"node:stream\";\nimport { availableParallelism } from \"node:os\";\nimport cluster from 'node:cluster';\n\nconst concurrency = availableParallelism();\nlet completed = 0;\n\nif (cluster.isPrimary) {\n const mergedStream = new PassThrough({\n objectMode: true\n });\n\n cluster.on(\"message\", (_worker, message) => {\n mergedStream.emit(\"data\", message);\n });\n\n mergedStream\n .compose(spec)\n .pipe(process.stdout);\n\n for (let i = 1; i \u003c= concurrency; i++) {\n cluster.fork({\n SHARD_INDEX: i,\n SHARD_TOTAL: concurrency,\n });\n }\n\n cluster.on(\"exit\", (worker, code, signal) => {\n if (++completed === concurrency) {\n mergedStream.end();\n }\n });\n} else {\n const stream = run({\n isolation: \"none\",\n shard: {\n index: parseInt(process.env.SHARD_INDEX, 10),\n total: parseInt(process.env.SHARD_TOTAL, 10),\n },\n });\n\n stream.on(\"data\", (chunk) => {\n process.send(chunk);\n });\n}\n```\n\n\nRelated: https://github.com/nodejs/node/issues/55939","author":{"url":"https://github.com/darrachequesne","@type":"Person","name":"darrachequesne"},"datePublished":"2025-09-26T06:09:43Z","url":"https://github.com/nodejs/node/issues/60020"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2d7a37e1-6dff-80fc-07f6-d2b76befbddc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9FC:36D84F:852706:B178B4:6AED2ACE |
| html-safe-nonce | 054146d97769db761587d63ac45ccd66941debec0f70cade7a6fff0461c2429c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUZDOjM2RDg0Rjo4NTI3MDY6QjE3OEI0OjZBRUQyQUNFIiwidmlzaXRvcl9pZCI6IjQzMDgzNDMxMTQ0NDM4NjA2ODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 848b3191175ec06fcf4ed3c22890fa6a1c17c656279742aa8d40b13561a3084e |
| hovercard-subject-tag | issue:3455924674 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/60020/issue_layout |
| twitter:image | https://opengraph.githubassets.com/80fe571d688158b7d5be73547f716b751902bf35476649fe41a80ba8bccdddbe/nodejs/node/issues/60020 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/80fe571d688158b7d5be73547f716b751902bf35476649fe41a80ba8bccdddbe/nodejs/node/issues/60020 |
| og:image:alt | Version v24.9.0 Platform Linux home 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the bug? runner.js ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | darrachequesne |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9d95365dda0576efe9b71f45807595e396bd0ca9286fba5367a05048e6ddf8f2 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 98b41fa4b5635ceb45a4c54320fced73817ff290 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width