test: fix flaky test-fs-watchfile on macOS
On macOS, a watcher created with fs.watch() does not necessarily
start receiving events immediately. So it can miss a change by
fs.writefile() if it comes very soon after the watcher is created. Fix
test flakiness caused by this by using setInterval()
to repeat the
write action.
Fixes: https://github.com/nodejs/node/issues/13248
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
test fs