From d1a4f4fd6981a06920adb632dde2562b76ddc4d0 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Fri, 25 Nov 2022 00:08:36 -0800 Subject: Introduce `FileSink.ref()` and `FileSink.unref()` --- test/bun.js/streams.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/bun.js/streams.test.js') diff --git a/test/bun.js/streams.test.js b/test/bun.js/streams.test.js index a872b7701..406c80852 100644 --- a/test/bun.js/streams.test.js +++ b/test/bun.js/streams.test.js @@ -225,7 +225,7 @@ it("Bun.file() read text from pipe", async () => { const large = "HELLO!".repeat((((1024 * 65) / "HELLO!".length) | 0) + 1); const chunks = []; - var out = Bun.file("/tmp/fifo").stream(); + const proc = Bun.spawn({ cmd: [ "bash", @@ -244,17 +244,17 @@ it("Bun.file() read text from pipe", async () => { const prom = (async function () { while (chunks.length === 0) { + var out = Bun.file("/tmp/fifo").stream(); for await (const chunk of out) { chunks.push(chunk); } - console.log("done"); } + return Buffer.concat(chunks).toString(); })(); const [status, output] = await Promise.all([exited, prom]); - console.log("here"); - expect(output.length).toBe(large.length); - expect(output).toBe(large); + expect(output.length).toBe(large.length + 1); + expect(output).toBe(large + "\n"); expect(status).toBe(0); }); @@ -452,7 +452,7 @@ it("ReadableStream for Blob", async () => { it("ReadableStream for File", async () => { var blob = file(import.meta.dir + "/fetch.js.txt"); - var stream = blob.stream(24); + var stream = blob.stream(); const chunks = []; var reader = stream.getReader(); stream = undefined; -- cgit v1.2.3