FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: add worker option to spawnTest by bavulapati · Pull Request #67 · nodejs/node-api-cts · GitHub

feat: add worker option to spawnTest - #67

Open
bavulapati wants to merge 2 commits into
nodejs:mainfrom
bavulapati:feat/spawn-test-worker
Open

feat: add worker option to spawnTest#67
bavulapati wants to merge 2 commits into
nodejs:mainfrom
bavulapati:feat/spawn-test-worker

Conversation

bavulapati commented Jul 31, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Adds spawnTest(file, { worker: true }), which runs the test file on a worker thread of the spawned child, plus a runtimeFeatures.worker flag to gate on. First consumer is the worker half of test_instance_data (#66).

Why an option on spawnTest rather than an in-process runInWorker: a native printf from an addon writes to fd 1 directly, bypassing a worker's piped JS-level stdout, so observing a secondary environment's native output means capturing the host process's stdout. Upstream wraps its worker in a child process for the same reason.

runtimeFeatures.worker is declared separately from spawn because the two are independent - a browser has workers but no subprocesses.

The worker inherits the child's execArgv, so harness globals reach it. Leaving the Worker without an error handler is deliberate: an unhandled worker error re-throws on the host thread, so a failing test file still exits non-zero with its stack on stderr. tests/harness/spawn-test-worker.js pins that, plus cwd.

bavulapati force-pushed the feat/spawn-test-worker branch from 6d5aa66 to dd9a852 Compare July 31, 2026 11:06
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

Labels

None yet

Projects

Status: Need Triage

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL