diff options
author | 2023-01-22 00:02:22 +0200 | |
---|---|---|
committer | 2023-01-21 14:02:22 -0800 | |
commit | fd29d05c6aa447518e68a2572fae411efa80ea9f (patch) | |
tree | b93b1af406277a0a8138283d4c752c93c6bb9953 /test/bun.js/child-process-stdio.test.js | |
parent | f475802206ff8a1d0568b5116c2be74db6602a20 (diff) | |
download | bun-fd29d05c6aa447518e68a2572fae411efa80ea9f.tar.gz bun-fd29d05c6aa447518e68a2572fae411efa80ea9f.tar.zst bun-fd29d05c6aa447518e68a2572fae411efa80ea9f.zip |
minor clean-ups (#1869)
- use `Lockfile.str()` more
- allow `child-process-stdio.test.js` to run with `bun-debug`
Diffstat (limited to 'test/bun.js/child-process-stdio.test.js')
-rw-r--r-- | test/bun.js/child-process-stdio.test.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/bun.js/child-process-stdio.test.js b/test/bun.js/child-process-stdio.test.js index a023a6e03..5e295b2ca 100644 --- a/test/bun.js/child-process-stdio.test.js +++ b/test/bun.js/child-process-stdio.test.js @@ -1,12 +1,13 @@ import { describe, it, expect, beforeAll } from "bun:test"; import { spawn, execSync } from "node:child_process"; +import { bunExe } from "bunExe"; const CHILD_PROCESS_FILE = import.meta.dir + "/spawned-child.js"; const OUT_FILE = import.meta.dir + "/stdio-test-out.txt"; describe("process.stdout", () => { it("should allow us to write to it", (done) => { - const child = spawn("bun", [CHILD_PROCESS_FILE, "STDOUT"]); + const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDOUT"]); child.stdout.setEncoding("utf8"); child.stdout.on("data", (data) => { try { @@ -23,7 +24,7 @@ describe("process.stdin", () => { it("should allow us to read from stdin in readable mode", (done) => { const input = "hello\n"; // Child should read from stdin and write it back - const child = spawn("bun", [CHILD_PROCESS_FILE, "STDIN", "READABLE"]); + const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "READABLE"]); let data = ""; child.stdout.setEncoding("utf8"); child.stdout.on("data", (chunk) => { @@ -43,7 +44,7 @@ describe("process.stdin", () => { it("should allow us to read from stdin via flowing mode", (done) => { const input = "hello\n"; // Child should read from stdin and write it back - const child = spawn("bun", [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]); + const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]); let data = ""; child.stdout.setEncoding("utf8"); child.stdout.on("readable", () => { @@ -67,7 +68,7 @@ describe("process.stdin", () => { const numReps = Math.ceil((66 * 1024) / 5); const input = "hello".repeat(numReps); // Child should read from stdin and write it back - const child = spawn("bun", [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]); + const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]); let data = ""; child.stdout.setEncoding("utf8"); child.stdout.on("readable", () => { @@ -89,7 +90,7 @@ describe("process.stdin", () => { it("should allow us to read from a file", () => { const result = execSync( - `bun ${CHILD_PROCESS_FILE} STDIN FLOWING < ${ + `${bunExe()} ${CHILD_PROCESS_FILE} STDIN FLOWING < ${ import.meta.dir }/readFileSync.txt`, { encoding: "utf8" }, |