From a133b775e3c9a816b999c70aab19de11d0918d1f Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Mon, 11 Jan 2016 22:23:17 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/4629 Reviewed-By: Rich Trott --- test/parallel/test-fs-watch-recursive.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index 603303abb2855c..05dfb32178c438 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -34,7 +34,13 @@ watcher.on('change', function(event, filename) { watcherClosed = true; }); -fs.writeFileSync(filepathOne, 'world'); +if (process.platform === 'darwin') { + setTimeout(function() { + fs.writeFileSync(filepathOne, 'world'); + }, 100); +} else { + fs.writeFileSync(filepathOne, 'world'); +} process.on('exit', function() { assert(watcherClosed, 'watcher Object was not closed');