From 2a8829b0d01dbb7328ebdafdf444c01d76faaa04 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Thu, 24 Oct 2024 18:15:13 -0700 Subject: [PATCH] check readable side --- tests/index.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/index.test.ts b/tests/index.test.ts index eb8a729..a735610 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -295,7 +295,7 @@ describe( command: '/bin/sh', args: [ '-c', - `seq 0 ${n} && sleep 0.1` + `seq 0 ${n}` ], onExit, }); @@ -305,8 +305,10 @@ describe( buffer = Buffer.concat([buffer, data]); }); + await vi.waitFor(() => expect(onExit).toHaveBeenCalledTimes(1)); expect(onExit).toHaveBeenCalledWith(null, 0); + expect(readStream.readableEnded).toBe(true); const lines = buffer.toString().trim().split('\n'); expect(lines.length).toBe(n + 1); @@ -318,7 +320,7 @@ describe( } ); - test.only('doesnt miss large output from fast commands', async () => { + test('doesnt miss large output from fast commands', async () => { const payload = `hello`.repeat(4096); let buffer = Buffer.from(''); const onExit = vi.fn();