diff options
author | 2023-05-11 18:23:33 -0300 | |
---|---|---|
committer | 2023-05-11 14:23:33 -0700 | |
commit | bc7d0adcf94d65b9238c6cb0aceb38c86cc323b3 (patch) | |
tree | 83d85a76019faaba44ca85341c4cdc9c89d89e1e /test/js | |
parent | d032b73b10905c278fc109b9648612fa0fc94ff7 (diff) | |
download | bun-bc7d0adcf94d65b9238c6cb0aceb38c86cc323b3.tar.gz bun-bc7d0adcf94d65b9238c6cb0aceb38c86cc323b3.tar.zst bun-bc7d0adcf94d65b9238c6cb0aceb38c86cc323b3.zip |
fix(fs) mkdtemp and mkdtempSync errors (#2851)
* fix mkdtemp
* fmt
* fix errno
Diffstat (limited to 'test/js')
-rw-r--r-- | test/js/node/fs/fs.test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/js/node/fs/fs.test.ts b/test/js/node/fs/fs.test.ts index 83739837c..e39db9ecf 100644 --- a/test/js/node/fs/fs.test.ts +++ b/test/js/node/fs/fs.test.ts @@ -22,6 +22,7 @@ import fs, { promises, unlinkSync, mkdtempSync, + mkdtemp, constants, Dirent, Stats, @@ -158,6 +159,22 @@ it("mkdtempSync() empty name", () => { expect(existsSync(tempdir)).toBe(false); }); +it("mkdtempSync() non-exist dir #2568", () => { + try { + expect(mkdtempSync("/tmp/hello/world")).toBeFalsy(); + } catch (err: any) { + expect(err?.errno).toBe(-2); + } +}); + +it("mkdtemp() non-exist dir #2568", done => { + mkdtemp("/tmp/hello/world", (err, folder) => { + expect(err?.errno).toBe(-2); + expect(folder).toBeUndefined(); + done(); + }); +}); + it("readdirSync on import.meta.dir with trailing slash", () => { const dirs = readdirSync(import.meta.dir + "/"); expect(dirs.length > 0).toBe(true); |