From dfdbb39e1b1d927be5a4f95668239bc3bf48210b Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sun, 28 Sep 2025 16:11:55 +0200 Subject: [PATCH] test: deflake test-fs-promises-watch-iterator Add a delay before writing the files to ensure that the watcher receives the notifications. Fixes: https://github.com/nodejs/node/issues/60051 Refs: https://github.com/nodejs/node/issues/52601 --- test/parallel/test-fs-promises-watch-iterator.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-fs-promises-watch-iterator.js b/test/parallel/test-fs-promises-watch-iterator.js index 1606bdef422132..f8b30c33f085f0 100644 --- a/test/parallel/test-fs-promises-watch-iterator.js +++ b/test/parallel/test-fs-promises-watch-iterator.js @@ -34,10 +34,12 @@ class WatchTestCase { } } async writeFiles() { + // Do the write with a delay to ensure that the OS is ready to notify us. + await setTimeout(common.platformTimeout(100)); + for (const fileName of [...this.files]) { await writeFile(this.filePath(fileName), Date.now() + fileName.repeat(1e4)); } - await setTimeout(common.platformTimeout(100)); } }