Skip to content

Commit

Permalink
test: make test-fs-watch-recursive more robust
Browse files Browse the repository at this point in the history
The test was failing on OS X when run in parallel with:

```
tools/test.py --repeat=99 -J parallel/test-fs-watch-recursive
```

ENOENT was arising when trying to create a file in the directory created
with `fs.mkdtempSync()`. I do not know if this is a bug in OS X, a bug
in libuv, or something else. I also do not know this is partially or
completely the cause of the flakiness of the test in CI and locally
(when run as part of `make test`).

In any event, changing to `fs.mkdirSync()` resolved the issue.
  • Loading branch information
Trott committed Oct 21, 2016
1 parent e8fadd8 commit 199d650
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/parallel/test-fs-watch-recursive.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const filenameOne = 'watch.txt';

common.refreshTmpDir();

const testsubdir = fs.mkdtempSync(testDir + path.sep);
const testsubdir = path.join(testDir, 'watch_me');
fs.mkdirSync(testsubdir);
const relativePathOne = path.join(path.basename(testsubdir), filenameOne);
const filepathOne = path.join(testsubdir, filenameOne);

Expand All @@ -34,7 +35,7 @@ watcher.on('change', function(event, filename) {
watcherClosed = true;
});

if (process.platform === 'darwin') {
if (common.isOSX) {
setTimeout(function() {
fs.writeFileSync(filepathOne, 'world');
}, 100);
Expand Down

0 comments on commit 199d650

Please sign in to comment.