From d6250a058af971dd697036acd6e05f7740e8e210 Mon Sep 17 00:00:00 2001 From: garrytan Date: Wed, 7 Oct 2026 02:06:50 +0000 Subject: [PATCH] test(sweep): the fake single-case command is a Bun script, so it runs on Windows The Windows free lane runs test/ship-measure-sweep.test.ts; CreateProcess cannot exec a shebang shell stub, so every fake trial errored and the cap stopped the sweep after one trial. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/ship-measure-sweep.test.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/ship-measure-sweep.test.ts b/test/ship-measure-sweep.test.ts index d7b03f36c..256c0a6c0 100644 --- a/test/ship-measure-sweep.test.ts +++ b/test/ship-measure-sweep.test.ts @@ -181,9 +181,11 @@ describe('ship-measure sweep CLI ($0)', () => { test('a fake single-case command runs the whole sweep end to end at $0', () => { const cwd = tmp('sweep-cli-fake-'); - const script = path.join(cwd, 'fake-trial.sh'); - fs.writeFileSync(script, '#!/usr/bin/env bash\necho "cost_usd: 0"\nif [ "$GSTACK_SHIP_MEASURE_TRIAL" = 3 ]; then echo "failure_cause: assertion"; exit 1; fi\necho "PASS $1"\n', { mode: 0o755 }); - const r = cli(cwd, '--history-dir', historyDir(), '--k', '1', '--cap-usd', '1', '--command', `${script} {case}`, '--jobs', '5', '--out', path.join(cwd, 'out')); + // A Bun script, not a shell stub, so the fake runner also executes on Windows. + const script = path.join(cwd, 'fake-trial.ts'); + fs.writeFileSync(script, 'console.log("cost_usd: 0");\nif (process.env.GSTACK_SHIP_MEASURE_TRIAL === "3") { console.log("failure_cause: assertion"); process.exit(1); }\nconsole.log(`PASS ${process.argv[2]}`);\n'); + const bun = /\s/.test(process.execPath) ? 'bun' : process.execPath; + const r = cli(cwd, '--history-dir', historyDir(), '--k', '1', '--cap-usd', '1', '--command', `${bun} ${script} {case}`, '--jobs', '5', '--out', path.join(cwd, 'out')); expect(r.status).toBe(0); expect(r.stdout).toContain(`DIAGNOSTIC ${A} baseline: observed 9/10 trials (baseline); MEETS`); expect(r.stdout).toMatch(new RegExp(`\\| 1 \\| ${A} \\| rule \\| [^|]+ \\| 9/10 \\| MEETS \\|`));