From fad74b9e3fb04516d6d8364351d59fe98c350e1a Mon Sep 17 00:00:00 2001 From: David Morgan Date: Mon, 6 Oct 2025 13:25:21 +0200 Subject: [PATCH] Fix flaky test on Windows. --- pkgs/watcher/test/directory_watcher/windows_test.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/watcher/test/directory_watcher/windows_test.dart b/pkgs/watcher/test/directory_watcher/windows_test.dart index 6489771c6..934b4feab 100644 --- a/pkgs/watcher/test/directory_watcher/windows_test.dart +++ b/pkgs/watcher/test/directory_watcher/windows_test.dart @@ -169,7 +169,12 @@ void main() { } // Events only happen when there is an async gap, wait for such a gap. - await Future.delayed(const Duration(milliseconds: 10)); + // The event usually arrives in under 10ms, try for 100ms. + var tries = 0; + while (errorsSeen == 0 && eventsSeen == 0 && tries < 10) { + await Future.delayed(const Duration(milliseconds: 10)); + ++tries; + } // If everything is going well, there should have been either one event // seen or one error seen.