Skip to content

Commit a44ec6c

Browse files
authored
[hooks_runner] Fix flaky test (dart-lang#3101)
1 parent 7f2cfc4 commit a44ec6c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎pkgs/hooks_runner/test/build_runner/concurrency_test.dart‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,15 @@ void main() async {
114114
// Simulate hitting ctrl+c on `dart` and `flutter` commands at different
115115
// time intervals.
116116
var milliseconds = 200;
117-
while (findLockFile(packageUri, packageName) == null) {
117+
bool lockFileDoesNotExist() =>
118+
findLockFile(packageUri, packageName) == null;
119+
while (lockFileDoesNotExist()) {
118120
final result = await runBuildInProcess(
119121
killAfter: Duration(milliseconds: milliseconds),
120122
);
121-
expect(result, isNot(0));
123+
if (lockFileDoesNotExist()) {
124+
expect(result, isNot(0));
125+
}
122126
milliseconds = max((milliseconds * 1.2).round(), milliseconds + 200);
123127
}
124128
expect(findLockFile(packageUri, packageName), isNotNull);

0 commit comments

Comments
 (0)