diff options
author | 2023-03-07 12:22:34 -0800 | |
---|---|---|
committer | 2023-03-07 12:22:34 -0800 | |
commit | f7e4eb83694aa007a492ef66c28ffbe6a2dae791 (patch) | |
tree | 7af25aa5c42a2e1b2b47ba1df35f8caa9054cbeb /test/bun.js/spawn-streaming-stdout.test.ts | |
parent | 36275a44ce7a33587bd26aad120042ab95470ff3 (diff) | |
download | bun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.tar.gz bun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.tar.zst bun-f7e4eb83694aa007a492ef66c28ffbe6a2dae791.zip |
Reorganize tests (#2332)
Diffstat (limited to 'test/bun.js/spawn-streaming-stdout.test.ts')
-rw-r--r-- | test/bun.js/spawn-streaming-stdout.test.ts | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/test/bun.js/spawn-streaming-stdout.test.ts b/test/bun.js/spawn-streaming-stdout.test.ts deleted file mode 100644 index bda1031ad..000000000 --- a/test/bun.js/spawn-streaming-stdout.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { it, test, expect } from "bun:test"; -import { spawn } from "bun"; -import { bunExe } from "./bunExe"; -import { gcTick } from "gc"; -import { closeSync, openSync } from "fs"; -import { bunEnv } from "./bunEnv"; - -test("spawn can read from stdout multiple chunks", async () => { - gcTick(true); - const maxFD = openSync("/dev/null", "w"); - closeSync(maxFD); - - for (let i = 0; i < 10; i++) - await (async function () { - var exited; - const proc = spawn({ - cmd: [bunExe(), import.meta.dir + "/spawn-streaming-stdout-repro.js"], - stdin: "ignore", - stdout: "pipe", - stderr: "ignore", - env: bunEnv, - }); - var chunks = []; - let counter = 0; - try { - for await (var chunk of proc.stdout) { - chunks.push(chunk); - counter++; - if (counter > 3) break; - } - } catch (e) { - console.log(e.stack); - throw e; - } - expect(counter).toBe(4); - // TODO: fix bug with returning SIGHUP instead of exit code 1 - proc.kill(); - expect(Buffer.concat(chunks).toString()).toBe("Wrote to stdout\n".repeat(4)); - })(); - - const newMaxFD = openSync("/dev/null", "w"); - closeSync(newMaxFD); - expect(newMaxFD).toBe(maxFD); -}); |