Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: 💍 harden test to work on Windows
  • Loading branch information
streamich committed Jul 7, 2026
commit 8a936858f436b037843884cba2c1261997bbbe34
18 changes: 17 additions & 1 deletion packages/fs-node/src/__tests__/volume.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1637,9 +1637,25 @@ describe('volume', () => {
});

it('suppresses only ENOENT; other errors still throw', () => {
const vol = Volume.fromJSON({ '/file.txt': 'x' });
const vol = Volume.fromJSON({ '/dir/file.txt': 'x' });
vol.chmodSync('/dir', 0);
expect(() => vol.watch('/dir/file.txt', { throwIfNoEntry: false })).toThrow(/EACCES/);
});

it('throws ENOTDIR for traversal through a file on POSIX', () => {
const vol = Volume.fromJSON({ '/file.txt': 'x' }, undefined, {
process: { ...process, platform: 'linux' },
});
Comment on lines +1646 to +1648
expect(() => vol.watch('/file.txt/sub', { throwIfNoEntry: false })).toThrow(/ENOTDIR/);
});

it('suppresses the ENOENT reported for traversal through a file on Windows', () => {
const vol = Volume.fromJSON({ '/file.txt': 'x' }, undefined, {
process: { ...process, platform: 'win32' },
});
Comment on lines +1653 to +1655
const watcher = vol.watch('/file.txt/sub', { throwIfNoEntry: false });
watcher.close();
});
});

describe('ignore option', () => {
Expand Down
Loading