Skip to content

Commit 77eeb81

Browse files
committed
fix(test): budget ocx provider CLI spawns for Windows CI
Cold Bun starts of `provider --help` exceeded the 5s default on contended windows-latest (status null). Use SPAWN_BUDGET_MS for the suite and give spawnSync a matching deadline.
1 parent 2d7c7be commit 77eeb81

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tests/cli-provider.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
import { describe, expect, test } from "bun:test";
1+
import { describe, expect, setDefaultTimeout, test } from "bun:test";
22
import { spawnSync } from "node:child_process";
33
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
44
import { tmpdir } from "node:os";
55
import { dirname, join } from "node:path";
66
import { fileURLToPath } from "node:url";
7+
import { SPAWN_BUDGET_MS } from "./helpers/test-budget";
78

89
const repoRoot = dirname(fileURLToPath(new URL("../package.json", import.meta.url)));
910
const cliPath = join(repoRoot, "src", "cli", "index.ts");
1011
const isolatedCodexHome = mkdtempSync(join(tmpdir(), "ocx-prov-codex-home-"));
1112

13+
// Every case below spawns the real CLI. Cold Bun starts on a loaded windows-latest runner
14+
// routinely blow the 5s default before --help returns; the spawn IS the assertion.
15+
setDefaultTimeout(SPAWN_BUDGET_MS);
16+
1217
function runCli(args: string[], env: Record<string, string> = {}) {
1318
return spawnSync(process.execPath, [cliPath, ...args], {
1419
cwd: repoRoot,
@@ -17,6 +22,9 @@ function runCli(args: string[], env: Record<string, string> = {}) {
1722
// a test run would WIPE the user's routed catalog entries (live-catalog pollution).
1823
env: { ...process.env, CODEX_HOME: isolatedCodexHome, ...env },
1924
encoding: "utf8",
25+
// Contended windows-latest cold starts regularly exceed Bun's 5s default before --help
26+
// even prints; keep the child deadline under the test budget so status is not null.
27+
timeout: SPAWN_BUDGET_MS - 5_000,
2028
});
2129
}
2230

0 commit comments

Comments
 (0)