Skip to content

Commit 1264445

Browse files
authored
Fix flaky test on Windows. (#2192)
1 parent ce9d2ad commit 1264445

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkgs/watcher/test/directory_watcher/windows_test.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,12 @@ void main() {
169169
}
170170

171171
// Events only happen when there is an async gap, wait for such a gap.
172-
await Future<void>.delayed(const Duration(milliseconds: 10));
172+
// The event usually arrives in under 10ms, try for 100ms.
173+
var tries = 0;
174+
while (errorsSeen == 0 && eventsSeen == 0 && tries < 10) {
175+
await Future<void>.delayed(const Duration(milliseconds: 10));
176+
++tries;
177+
}
173178

174179
// If everything is going well, there should have been either one event
175180
// seen or one error seen.

0 commit comments

Comments
 (0)