feat: add spawnTest harness global#54
Conversation
9adf4db to
2795471
Compare
legendecas
left a comment
There was a problem hiding this comment.
I think spawn is highly coupled with a specific runtime, like CLI options. Could this be a more generic helper?
2795471 to
6d80b42
Compare
@kraenhansen Agreed that emnapi/WASM and React Native may not support spawning. I don't think we can fully refactor it away, though: test_exception needs to observe a process actually terminating on an uncaught exception, and test_finalizer is about at-exit behavior — both inherently whole-process. So a capability flag seems more realistic than refactoring: implementors that can't spawn expose spawnTest as unavailable, and tests that need it call skipTest() — per-test and explicit, rather than a blanket skip flag. Happy to spec that out if that direction sounds right. |
@legendecas Good catch — nodeFlags was the runtime coupling. After making --expose-gc a baseline (the harness's own gc.js requires it) it had no internal caller anyway, so I've dropped it in |
# Conflicts: # eslint.config.js # implementors/node/tests.ts
Replace the POSIX-specific signal field with an aborted boolean computed by the Node implementor, moving the abort exit-code knowledge out of portable tests and into child_process.js.
|
@legendecas I've made the test-facing contract runtime-agnostic:
So a test only asks "did it exit cleanly / abort?" and every Node-specific detail stays inside the Node implementor. PTAL 🙏 |
A bare 'file://' + path is malformed on Windows (file://C:\...). Also surface aborts in the failure reason regardless of exit code.
|
What's the expected implementation of I think we should add a capability flag already now and have that harness spawn test skipped on that as well. |
Reused the existing |
There was a problem hiding this comment.
I'm a bit concerned that this buffered stdout would lead to nothing being printed for hanging tests.
There was a problem hiding this comment.
the runner now passes stdout: 'inherit' to spawnTest, so the child's stdout streams straight to the terminal as it runs (visible for slow/hanging tests) instead of being buffered until exit. stderr is still captured to attach to the failure message.
spawnTest keeps 'pipe' as the default, since test callers assert on the returned stdout — the runner is the one consumer that opts into streaming.

This will be used in test_exception and test_finalizer