Skip to content

Commit fa14e42

Browse files
committed
test: fix node_modules pattern to match directory events
On macOS, FSEvents reports events for both directories and files. The pattern '**/node_modules/**' only matches files inside node_modules, not the directory itself. Use an array pattern to match both.
1 parent cbcd51e commit fa14e42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/parallel/test-fs-watch-ignore-recursive.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ tmpdir.refresh();
130130

131131
const watcher = fs.watch(testDirectory, {
132132
recursive: true,
133-
ignore: '**/node_modules/**',
133+
// Use array to match both the directory itself and files inside it
134+
// On macOS, FSEvents may report events for the directory when files change inside it
135+
ignore: ['**/node_modules/**', '**/node_modules'],
134136
});
135137

136138
let seenFile = false;

0 commit comments

Comments
 (0)