summaryrefslogtreecommitdiff
path: root/cli/tests/unit/remove_test.ts
diff options
context:
space:
mode:
authorFeng Yu <F3n67u@outlook.com>2021-10-11 21:21:18 +0800
committerGitHub <noreply@github.com>2021-10-11 15:21:18 +0200
commit668b400ff2fa5634f575e54f40ab1f0b78fcdf16 (patch)
treea5eacaf3e9f4822ea9ace0bc117ebcfd09fc8922 /cli/tests/unit/remove_test.ts
parent423b02d8891c73f1b2864271796b067c81007f50 (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/remove_test.ts')
-rw-r--r--cli/tests/unit/remove_test.ts32
1 files changed, 22 insertions, 10 deletions
diff --git a/cli/tests/unit/remove_test.ts b/cli/tests/unit/remove_test.ts
index 192ac676e..5ea265ea8 100644
--- a/cli/tests/unit/remove_test.ts
+++ b/cli/tests/unit/remove_test.ts
@@ -80,15 +80,23 @@ unitTest(
const subPathInfo = Deno.statSync(subPath);
assert(subPathInfo.isDirectory); // check exist first
- await assertRejects(async () => {
- await Deno[method](path);
- }, Error);
+ await assertRejects(
+ async () => {
+ await Deno[method](path);
+ },
+ Error,
+ `remove '${path}'`,
+ );
// TODO(ry) Is Other really the error we should get here? What would Go do?
// NON-EXISTENT DIRECTORY/FILE
- await assertRejects(async () => {
- await Deno[method]("/baddir");
- }, Deno.errors.NotFound);
+ await assertRejects(
+ async () => {
+ await Deno[method]("/baddir");
+ },
+ Deno.errors.NotFound,
+ `remove '/baddir'`,
+ );
}
},
);
@@ -210,10 +218,14 @@ unitTest(
unitTest({ permissions: { write: true } }, async function removeAllFail() {
for (const method of REMOVE_METHODS) {
// NON-EXISTENT DIRECTORY/FILE
- await assertRejects(async () => {
- // Non-existent
- await Deno[method]("/baddir", { recursive: true });
- }, Deno.errors.NotFound);
+ await assertRejects(
+ async () => {
+ // Non-existent
+ await Deno[method]("/baddir", { recursive: true });
+ },
+ Deno.errors.NotFound,
+ `remove '/baddir'`,
+ );
}
});