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
This commit is contained in:
Marvin Hagemeister 2024-05-28 12:24:54 +02:00 committed by GitHub
parent 53606de634
commit a0ddf73058
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 4 deletions

View file

@ -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);
},
);