Skip to content

Commit c07e063

Browse files
santigimenoFishrock123
authored andcommitted
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 372e4f3 commit c07e063

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
@@ -34,7 +34,13 @@ watcher.on('change', function(event, filename) {
3434
watcherClosed = true;
3535
});
3636

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

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

0 commit comments

Comments
 (0)