Skip to content

Commit e9ef643

Browse files
santigimenoMyles Borins
authored and
Myles Borins
committed
test: fix fs-watch-recursive flakiness on OS X
The test is sometimes timing out because of a race condition between the fs event generated on file creation and the event being registered in the kqueue. To avoid this problem, create the file after 100 ms, that is the value used in the `fs_event_watch_dir_recursive` libuv test. PR-URL: #4629 Reviewed-By: Rich Trott <[email protected]>
1 parent 4da9ddd commit e9ef643

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ watcher.on('change', function(event, filename) {
3636
watcherClosed = true;
3737
});
3838

39-
fs.writeFileSync(filepathOne, 'world');
39+
if (process.platform === 'darwin') {
40+
setTimeout(function() {
41+
fs.writeFileSync(filepathOne, 'world');
42+
}, 100);
43+
} else {
44+
fs.writeFileSync(filepathOne, 'world');
45+
}
4046

4147
process.on('exit', function() {
4248
assert(watcherClosed, 'watcher Object was not closed');

0 commit comments

Comments
 (0)