diff options
author | 2023-07-11 17:48:52 -0700 | |
---|---|---|
committer | 2023-07-11 17:48:52 -0700 | |
commit | 03904f73cce64c91aa770b494ef40e257f212037 (patch) | |
tree | 389e83e7d1251b2669440a799fb9c36b01e82aa3 /test/js | |
parent | 609f81a74614b20a1d49ce1197e1ddfe5aa2736f (diff) | |
parent | 2106e1d7f657a2f5fcad2c329532773bc5ce31e2 (diff) | |
download | bun-03904f73cce64c91aa770b494ef40e257f212037.tar.gz bun-03904f73cce64c91aa770b494ef40e257f212037.tar.zst bun-03904f73cce64c91aa770b494ef40e257f212037.zip |
Merge branch 'jarred/throw-if'
Diffstat (limited to 'test/js')
-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-🍇 🍈 🍉 🍊 🍋`); |