summaryrefslogtreecommitdiff
path: root/tests/unit/command_test.ts
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-09-04 17:03:09 +0200
committerGitHub <noreply@github.com>2024-09-04 16:03:09 +0100
commit5400f1af6cdca6a71de80093c9d49cdde1f34ce5 (patch)
tree8ae5d40fc172d7dc956e95b696e2f03f62ad5988 /tests/unit/command_test.ts
parentc6d1b0a1ccf45b7819b1e6f1efe8687b240f495a (diff)
fix(windows): Deno.Command - align binary resolution with linux and mac (#25429)
Diffstat (limited to 'tests/unit/command_test.ts')
-rw-r--r--tests/unit/command_test.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/unit/command_test.ts b/tests/unit/command_test.ts
index dd8352547..6352e1fc7 100644
--- a/tests/unit/command_test.ts
+++ b/tests/unit/command_test.ts
@@ -975,3 +975,35 @@ Deno.test(
);
},
);
+
+Deno.test(
+ { permissions: { write: true, run: true, read: true } },
+ async function commandWithCwdOrPath() {
+ const cwd = Deno.makeTempDirSync({ prefix: "deno_command_test" });
+ try {
+ const suffix = Deno.build.os === "windows" ? ".exe" : "";
+ Deno.mkdirSync(`${cwd}/subdir`);
+ Deno.copyFileSync(Deno.execPath(), `${cwd}/subdir/my_binary${suffix}`);
+ // cwd
+ {
+ const output = await new Deno.Command(`./my_binary${suffix}`, {
+ cwd: `${cwd}/subdir`,
+ args: ["-v"],
+ }).output();
+ assertEquals(output.success, true);
+ }
+ // path
+ {
+ const output = await new Deno.Command(`my_binary${suffix}`, {
+ env: {
+ PATH: `${cwd}/subdir`,
+ },
+ args: ["-v"],
+ }).output();
+ assertEquals(output.success, true);
+ }
+ } finally {
+ Deno.removeSync(cwd, { recursive: true });
+ }
+ },
+);