Skip to content

Commit

Permalink
test: deflake test-watch-file-shared-dependency
Browse files Browse the repository at this point in the history
Delay dependency file modification.

Refs: nodejs#51842
  • Loading branch information
lpinca committed Dec 23, 2024
1 parent 48c75bc commit 3d7b8fb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/parallel/test-watch-file-shared-dependency.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ describe('watch file with shared dependency', () => {
watcher.unfilterFilesOwnedBy([fixturePaths['test.js']]);
watcher.filterFile(fixturePaths['test.js']);
watcher.filterFile(fixturePaths['dependency.js'], fixturePaths['test.js']);
writeFileSync(fixturePaths['dependency.js'], 'module.exports = { modified: true };');

if (common.isMacOS) {
// Do the write with a delay to ensure that the OS is ready to notify us.
setTimeout(() => {
writeFileSync(
fixturePaths['dependency.js'],
'module.exports = { modified: true };'
);
}, common.platformTimeout(200));
} else {
writeFileSync(
fixturePaths['dependency.js'],
'module.exports = { modified: true };'
);
}
});
});

0 comments on commit 3d7b8fb

Please sign in to comment.