diff options
author | Luca Casonato <hello@lcas.dev> | 2024-09-10 20:12:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 11:12:24 -0700 |
commit | 7bfcb4dd10d31f5f9566c90a28449c0951f3a48e (patch) | |
tree | fca0dec6e98118418f1712c6e8451a04c7e89988 /tests/unit/os_test.ts | |
parent | be5419d479fcae16c8a07dec00ce11b532b7996a (diff) |
feat(cli): use NotCapable error for permission errors (#25431)
Closes #7394
---------
Co-authored-by: snek <snek@deno.com>
Diffstat (limited to 'tests/unit/os_test.ts')
-rw-r--r-- | tests/unit/os_test.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/unit/os_test.ts b/tests/unit/os_test.ts index 52aa2ce77..4f760ecf8 100644 --- a/tests/unit/os_test.ts +++ b/tests/unit/os_test.ts @@ -48,16 +48,16 @@ Deno.test({ permissions: { env: true } }, function avoidEmptyNamedEnv() { assertThrows(() => Deno.env.delete("a\0a"), TypeError); }); -Deno.test({ permissions: { env: false } }, function envPermissionDenied1() { +Deno.test({ permissions: { env: false } }, function envPerm1() { assertThrows(() => { Deno.env.toObject(); - }, Deno.errors.PermissionDenied); + }, Deno.errors.NotCapable); }); -Deno.test({ permissions: { env: false } }, function envPermissionDenied2() { +Deno.test({ permissions: { env: false } }, function envPerm2() { assertThrows(() => { Deno.env.get("PATH"); - }, Deno.errors.PermissionDenied); + }, Deno.errors.NotCapable); }); // This test verifies that on Windows, environment variables are @@ -191,7 +191,7 @@ Deno.test({ permissions: { read: false } }, function execPathPerm() { () => { Deno.execPath(); }, - Deno.errors.PermissionDenied, + Deno.errors.NotCapable, "Requires read access to <exec_path>, run again with the --allow-read flag", ); }); @@ -206,7 +206,7 @@ Deno.test( () => { Deno.readTextFileSync("/proc/net/dev"); }, - Deno.errors.PermissionDenied, + Deno.errors.NotCapable, `Requires all access to "/proc/net/dev", run again with the --allow-all flag`, ); }, @@ -223,7 +223,7 @@ Deno.test( Deno.test({ permissions: { sys: false } }, function loadavgPerm() { assertThrows(() => { Deno.loadavg(); - }, Deno.errors.PermissionDenied); + }, Deno.errors.NotCapable); }); Deno.test( @@ -253,7 +253,7 @@ Deno.test( Deno.test({ permissions: { sys: false } }, function hostnamePerm() { assertThrows(() => { Deno.hostname(); - }, Deno.errors.PermissionDenied); + }, Deno.errors.NotCapable); }); Deno.test( @@ -266,7 +266,7 @@ Deno.test( Deno.test({ permissions: { sys: false } }, function releasePerm() { assertThrows(() => { Deno.osRelease(); - }, Deno.errors.PermissionDenied); + }, Deno.errors.NotCapable); }); Deno.test({ permissions: { sys: ["osUptime"] } }, function osUptime() { @@ -278,7 +278,7 @@ Deno.test({ permissions: { sys: ["osUptime"] } }, function osUptime() { Deno.test({ permissions: { sys: false } }, function osUptimePerm() { assertThrows(() => { Deno.osUptime(); - }, Deno.errors.PermissionDenied); + }, Deno.errors.NotCapable); }); Deno.test( |