mirror of https://github.com/garrytan/gstack.git
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.
This commit is contained in:
parent
fcbc217fdc
commit
0ef4ff80cb
|
|
@ -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');
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue