Skip to content

Commit cfb5b25

Browse files
committed
fix: drain stderr in gemini hook tests
1 parent 37eadf4 commit cfb5b25

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tests/gemini-hook.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ import { describe, expect, test } from "bun:test";
22

33
async function runGeminiHook(
44
input: object,
5-
): Promise<{ stdout: string; exitCode: number }> {
5+
): Promise<{ stdout: string; stderr: string; exitCode: number }> {
66
const proc = Bun.spawn(["bun", "src/bin/cc-safety-net.ts", "-gc"], {
77
stdin: "pipe",
88
stdout: "pipe",
99
stderr: "pipe",
1010
});
1111
proc.stdin.write(JSON.stringify(input));
1212
proc.stdin.end();
13-
const stdout = await new Response(proc.stdout).text();
13+
const stdoutPromise = new Response(proc.stdout).text();
14+
const stderrPromise = new Response(proc.stderr).text();
15+
const [stdout, stderr] = await Promise.all([stdoutPromise, stderrPromise]);
1416
const exitCode = await proc.exited;
15-
return { stdout: stdout.trim(), exitCode };
17+
return { stdout: stdout.trim(), stderr: stderr.trim(), exitCode };
1618
}
1719

1820
describe("Gemini CLI hook", () => {

0 commit comments

Comments
 (0)