Skip to content

Commit ea8f0cb

Browse files
test(mcp): bump real-binary spawnSync timeout 5s→15s to de-flake coverage run (#42)
The two BUG-MCP-017 tests (--version / --help) spawnSync the real built binary. Under `npm test`'s V8 coverage instrumentation + full-suite parallel load, the child's cold start can exceed the 5s budget → status:null (killed) → flaky FAILURE on the coverage variant only (test:nocov stays green, and the tests pass in isolation). Confirmed env flake, not a code defect. Bumps both spawnSync timeouts to 15000ms via a named BINARY_SPAWN_TIMEOUT_MS const. No assertions or behavior changed — only the timeout budget. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 426c26a commit ea8f0cb

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

test/input-hardening-unit.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ const SERVER_ENTRY = resolve(
3030
"index.js"
3131
);
3232

33+
// Cold-start budget for spawning the real built binary. Under the coverage
34+
// run's V8 instrumentation + full-suite parallel load the child's cold start
35+
// can exceed a tight 5s budget → status:null (killed) → flaky failure on the
36+
// `npm test` (coverage) variant. 15s absorbs that load; the binary still exits
37+
// near-instantly for --version/--help in the common case.
38+
const BINARY_SPAWN_TIMEOUT_MS = 15000;
39+
3340
let server: any;
3441
let handleCLIFlags: (argv: readonly string[]) => boolean;
3542
let isIPOrCIDR: (s: string) => boolean;
@@ -65,7 +72,7 @@ describe("BUG-MCP-017: real-binary short-circuit", () => {
6572
const r = spawnSync(process.execPath, [SERVER_ENTRY, "--version"], {
6673
env: { ...process.env, INSTANODE_MCP_NO_LISTEN: "" },
6774
encoding: "utf8",
68-
timeout: 5000,
75+
timeout: BINARY_SPAWN_TIMEOUT_MS,
6976
});
7077
assert.equal(r.status, 0, `non-zero exit: stderr=${r.stderr}`);
7178
assert.match(r.stdout, /\d+\.\d+\.\d+|dev/);
@@ -74,7 +81,7 @@ describe("BUG-MCP-017: real-binary short-circuit", () => {
7481
const r = spawnSync(process.execPath, [SERVER_ENTRY, "--help"], {
7582
env: { ...process.env, INSTANODE_MCP_NO_LISTEN: "" },
7683
encoding: "utf8",
77-
timeout: 5000,
84+
timeout: BINARY_SPAWN_TIMEOUT_MS,
7885
});
7986
assert.equal(r.status, 0, `non-zero exit: stderr=${r.stderr}`);
8087
assert.match(r.stdout, /instanode-mcp/);

0 commit comments

Comments
 (0)