test(node-integration-tests): Surface early scenario exit instead of hanging#22136
Open
mydea wants to merge 2 commits into
Open
test(node-integration-tests): Surface early scenario exit instead of hanging#22136mydea wants to merge 2 commits into
mydea wants to merge 2 commits into
Conversation
…hanging When a scenario process exits before delivering the envelopes a test expects (e.g. it throws before sending its transaction — an unhandled rejection exits the process with no envelope), the runner previously 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 diagnostic dump never ran because the vitest timeout always beat it. Complete the test 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). This turns opaque multi-second timeouts into fast, diagnosable failures across every Docker/child-process integration suite. Only fires for envelope-expecting tests that have not completed: the success path has already called `complete()` (so it is a no-op), server-style tests are killed by `complete()` first, and `ensureNoErrorOutput`/no-envelope tests are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
andreiborza
approved these changes
Jul 9, 2026
andreiborza
left a comment
Member
There was a problem hiding this comment.
This sounds super useful beyond just speeding failures up, nice!
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 Nmswith 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 bycomplete()first, andensureNoErrorOutput/ 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