From 93b7516c5ae2011f7a125cdc2c89e2a5b5d185c2 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sun, 8 Nov 2026 17:45:42 +0000 Subject: [PATCH] Fix the flaky spawn std test --- test/unit/lib/utils/spawn.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/lib/utils/spawn.test.js b/test/unit/lib/utils/spawn.test.js index ffc58c34b6..73f8f55ac1 100644 --- a/test/unit/lib/utils/spawn.test.js +++ b/test/unit/lib/utils/spawn.test.js @@ -187,13 +187,14 @@ describe('spawn', () => { it('treats std as live while stdBuffer preserves history', async () => { const execution = spawn(process.execPath, [ '-e', - 'process.stdout.write("early"); setTimeout(() => process.stdout.write("late"), 25);', + 'process.stdout.write("early"); process.stdin.resume(); process.stdin.on("end", () => process.stdout.write("late"));', ]); await waitFor(() => String(execution.stdoutBuffer).includes('early')); const stdChunks = []; execution.std.on('data', (chunk) => stdChunks.push(Buffer.from(chunk))); + execution.child.stdin.end(); const result = await execution;