Commit a84cc9d
test(node-integration-tests): Surface early scenario exit instead of hanging (#22136)
When a scenario process exits before delivering the envelopes a test
expects — e.g. it throws before sending its transaction, and the
unhandled rejection exits the process with no envelope — the runner kept
waiting until the vitest per-test timeout fired, reporting an opaque
`Test timed out in Nms` with **no child output**. The runner's own 120s
diagnostic dump never ran because the vitest timeout always beat it.
This is why so many Docker/DB integration flakes surface as an
uninformative timeout that only passes on retry.
Now the runner completes the moment the child closes early, with an
error carrying the exit code/signal and how many envelopes arrived vs.
were expected (plus a tail of the child's output in node-core, which has
no separate log dump). Opaque multi-second timeouts become fast,
diagnosable failures across every child-process integration suite.
It only fires for envelope-expecting tests that haven't completed: the
success path has already called `complete()` (so this is a no-op),
server-style (`makeRequest`) tests are killed by `complete()` first, and
`ensureNoErrorOutput` / no-envelope tests are unaffected.
_Verified locally_: a scenario that throws before sending an envelope
now fails in ~0.5s with `Scenario exited (code 1) after 0/1 expected
envelope(s), before the test completed.` instead of hanging; normal
envelope-then-exit suites (cron), server-style suites
(httpIntegration-streamed), and the ANR suite (incl. `should exit`,
which expects no envelopes) all still pass.
This does not by itself fix a specific flaky test — it makes the next
occurrence diagnosable. In particular it unblocks root-causing the cron
timeouts (#22112, #21891), whose real cause is currently hidden behind
the opaque timeout.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 88e3b32 commit a84cc9d
1 file changed
Lines changed: 20 additions & 1 deletion
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
| 483 | + | |
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
488 | 507 | | |
489 | 508 | | |
490 | 509 | | |
| |||
0 commit comments