aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-11 17:48:13 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-07-11 17:48:13 -0700
commit2106e1d7f657a2f5fcad2c329532773bc5ce31e2 (patch)
treeeab6f1c58411d6767b79711e3aeb269b62778794
parent854ddaa909a97c0317ec29682f6c6635818d7b9e (diff)
downloadbun-jarred/throw-if.tar.gz
bun-jarred/throw-if.tar.zst
bun-jarred/throw-if.zip
-rw-r--r--test/js/node/fs/fs.test.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/js/node/fs/fs.test.ts b/test/js/node/fs/fs.test.ts
index 0236010be..48aa9d3b9 100644
--- a/test/js/node/fs/fs.test.ts
+++ b/test/js/node/fs/fs.test.ts
@@ -159,6 +159,18 @@ it("readdirSync on import.meta.dir", () => {
expect(match).toBe(true);
});
+it("statSync throwIfNoEntry", () => {
+ expect(statSync("/tmp/404/not-found/ok", { throwIfNoEntry: false })).toBeUndefined();
+ expect(lstatSync("/tmp/404/not-found/ok", { throwIfNoEntry: false })).toBeUndefined();
+});
+
+it("statSync throwIfNoEntry: true", () => {
+ expect(() => statSync("/tmp/404/not-found/ok", { throwIfNoEntry: true })).toThrow("No such file or directory");
+ expect(() => statSync("/tmp/404/not-found/ok")).toThrow("No such file or directory");
+ expect(() => lstatSync("/tmp/404/not-found/ok", { throwIfNoEntry: true })).toThrow("No such file or directory");
+ expect(() => lstatSync("/tmp/404/not-found/ok")).toThrow("No such file or directory");
+});
+
// https://github.com/oven-sh/bun/issues/1887
it("mkdtempSync, readdirSync, rmdirSync and unlinkSync with non-ascii", () => {
const tempdir = mkdtempSync(`${tmpdir()}/emoji-fruit-🍇 🍈 🍉 🍊 🍋`);