Files
bun.sh/test/js/node/process/process-args.test.js
Dylan Conway c538bf87d1 fix(windows): transpiler cache and other test fixes (#8471)
* umask

* process args

* update reportError.test.ts

* file exists

* transpiler cache

* back to const

* remove failing comments

* [autofix.ci] apply automated fixes

* update comment

* debug assert and remmove branch

* oops

* escape

* path sep

* seekTo

* disable

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-29 15:17:23 -08:00

42 lines
1.4 KiB
JavaScript

import { spawn } from "bun";
import { test, expect } from "bun:test";
import { join } from "path";
import { bunExe } from "harness";
test("args exclude run", async () => {
const arg0 = process.argv[0];
const arg1 = join(import.meta.dir, "/print-process-args.js");
const exe = bunExe();
const { stdout: s1 } = spawn([exe, "print-process-args.js"], {
cwd: import.meta.dir,
env: { BUN_DEBUG_QUIET_LOGS: "1" },
});
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,
env: { BUN_DEBUG_QUIET_LOGS: "1" },
});
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,
env: { BUN_DEBUG_QUIET_LOGS: "1" },
});
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,
env: { BUN_DEBUG_QUIET_LOGS: "1" },
});
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");
});