From 668b400ff2fa5634f575e54f40ab1f0b78fcdf16 Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Mon, 11 Oct 2021 21:21:18 +0800 Subject: feat(runtime): improve error messages of runtime fs (#11984) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cli/tests/unit/mkdir_test.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'cli/tests/unit/mkdir_test.ts') diff --git a/cli/tests/unit/mkdir_test.ts b/cli/tests/unit/mkdir_test.ts index 2e84ed06f..b06a1cd4c 100644 --- a/cli/tests/unit/mkdir_test.ts +++ b/cli/tests/unit/mkdir_test.ts @@ -59,15 +59,23 @@ unitTest( ); unitTest({ permissions: { write: true } }, function mkdirErrSyncIfExists() { - assertThrows(() => { - Deno.mkdirSync("."); - }, Deno.errors.AlreadyExists); + assertThrows( + () => { + Deno.mkdirSync("."); + }, + Deno.errors.AlreadyExists, + `mkdir '.'`, + ); }); unitTest({ permissions: { write: true } }, async function mkdirErrIfExists() { - await assertRejects(async () => { - await Deno.mkdir("."); - }, Deno.errors.AlreadyExists); + await assertRejects( + async () => { + await Deno.mkdir("."); + }, + Deno.errors.AlreadyExists, + `mkdir '.'`, + ); }); unitTest( -- cgit v1.2.3