From a0ddf7305895e2920ef5d9208fc9ec767ebb11d5 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Tue, 28 May 2024 12:24:54 +0200 Subject: fix(ext/node): add `throwIfNoEntry` option in `fs.lstatSync` (#24006) We didn't support the `throwIfNoEntry` option for Node's `fs.lstatSync` method. Note that the async variant doesn't have this option. Fixes https://github.com/denoland/deno/issues/23996 --- tests/unit_node/fs_test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/unit_node/fs_test.ts b/tests/unit_node/fs_test.ts index e62a246fa..a241189a5 100644 --- a/tests/unit_node/fs_test.ts +++ b/tests/unit_node/fs_test.ts @@ -7,6 +7,7 @@ import { constants, createWriteStream, existsSync, + lstatSync, mkdtempSync, promises, readFileSync, @@ -156,3 +157,11 @@ Deno.test("[node/fs createWriteStream", async () => { await Deno.remove(tempDir, { recursive: true }); } }); + +Deno.test( + "[node/fs lstatSync] supports throwIfNoEntry option", + () => { + const result = lstatSync("non-existing-path", { throwIfNoEntry: false }); + assertEquals(result, undefined); + }, +); -- cgit v1.2.3