Skip to content

Commit 199d650

Browse files
committed
test: make test-fs-watch-recursive more robust
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.
1 parent e8fadd8 commit 199d650

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ const filenameOne = 'watch.txt';
1616

1717
common.refreshTmpDir();
1818

19-
const testsubdir = fs.mkdtempSync(testDir + path.sep);
19+
const testsubdir = path.join(testDir, 'watch_me');
20+
fs.mkdirSync(testsubdir);
2021
const relativePathOne = path.join(path.basename(testsubdir), filenameOne);
2122
const filepathOne = path.join(testsubdir, filenameOne);
2223

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

37-
if (process.platform === 'darwin') {
38+
if (common.isOSX) {
3839
setTimeout(function() {
3940
fs.writeFileSync(filepathOne, 'world');
4041
}, 100);

0 commit comments

Comments
 (0)