Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ watcher.on('change', function(event, filename) {
}
});

fs.writeFileSync(childrenAbsolutePath, 'world');
// Do the write with a delay to ensure that the OS is ready to notify us.
setTimeout(() => {
fs.writeFileSync(childrenAbsolutePath, 'world');
}, common.platformTimeout(200));

process.once('exit', function() {
assert(watcherClosed, 'watcher Object was not closed');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ watcher.on('change', function(event, filename) {
}
});

fs.mkdirSync(filePath);
fs.writeFileSync(childrenAbsolutePath, 'world');
// Do the write with a delay to ensure that the OS is ready to notify us.
setTimeout(() => {
fs.mkdirSync(filePath);
fs.writeFileSync(childrenAbsolutePath, 'world');
}, common.platformTimeout(200));

process.once('exit', function() {
assert(watcherClosed, 'watcher Object was not closed');
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-fs-watch-recursive-add-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ watcher.on('change', function(event, filename) {
}
});

fs.writeFileSync(testFile, 'world');
// Do the write with a delay to ensure that the OS is ready to notify us.
setTimeout(() => {
fs.writeFileSync(testFile, 'world');
}, common.platformTimeout(200));

process.once('exit', function() {
assert(watcherClosed, 'watcher Object was not closed');
Expand Down
7 changes: 6 additions & 1 deletion test/parallel/test-fs-watch-recursive-assert-leaks.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ watcher.on('change', common.mustCallAtLeast(async (event, filename) => {
process.on('exit', function() {
assert(watcherClosed, 'watcher Object was not closed');
});
fs.writeFileSync(filePath, 'content');

// Do the write with a delay to ensure that the OS is ready to notify us.
(async () => {
await setTimeout(200);
fs.writeFileSync(filePath, 'content');
})().then(common.mustCall());
5 changes: 4 additions & 1 deletion test/parallel/test-fs-watch-recursive-sync-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ const watcher = watch(tmpDir, { recursive: true }, common.mustCall((eventType, _
assert.strictEqual(join(tmpDir, _filename), filename);
}));

writeFileSync(filename, 'foobar2');
// Do the write with a delay to ensure that the OS is ready to notify us.
setTimeout(() => {
writeFileSync(filename, 'foobar2');
}, common.platformTimeout(200));
5 changes: 4 additions & 1 deletion test/parallel/test-fs-watch-recursive-update-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ watcher.on('change', common.mustCallAtLeast(function(event, filename) {
}
}));

fs.writeFileSync(testFile, 'hello');
// Do the write with a delay to ensure that the OS is ready to notify us.
setTimeout(() => {
fs.writeFileSync(testFile, 'hello');
}, common.platformTimeout(200));