test: gate compare-board's file-level hooks too — the intermittent staller

Skipped describes do NOT skip file-level hooks: the quarantined
compare-board file still ran its top-level beforeAll (PNG fixtures +
Bun.serve + a BrowserManager launch — exactly the 'needs a
display-shaped env' code) on every run, and under parallel load that
setup wedges. Caught red-handed by the runner's in-flight-at-kill
epilogue: '⏱ in flight at kill: browse/test/compare-board.test.ts'.
This was the suite's intermittent staller. Hooks now honor the same
GSTACK_COMPARE_BOARD_TESTS gate; the gated file drops from 3.7s of live
setup to 0.4s of pure skips.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan 2026-08-15 15:30:11 -07:00
parent e99e53cc71
commit d3e52d4c92
No known key found for this signature in database
GPG Key ID: C1F69E85C74EFE1D
1 changed files with 6 additions and 0 deletions

View File

@ -49,6 +49,11 @@ function createTestPng(filePath: string): void {
}
beforeAll(async () => {
// Skipped describes do NOT skip file-level hooks: this setup (Bun.serve +
// BrowserManager launch) still ran with all 16 tests skipped, and under
// parallel load it wedges — caught by the runner's in-flight-at-kill
// epilogue as the suite's intermittent staller. Gate the hooks too.
if (!COMPARE_BOARD_ENABLED) return;
// Create test PNG files
tmpDir = '/tmp/compare-board-test-' + Date.now();
fs.mkdirSync(tmpDir, { recursive: true });
@ -80,6 +85,7 @@ beforeAll(async () => {
});
afterAll(async () => {
if (!COMPARE_BOARD_ENABLED) return;
try { server.stop(); } catch {}
fs.rmSync(tmpDir, { recursive: true, force: true });
// Close only this file's own browser — never process.exit(): bun test runs