diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-05-29 16:27:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-29 17:27:43 +0200 |
commit | 8e39275429c36ff5dfa5d62a80713c5b288fe26a (patch) | |
tree | 1d6d2781682bed1c29f81366f08db65c604fef2c /cli/tests/unit/os_test.ts | |
parent | ad6d2a7734aafb4a64837abc6abd1d1d0fb20017 (diff) |
fix(cli/permissions): Fix CWD and exec path leaks (#5642)
Diffstat (limited to 'cli/tests/unit/os_test.ts')
-rw-r--r-- | cli/tests/unit/os_test.ts | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts index e99002534..72c88b0e1 100644 --- a/cli/tests/unit/os_test.ts +++ b/cli/tests/unit/os_test.ts @@ -277,15 +277,13 @@ unitTest({ perms: { read: true } }, function execPath(): void { }); unitTest({ perms: { read: false } }, function execPathPerm(): void { - let caughtError = false; - try { - Deno.execPath(); - } catch (err) { - caughtError = true; - assert(err instanceof Deno.errors.PermissionDenied); - assertEquals(err.name, "PermissionDenied"); - } - assert(caughtError); + assertThrows( + () => { + Deno.execPath(); + }, + Deno.errors.PermissionDenied, + "read access to <exec_path>, run again with the --allow-read flag" + ); }); unitTest({ perms: { env: true } }, function loadavgSuccess(): void { |