Skip to content

fix(test): delayed process.exit(0) in 8 test files silently truncates full bun-test runs#2252

Open
whd4 wants to merge 2 commits into
garrytan:mainfrom
whd4:fix/full-suite-exit-bombs
Open

fix(test): delayed process.exit(0) in 8 test files silently truncates full bun-test runs#2252
whd4 wants to merge 2 commits into
garrytan:mainfrom
whd4:fix/full-suite-exit-bombs

Conversation

@whd4

@whd4 whd4 commented Jul 13, 2026

Copy link
Copy Markdown

The bug

Eight test files end afterAll with setTimeout(() => process.exit(0), 500):
snapshot, commands, batch, handoff, compare-board, content-security, security-live-playwright, and design/feedback-roundtrip.

In a full bun test run, that timer fires ~500ms into the next file and kills the runner with exit code 0 and no failure tally. A full-suite run therefore only ever executes the files before the first exit, and still reports success. Sharded per-file CI (like this repo's) structurally never sees it — but anyone running bun test across the whole suite gets silently truncated green results.

The fix (2 commits)

  • fix(test): un-leak GSTACK_HOME across files, file-scoped process.exit guard + idle-timer stop, closeTab zero-tab invariant, align config tests to DEFAULTS contract — cross-file test-env hygiene so files no longer poison each other.
  • fix(test): remove delayed process.exit(0) time bombs from 8 browser test files + exitFn seam in ServerConfig — deletes the bombs and adds an exitFn injection seam so tests can assert exit behavior without killing the runner.

Honest caveat

After this fix, a full run no longer truncates — which reveals pre-existing failures that were always being skipped (in our environment 200+, mostly browser goto timeouts under heavy load, plus some real breaks such as session.clearLoadedHtml is not a function in design tests). This PR does not claim to make the suite green; it makes the runner honest so failures are visible and fixable.

🤖 Generated with Claude Code

whd4 and others added 2 commits July 13, 2026 03:26
… guard + idle-timer stop, closeTab zero-tab invariant, align config tests to DEFAULTS contract

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…est files + exitFn seam in ServerConfig

Each afterAll scheduled setTimeout(() => process.exit(0), 500) which fired
~500ms into the NEXT test file during full-suite runs, killing bun with a
green exit code and no tally — silently truncating the suite and hiding
every failure in later files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Jul 13, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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