From 9e87a5b08a8974e7a67dcac5076799330f2c407f Mon Sep 17 00:00:00 2001 From: Elias Yishak <42216813+eliasyishak@users.noreply.github.com> Date: Mon, 19 Sep 2022 14:00:56 -0700 Subject: [PATCH] fix for flakey analyze test (#111895) --- .../commands.shard/permeable/create_test.dart | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart index 3d1d95b11c..9d1b0257f8 100644 --- a/packages/flutter_tools/test/commands.shard/permeable/create_test.dart +++ b/packages/flutter_tools/test/commands.shard/permeable/create_test.dart @@ -3131,22 +3131,25 @@ Future _analyzeProject(String workingDir, { List expectedFailures } } final String stdout = exec.stdout.toString(); - final List errors; + final List errors = []; try { - errors = const LineSplitter().convert(stdout) - .where((String line) { - return line.trim().isNotEmpty && - !line.startsWith('Analyzing') && - !line.contains('flutter pub get') && - !line.contains('Resolving dependencies') && - !line.contains('Got dependencies'); - }).map(lineParser).toList(); + bool analyzeLineFound = false; + const LineSplitter().convert(stdout).forEach((String line) { + // Conditional to filter out any stdout from `pub get` + if (!analyzeLineFound && line.startsWith('Analyzing')) { + analyzeLineFound = true; + return; + } - // Add debugging for https://github.com/flutter/flutter/issues/111272 - } on RangeError catch (err) { + if (analyzeLineFound && line.trim().isNotEmpty) { + errors.add(lineParser(line.trim())); + } + }); + } on Exception catch (err) { fail('$err\n\nComplete STDOUT was:\n\n$stdout'); } - expect(errors, unorderedEquals(expectedFailures)); + expect(errors, unorderedEquals(expectedFailures), + reason: 'Failed with stdout:\n\n$stdout'); } Future _getPackages(Directory workingDir) async {