Skip to content

Commit 0c55ab3

Browse files
committed
test: wait for explicit calls in directory test
This hopefully fixes the flakiness since we explicitly wait for each step rather than hoping the delay was right.
1 parent ce81be5 commit 0c55ab3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/index.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ function waitForEvents(watcher: chokidar.FSWatcher, count: number) {
195195

196196
const runTests = (baseopts: chokidar.ChokidarOptions) => {
197197
let macosFswatch = isMacos && !baseopts.usePolling;
198-
let win32Polling = isWindows && baseopts.usePolling;
199198
let options: chokidar.ChokidarOptions;
200199
USE_SLOW_DELAY = macosFswatch ? 100 : undefined;
201200
baseopts.persistent = true;
@@ -568,13 +567,13 @@ const runTests = (baseopts: chokidar.ChokidarOptions) => {
568567
watcher.on(EV.UNLINK_DIR, unlinkSpy).on(EV.ADD_DIR, addSpy);
569568
await mkdir(parentPath);
570569

571-
await delay(win32Polling ? 900 : 300);
570+
await waitFor([[addSpy, 1, [parentPath]]]);
572571
await rmr(parentPath);
573572
await waitFor([[unlinkSpy, 1, [parentPath]]]);
574573
ok(calledWith(unlinkSpy, [parentPath]));
575574
await mkdir(parentPath);
576575

577-
await delay(win32Polling ? 2200 : 1200);
576+
await waitFor([[addSpy, 2]]);
578577
await mkdir(subPath);
579578
await waitFor([[addSpy, 3]]);
580579
ok(calledWith(addSpy, [parentPath]));

0 commit comments

Comments
 (0)