From edd5539725ac94f231109568616896b2675405df Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Wed, 8 Jan 2025 15:40:19 -0800 Subject: [PATCH] unreadable dir could be either ENOENT or EACCESS --- src/fs.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fs.test.ts b/src/fs.test.ts index 2cf89d3..17b4cc6 100644 --- a/src/fs.test.ts +++ b/src/fs.test.ts @@ -153,12 +153,13 @@ describe("fs", () => { await expect(canReaddir(dirPath, 1000)).resolves.toBe(true); }); - (process.platform === "win32" || userInfo()?.uid === 0 ? it.skip : it)( + // userInfo.uid is -1 on Windows + (userInfo().uid <= 0 ? it.skip : it)( "should reject for unreadable directory", async () => { const dirPath = join(tempDir, "unreadableDir"); await mkdir(dirPath, { mode: 0o000 }); - expect(canReaddir(dirPath, 1000)).rejects.toThrow(/EACCES/); + expect(canReaddir(dirPath, 1000)).rejects.toThrow(/EACCES|ENOENT/); }, );