Skip to content

Commit 9e87a5b

Browse files
authored
fix for flakey analyze test (#111895)
1 parent 2e3b03f commit 9e87a5b

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

packages/flutter_tools/test/commands.shard/permeable/create_test.dart

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3131,22 +3131,25 @@ Future<void> _analyzeProject(String workingDir, { List<String> expectedFailures
31313131
}
31323132
}
31333133
final String stdout = exec.stdout.toString();
3134-
final List<String> errors;
3134+
final List<String> errors = <String>[];
31353135
try {
3136-
errors = const LineSplitter().convert(stdout)
3137-
.where((String line) {
3138-
return line.trim().isNotEmpty &&
3139-
!line.startsWith('Analyzing') &&
3140-
!line.contains('flutter pub get') &&
3141-
!line.contains('Resolving dependencies') &&
3142-
!line.contains('Got dependencies');
3143-
}).map(lineParser).toList();
3144-
3145-
// Add debugging for https://github.com/flutter/flutter/issues/111272
3146-
} on RangeError catch (err) {
3136+
bool analyzeLineFound = false;
3137+
const LineSplitter().convert(stdout).forEach((String line) {
3138+
// Conditional to filter out any stdout from `pub get`
3139+
if (!analyzeLineFound && line.startsWith('Analyzing')) {
3140+
analyzeLineFound = true;
3141+
return;
3142+
}
3143+
3144+
if (analyzeLineFound && line.trim().isNotEmpty) {
3145+
errors.add(lineParser(line.trim()));
3146+
}
3147+
});
3148+
} on Exception catch (err) {
31473149
fail('$err\n\nComplete STDOUT was:\n\n$stdout');
31483150
}
3149-
expect(errors, unorderedEquals(expectedFailures));
3151+
expect(errors, unorderedEquals(expectedFailures),
3152+
reason: 'Failed with stdout:\n\n$stdout');
31503153
}
31513154

31523155
Future<void> _getPackages(Directory workingDir) async {

0 commit comments

Comments
 (0)