aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/process-args.test.js
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2022-11-09 15:40:40 -0800
committerGravatar GitHub <noreply@github.com> 2022-11-09 15:40:40 -0800
commitf7f1b604443c030afe29d1059b90f72c69afe081 (patch)
tree8f2397447b2a84dab02850007264b72cc565f5d6 /test/bun.js/process-args.test.js
parentda257336b0b70df8c31da647496899cf70670000 (diff)
downloadbun-f7f1b604443c030afe29d1059b90f72c69afe081.tar.gz
bun-f7f1b604443c030afe29d1059b90f72c69afe081.tar.zst
bun-f7f1b604443c030afe29d1059b90f72c69afe081.zip
Add bun-types, add typechecking, add `child_process` types (#1475)
* Add bun-types to packages * Improve typing * Fix types in tests * Fix dts tests * Run formatter * Fix all type errors * Add strict mode, fix type errors * Add ffi changes * Move workflows to root * Add workflows * Remove labeler * Add child_process types * Fix synthetic defaults issue * Remove docs * Move scripts * Run prettier * Include examples in typechecking * captureStackTrace types * moved captureStackTrace types to globals * Address reviews Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Diffstat (limited to 'test/bun.js/process-args.test.js')
-rw-r--r--test/bun.js/process-args.test.js56
1 files changed, 32 insertions, 24 deletions
diff --git a/test/bun.js/process-args.test.js b/test/bun.js/process-args.test.js
index 6bdfbf9e0..512b6b92c 100644
--- a/test/bun.js/process-args.test.js
+++ b/test/bun.js/process-args.test.js
@@ -1,33 +1,41 @@
-
import { spawn } from "bun";
import { test, expect } from "bun:test";
test("args exclude run", async () => {
- const arg0 = process.argv[0];
- const arg1 = import.meta.dir + '/print-process-args.js';
+ const arg0 = process.argv[0];
+ const arg1 = import.meta.dir + "/print-process-args.js";
- const exe = process.versions.bun.includes("debug") ? "bun-debug" : "bun";
+ const exe = process.versions.bun.includes("debug") ? "bun-debug" : "bun";
- const { stdout: s1 } = spawn([exe, "print-process-args.js"], { cwd: import.meta.dir });
- const t1 = JSON.parse(await new Response(s1).text());
- expect(t1[0]).toBe(arg0);
- expect(t1[1]).toBe(arg1);
+ const { stdout: s1 } = spawn([exe, "print-process-args.js"], {
+ cwd: import.meta.dir,
+ });
+ const t1 = JSON.parse(await new Response(s1).text());
+ expect(t1[0]).toBe(arg0);
+ expect(t1[1]).toBe(arg1);
- const { stdout: s2 } = spawn([exe, "print-process-args.js", "arg1"], { cwd: import.meta.dir });
- const t2 = JSON.parse(await new Response(s2).text());
- expect(t2[0]).toBe(arg0);
- expect(t2[1]).toBe(arg1);
- expect(t2[2]).toBe("arg1");
+ const { stdout: s2 } = spawn([exe, "print-process-args.js", "arg1"], {
+ cwd: import.meta.dir,
+ });
+ const t2 = JSON.parse(await new Response(s2).text());
+ expect(t2[0]).toBe(arg0);
+ expect(t2[1]).toBe(arg1);
+ expect(t2[2]).toBe("arg1");
- const { stdout: s3 } = spawn([exe, "run", "print-process-args.js"], { cwd: import.meta.dir });
- const t3 = JSON.parse(await new Response(s3).text());
- expect(t3[0]).toBe(arg0);
- expect(t3[1]).toBe(arg1);
+ const { stdout: s3 } = spawn([exe, "run", "print-process-args.js"], {
+ cwd: import.meta.dir,
+ });
+ const t3 = JSON.parse(await new Response(s3).text());
+ expect(t3[0]).toBe(arg0);
+ expect(t3[1]).toBe(arg1);
- const { stdout: s4 } = spawn([exe, "run", "print-process-args.js", "arg1", "arg2"], { cwd: import.meta.dir });
- const t4 = JSON.parse(await new Response(s4).text());
- expect(t4[0]).toBe(arg0);
- expect(t4[1]).toBe(arg1);
- expect(t4[2]).toBe("arg1");
- expect(t4[3]).toBe("arg2");
-}); \ No newline at end of file
+ const { stdout: s4 } = spawn(
+ [exe, "run", "print-process-args.js", "arg1", "arg2"],
+ { cwd: import.meta.dir },
+ );
+ const t4 = JSON.parse(await new Response(s4).text());
+ expect(t4[0]).toBe(arg0);
+ expect(t4[1]).toBe(arg1);
+ expect(t4[2]).toBe("arg1");
+ expect(t4[3]).toBe("arg2");
+});