diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-06-25 09:21:58 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-25 09:21:58 +0530 |
commit | 18c9a7ad641302a9f5e0ccb07da732890f8e0505 (patch) | |
tree | 9ae7e3b7b34dc4b49fdd8d6281f7a367c043de85 /cli/tests/unit/process_test.ts | |
parent | fd5a12d7e25dc53238e2bbcffe970e646c1035f3 (diff) |
fix(core): don't panic on non-existent cwd (#14957)
Co-authored-by: cjihrig <cjihrig@gmail.com>
Diffstat (limited to 'cli/tests/unit/process_test.ts')
-rw-r--r-- | cli/tests/unit/process_test.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cli/tests/unit/process_test.ts b/cli/tests/unit/process_test.ts index 5acb92226..e610095ff 100644 --- a/cli/tests/unit/process_test.ts +++ b/cli/tests/unit/process_test.ts @@ -2,6 +2,7 @@ import { assert, assertEquals, + assertStrictEquals, assertStringIncludes, assertThrows, } from "./test_util.ts"; @@ -628,3 +629,35 @@ Deno.test( } }, ); + +Deno.test( + { + permissions: { run: true, read: true, write: true }, + ignore: Deno.build.os === "windows", + }, + async function non_existent_cwd(): Promise<void> { + const p = Deno.run({ + cmd: [ + Deno.execPath(), + "eval", + `const dir = Deno.makeTempDirSync(); + Deno.chdir(dir); + Deno.removeSync(dir); + const p = Deno.run({cmd:[Deno.execPath(), "eval", "console.log(1);"]}); + const { code } = await p.status(); + p.close(); + Deno.exit(code); + `, + ], + stdout: "piped", + stderr: "piped", + }); + + const { code } = await p.status(); + const stderr = new TextDecoder().decode(await p.stderrOutput()); + p.close(); + p.stdout.close(); + assertStrictEquals(code, 1); + assertStringIncludes(stderr, "invalid module path"); + }, +); |