Skip to content

Commit

Permalink
unreadable dir could be either ENOENT or EACCESS
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Jan 8, 2025
1 parent 2a10e0d commit edd5539
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/fs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
},
);

Expand Down

0 comments on commit edd5539

Please sign in to comment.