From 0ef4ff80cb54fc778561baed9332471c0c01c3f6 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Wed, 13 May 2026 11:23:02 -0700 Subject: [PATCH] test: raise timeouts for slow integration tests Two test files were timing out at the default 5s on developer machines, both pre-existing on origin/main but unrelated to this branch's bug fixes: - test/gstack-artifacts-init.test.ts: 13 tests spawning real subprocesses via fake gh/glab/git shims in PATH. bun's fork+exec overhead pushed these past 5s consistently. Added a local test-wrapper that aliases test() with a 30s timeout (matches the brain-sync.test.ts pattern already in the repo). - test/gstack-next-version.test.ts: one integration smoke test that spawns 'bun run ./bin/gstack-next-version' and parses the resulting JSON. The subprocess does a 'gh pr list' against the live GitHub API to enumerate claimed version slots. Network latency makes 5s tight; raised this single test to 30s. No production code changed. The tests already passed deterministically once given enough wall-clock time. --- test/gstack-artifacts-init.test.ts | 8 +++++++- test/gstack-next-version.test.ts | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/gstack-artifacts-init.test.ts b/test/gstack-artifacts-init.test.ts index 2ce1810f5..7374fecd0 100644 --- a/test/gstack-artifacts-init.test.ts +++ b/test/gstack-artifacts-init.test.ts @@ -11,12 +11,18 @@ * auto-executes (no MCP probe). Per Finding #10: stored URL is HTTPS. */ -import { describe, test, expect, beforeEach, afterEach } from 'bun:test'; +import { describe, test as _test, expect, beforeEach, afterEach } from 'bun:test'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import { spawnSync } from 'child_process'; +// Integration tests spawn real git/gh/glab subprocesses. The default 5s +// per-test timeout is tight on developer machines; raise to 30s to match +// the brain-sync.test.ts pattern. The tests stay deterministic (fake bins, +// no network), but subprocess fork+exec under bun adds non-trivial overhead. +const test = (name: string, fn: any) => _test(name, fn, 30000); + const ROOT = path.resolve(import.meta.dir, '..'); const INIT_BIN = path.join(ROOT, 'bin', 'gstack-artifacts-init'); diff --git a/test/gstack-next-version.test.ts b/test/gstack-next-version.test.ts index 9d749f25f..200b84d9a 100644 --- a/test/gstack-next-version.test.ts +++ b/test/gstack-next-version.test.ts @@ -153,6 +153,9 @@ describe("markActiveSiblings", () => { // Integration smoke — only runs if gh is available and authenticated. Confirms // the CLI executes end-to-end against real APIs without crashing. describe("integration (smoke)", () => { + // Bumps timeout to 30s — the test spawns a real `bun run` subprocess that + // does a `gh pr list` against the live GitHub API to inspect claimed slots. + // Network latency makes 5s tight on developer machines. test("CLI runs against real repo and emits parseable JSON", async () => { const proc = Bun.spawnSync([ "bun", @@ -178,5 +181,5 @@ describe("integration (smoke)", () => { expect(Array.isArray(parsed.claimed)).toBe(true); expect(parsed).toHaveProperty("siblings"); expect(parsed.siblings).toEqual([]); // --workspace-root null disabled scanning - }); + }, 30000); });