Skip to content

Commit 092a1ba

Browse files
Copilotstreamich
andcommitted
fix: harden flaky watchFile test by adding proper timing delays
Co-authored-by: streamich <[email protected]>
1 parent 467994b commit 092a1ba

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/node/__tests__/volume.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,14 +1507,16 @@ describe('volume', () => {
15071507
const vol = new Volume();
15081508
vol.writeFileSync('/lol.txt', '1');
15091509
setTimeout(() => {
1510-
vol.watchFile('/lol.txt', { interval: 1 }, (curr, prev) => {
1510+
vol.watchFile('/lol.txt', { interval: 10 }, (curr, prev) => {
15111511
queueMicrotask(() => {
15121512
vol.unwatchFile('/lol.txt');
15131513
done();
15141514
});
15151515
});
1516-
vol.writeFileSync('/lol.txt', '2');
1517-
}, 1);
1516+
setTimeout(() => {
1517+
vol.writeFileSync('/lol.txt', '2');
1518+
}, 5);
1519+
}, 5);
15181520
});
15191521
xit('Multiple listeners for one file', () => {});
15201522
});

0 commit comments

Comments
 (0)