diff options
author | 2023-02-06 23:19:05 -0800 | |
---|---|---|
committer | 2023-02-06 23:19:05 -0800 | |
commit | 30106c4f54aed8061f92d95145eaa2e957f11fe6 (patch) | |
tree | 8e52f1c108ea8b60ae33bb08057e2d16cc183907 | |
parent | 34b2d7fe57c967a35c2adb07db04ba4b062d9610 (diff) | |
download | bun-30106c4f54aed8061f92d95145eaa2e957f11fe6.tar.gz bun-30106c4f54aed8061f92d95145eaa2e957f11fe6.tar.zst bun-30106c4f54aed8061f92d95145eaa2e957f11fe6.zip |
Fix failing test in debug mode
-rw-r--r-- | test/bun.js/child-process-stdio.test.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/bun.js/child-process-stdio.test.js b/test/bun.js/child-process-stdio.test.js index 8542ce588..43bcc771a 100644 --- a/test/bun.js/child-process-stdio.test.js +++ b/test/bun.js/child-process-stdio.test.js @@ -1,13 +1,16 @@ import { describe, it, expect, beforeAll } from "bun:test"; import { spawn, execSync } from "node:child_process"; import { bunExe } from "bunExe"; +import { bunEnv } from "bunEnv"; 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(bunExe(), [CHILD_PROCESS_FILE, "STDOUT"]); + const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDOUT"], { + env: bunEnv, + }); child.stdout.setEncoding("utf8"); child.stdout.on("data", data => { try { @@ -24,7 +27,9 @@ 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(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "READABLE"]); + const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "READABLE"], { + env: bunEnv, + }); let data = ""; child.stdout.setEncoding("utf8"); child.stdout @@ -46,7 +51,9 @@ 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(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]); + const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"], { + env: bunEnv, + }); let data = ""; child.stdout.setEncoding("utf8"); child.stdout @@ -72,7 +79,9 @@ 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(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"]); + const child = spawn(bunExe(), [CHILD_PROCESS_FILE, "STDIN", "FLOWING"], { + env: bunEnv, + }); let data = ""; child.stdout.setEncoding("utf8"); child.stdout @@ -97,6 +106,7 @@ describe("process.stdin", () => { it("should allow us to read from a file", () => { const result = execSync(`${bunExe()} ${CHILD_PROCESS_FILE} STDIN FLOWING < ${import.meta.dir}/readFileSync.txt`, { encoding: "utf8", + env: bunEnv, }); expect(result).toEqual("data: File read successfully"); }); |