gstack/design
Stefan Andrei e7c37d76b9 fix(tests): stop browse/design teardowns from killing the whole bun run
Several browse and design test files armed `setTimeout(() => process.exit(0),
500)` inside afterAll as a workaround for a browser close() that can hang. That
assumes each test file runs in its own process. It doesn't: `bun test` runs
EVERY file in one shared process. The 500ms timer therefore fired partway
through a LATER test file and terminated the entire run with exit code 0 and no
summary. Because the exit code was 0, the suite could not gate — only a fraction
of the files ran, and every downstream failure was silently masked.

The fix removes the delayed process.exit from teardown and instead time-boxes
the resource cleanup: browser teardowns race `close()` against a short timeout
and abandon it if it hangs (the child is reaped at real process exit), and the
design daemon /shutdown test stubs `process.exit` around the shutdown timers so
they fire harmlessly. A new static-guard test, test/no-suicide-exit.test.ts,
scans every *.test.ts and fails if any file schedules a delayed process.exit,
so the pattern cannot silently return. test/user-slug-fallback.test.ts is made
deterministic via HOME isolation.

Verified: test/no-suicide-exit.test.ts + test/user-slug-fallback.test.ts pass
(15/15); browse/test/commands.test.ts passes standalone (243/243) and now runs
to a full summary; design/test/daemon.test.ts passes (34/34) with no early exit.

Honest note: with the suite now able to run to completion, it surfaces
pre-existing failures that the early exit had been hiding — e.g.
design/test/feedback-roundtrip.test.ts fails identically on unmodified
origin/main (a `session.clearLoadedHtml` stub gap), independent of this change.
These are not introduced here; this change only makes them visible so they can
be gated on and fixed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 08:16:43 +03:00
..
src v1.45.0.0 feat(design): persistent board daemon — 24h boards, one tab, board history (#1710) 2026-05-25 20:45:12 -07:00
test fix(tests): stop browse/design teardowns from killing the whole bun run 2026-07-04 08:16:43 +03:00
prototype.ts v1.30.0.0 fix wave: 21 community PRs + Windows CI extension + codex flag-semantics smoke (#1391) 2026-05-09 08:06:47 -07:00