* Run detect with a controlled HOME + PATH so the output is deterministic. * We invoke via `bun run ` instead of the shebang so the test doesn't * need bun on its PATH. The script's child-process probes still respect * the controlled PATH.
(env: Partial<NodeJS.ProcessEnv>)
| 39 | * the controlled PATH. |
| 40 | */ |
| 41 | function runDetect(env: Partial<NodeJS.ProcessEnv>): string { |
| 42 | return execFileSync(BUN_BIN, ["run", DETECT_BIN], { |
| 43 | encoding: "utf-8", |
| 44 | timeout: 15_000, |
| 45 | stdio: ["ignore", "pipe", "pipe"], |
| 46 | // GBRAIN_HOME pinned empty: detect honors it (codex D11), and sibling |
| 47 | // test files in the same shard set it ambiently — without the pin, the |
| 48 | // spawned detect reads the polluter's (or the developer's real) config. |
| 49 | env: { ...process.env, GBRAIN_HOME: "", ...env }, |
| 50 | }); |
| 51 | } |
| 52 | |
| 53 | /** Run detect with --is-ok and return its exit code (never throws). */ |
| 54 | function runIsOk(env: Partial<NodeJS.ProcessEnv>): number { |
no outgoing calls
no test coverage detected