Skip to content

Fix flaky test by awaiting stream handlers in sh()#4

Merged
johncarmack1984 merged 3 commits into
mainfrom
fix-flaky-stream-handler-test
Jan 16, 2026
Merged

Fix flaky test by awaiting stream handlers in sh()#4
johncarmack1984 merged 3 commits into
mainfrom
fix-flaky-stream-handler-test

Conversation

@johncarmack1984
Copy link
Copy Markdown
Collaborator

Summary

  • Use all() instead of spawn() in the sh() function to ensure stdout/stderr handlers complete before returning
  • This prevents log message ordering races between consecutive commands that caused flaky test failures

Test plan

  • Ran the previously flaky test (complex.test.ts) 5 times consecutively with no failures
  • Full test suite passes (160 tests)

Use all() instead of spawn() to ensure stdout/stderr handlers
complete before returning. This prevents log message ordering
races between consecutive commands.
Run stderr handler, stdout handler, and expect() concurrently with
all(), ensuring all output is captured before returning. This fixes
the race condition where log messages could interleave between
consecutive commands.
@johncarmack1984 johncarmack1984 force-pushed the fix-flaky-stream-handler-test branch from cda9697 to fc80c83 Compare January 16, 2026 20:04
@johncarmack1984 johncarmack1984 merged commit 239e425 into main Jan 16, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant