Skip to content

Commit dc9c13b

Browse files
committed
fixup! vfs: forward the watchFile listener through RealFSProvider
1 parent 50f2740 commit dc9c13b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎test/parallel/test-vfs-real-provider-watch.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ assert.strictEqual(myVfs.provider.supportsWatch, true);
4141
fs.writeFileSync(path.join(root, 'wf.txt'), 'a');
4242
const listener = common.mustCall();
4343
myVfs.watchFile('/wf.txt', { interval: 10, persistent: false }, listener);
44-
fs.writeFileSync(path.join(root, 'wf.txt'), 'b');
44+
// libuv's fs_poll records the first stat asynchronously as the baseline and
45+
// only reports subsequent changes, so mutate the file only after that
46+
// baseline reflects 'a'; otherwise the change is folded into the baseline
47+
// and the listener never fires.
48+
setTimeout(() => fs.writeFileSync(path.join(root, 'wf.txt'), 'b'), 100);
4549
setTimeout(() => {
4650
myVfs.unwatchFile('/wf.txt', listener);
47-
}, 50);
51+
}, 500);
4852
}

0 commit comments

Comments
 (0)