diff options
author | 2023-07-11 17:48:13 -0700 | |
---|---|---|
committer | 2023-07-11 17:48:13 -0700 | |
commit | 2106e1d7f657a2f5fcad2c329532773bc5ce31e2 (patch) | |
tree | eab6f1c58411d6767b79711e3aeb269b62778794 | |
parent | 854ddaa909a97c0317ec29682f6c6635818d7b9e (diff) | |
download | bun-2106e1d7f657a2f5fcad2c329532773bc5ce31e2.tar.gz bun-2106e1d7f657a2f5fcad2c329532773bc5ce31e2.tar.zst bun-2106e1d7f657a2f5fcad2c329532773bc5ce31e2.zip |
Testsjarred/throw-if
-rw-r--r-- | test/js/node/fs/fs.test.ts | 12 |
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-🍇 🍈 🍉 🍊 🍋`); |