From 93efe542b2092778d404963dc088f4ab0894d5c4 Mon Sep 17 00:00:00 2001 From: gvilums Date: Wed, 1 May 2024 20:23:24 +0000 Subject: [PATCH] Apply formatting changes --- test/regression/issue/10080.test.ts | 48 ++++++++++++++++------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/test/regression/issue/10080.test.ts b/test/regression/issue/10080.test.ts index 4e55624df9d3fc..7f92b68308d235 100644 --- a/test/regression/issue/10080.test.ts +++ b/test/regression/issue/10080.test.ts @@ -3,27 +3,31 @@ import { bunEnv, bunExe, isPosix } from "harness"; import { tmpdir } from "os"; import { join } from "path"; -test.if(isPosix)("10080 - ensure blocking stdio is treated as such in FileReader", async () => { - const expected = "foobar\n"; - const filename = join(tmpdir(), "bun.test.stream." + Date.now() + ".js"); - const contents = "for await (const line of console) {console.log(`foo${line}`)}" - await Bun.write(filename, contents); - const shellCommand = `exec &> >(${bunExe()} ${filename}); echo "bar"; while read -r line; do echo $line; done`; +test.if(isPosix)( + "10080 - ensure blocking stdio is treated as such in FileReader", + async () => { + const expected = "foobar\n"; + const filename = join(tmpdir(), "bun.test.stream." + Date.now() + ".js"); + const contents = "for await (const line of console) {console.log(`foo${line}`)}"; + await Bun.write(filename, contents); + const shellCommand = `exec &> >(${bunExe()} ${filename}); echo "bar"; while read -r line; do echo $line; done`; - const proc = Bun.spawn(["bash", "-c", shellCommand], { - stdin: "inherit", - stdout: "pipe", - stderr: "inherit", - env: bunEnv, - }); - const { value }= await proc.stdout.getReader().read(); - const output = new TextDecoder().decode(value); - if (output !== expected) { - expect(output).toEqual(expected); - throw new Error("Output didn't match!\n"); - } + const proc = Bun.spawn(["bash", "-c", shellCommand], { + stdin: "inherit", + stdout: "pipe", + stderr: "inherit", + env: bunEnv, + }); + const { value } = await proc.stdout.getReader().read(); + const output = new TextDecoder().decode(value); + if (output !== expected) { + expect(output).toEqual(expected); + throw new Error("Output didn't match!\n"); + } - proc.kill(9); - await proc.exited; - expect(proc.killed).toBeTrue(); -}, 1000); + proc.kill(9); + await proc.exited; + expect(proc.killed).toBeTrue(); + }, + 1000, +);