aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/spawn.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/bun.js/spawn.test.ts')
-rw-r--r--test/bun.js/spawn.test.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/bun.js/spawn.test.ts b/test/bun.js/spawn.test.ts
index 9e4144024..1b62542cf 100644
--- a/test/bun.js/spawn.test.ts
+++ b/test/bun.js/spawn.test.ts
@@ -28,6 +28,17 @@ for (let [gcTick, label] of [
expect(stdout.toString()).toBe(hugeString);
expect(stderr.byteLength).toBe(0);
});
+
+ it("check exit code", async () => {
+ const { exitCode: exitCode1 } = spawnSync({
+ cmd: ["ls"]
+ });
+ const { exitCode: exitCode2 } = spawnSync({
+ cmd: ["false"]
+ });
+ expect(exitCode1).toBe(0);
+ expect(exitCode2).toBe(1);
+ });
});
describe("spawn", () => {
@@ -70,6 +81,17 @@ for (let [gcTick, label] of [
expect(await Bun.file("/tmp/out.123.txt").text()).toBe(hugeString);
});
+ it("check exit code", async () => {
+ const exitCode1 = await spawn({
+ cmd: ["ls"],
+ }).exited;
+ const exitCode2 = await spawn({
+ cmd: ["false"]
+ }).exited;
+ expect(exitCode1).toBe(0);
+ expect(exitCode2).toBe(1);
+ });
+
it("Blob works as stdin", async () => {
rmSync("/tmp/out.123.txt", { force: true });
gcTick();