From 4643cb8550a3b850a7ba20c89f09383e4077bce4 Mon Sep 17 00:00:00 2001 From: garrytan Date: Wed, 30 Sep 2026 18:57:26 +0000 Subject: [PATCH] test(qa-deadline): never attach a reader to the full-pipe fixture's stdout The full-pipe receipt test attached a 'data' listener (flowing mode) and then paused; on CI the reader could drain the 2 MB write before the pause, so the receipt write never blocked and the helper exited 0 in ~126 ms. The stdout pipe now stays unread until the assertion, which is what the test means to model. --- test/qa-deadline.test.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/qa-deadline.test.ts b/test/qa-deadline.test.ts index 78a93fad9..5ab13792f 100644 --- a/test/qa-deadline.test.ts +++ b/test/qa-deadline.test.ts @@ -52,10 +52,10 @@ function receipt(output: string) { return value; } -function background(args: string[], preload?: string) { +function background(args: string[], preload?: string, options: { unreadStdout?: boolean } = {}) { const child = spawn(process.execPath, [...(preload ? ['--preload', preload] : []), CLI, ...args], { stdio: ['ignore', 'pipe', 'pipe'] }); let stdout = '', stderr = ''; - child.stdout!.on('data', chunk => { stdout += chunk; }); + if (!options.unreadStdout) child.stdout!.on('data', chunk => { stdout += chunk; }); child.stderr!.on('data', chunk => { stderr += chunk; }); const result = new Promise<{ code: number | null; signal: NodeJS.Signals | null; stdout: string; stderr: string }>((resolve, reject) => { child.once('error', reject); @@ -345,8 +345,7 @@ import { write } from 'node:fs'; write(1, Buffer.alloc(2 * 1024 * 1024, 32), () => {}); await Bun.sleep(100); `); - const runner = background(['start', f.receipt, '30'], preload); - runner.child.stdout!.pause(); + const runner = background(['start', f.receipt, '30'], preload, { unreadStdout: true }); let timer: ReturnType | undefined; try { const code = await Promise.race([