diff options
author | Feng Yu <F3n67u@outlook.com> | 2021-10-11 21:21:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-11 15:21:18 +0200 |
commit | 668b400ff2fa5634f575e54f40ab1f0b78fcdf16 (patch) | |
tree | a5eacaf3e9f4822ea9ace0bc117ebcfd09fc8922 /cli/tests/unit/chmod_test.ts | |
parent | 423b02d8891c73f1b2864271796b067c81007f50 (diff) |
feat(runtime): improve error messages of runtime fs (#11984)
This commit annotates errors returned from FS Deno APIs to include
paths that were passed to the API calls.
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tests/unit/chmod_test.ts')
-rw-r--r-- | cli/tests/unit/chmod_test.ts | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cli/tests/unit/chmod_test.ts b/cli/tests/unit/chmod_test.ts index 8d73a3ba4..2ab4c5b0c 100644 --- a/cli/tests/unit/chmod_test.ts +++ b/cli/tests/unit/chmod_test.ts @@ -82,10 +82,14 @@ unitTest( ); unitTest({ permissions: { write: true } }, function chmodSyncFailure() { - assertThrows(() => { - const filename = "/badfile.txt"; - Deno.chmodSync(filename, 0o777); - }, Deno.errors.NotFound); + const filename = "/badfile.txt"; + assertThrows( + () => { + Deno.chmodSync(filename, 0o777); + }, + Deno.errors.NotFound, + `chmod '${filename}'`, + ); }); unitTest({ permissions: { write: false } }, function chmodSyncPerm() { @@ -170,10 +174,14 @@ unitTest( ); unitTest({ permissions: { write: true } }, async function chmodFailure() { - await assertRejects(async () => { - const filename = "/badfile.txt"; - await Deno.chmod(filename, 0o777); - }, Deno.errors.NotFound); + const filename = "/badfile.txt"; + await assertRejects( + async () => { + await Deno.chmod(filename, 0o777); + }, + Deno.errors.NotFound, + `chmod '${filename}'`, + ); }); unitTest({ permissions: { write: false } }, async function chmodPerm() { |