[flutter_tools] Skip over "Resolving dependencies..." text in integration tests (#120077)

Sometimes when the integration tests run Flutter apps they get this output (perhaps based on timing of file modification times). Some of the tests want to verify strict output but not fail just based on these lines before the app starts.

See https://github.com/flutter/flutter/issues/120015 / https://github.com/flutter/flutter/pull/120016.
This commit is contained in:
Danny Tuppeny
2023-02-16 18:12:16 +00:00
committed by GitHub
parent df98689c95
commit cacef57b6e
2 changed files with 13 additions and 7 deletions

View File

@@ -67,7 +67,7 @@ void main() {
'Application finished.',
'',
startsWith('Exited'),
], allowExtras: true);
]);
});
testWithoutContext('logs to client when sendLogsToClient=true', () async {
@@ -131,7 +131,7 @@ void main() {
'Application finished.',
'',
startsWith('Exited'),
], allowExtras: true);
]);
// If we're running with an out-of-process debug adapter, ensure that its
// own process shuts down after we terminated.

View File

@@ -357,12 +357,18 @@ extension DapTestClientExtension on DapTestClient {
final List<OutputEventBody> output = await outputEventsFuture;
// TODO(dantup): Integration tests currently trigger "flutter pub get" at
// the start due to some timestamp manipulation writing the pubspec.
// It may be possible to remove this if
// https://github.com/flutter/flutter/pull/91300 lands.
// Integration tests may trigger "flutter pub get" at the start based of
// `pubspec/yaml` and `.dart_tool/package_config.json`.
// See
// https://github.com/flutter/flutter/pull/91300
// https://github.com/flutter/flutter/issues/120015
return skipInitialPubGetOutput
? output.skipWhile((OutputEventBody output) => output.output.startsWith('Running "flutter pub get"')).toList()
? output
.skipWhile((OutputEventBody output) =>
output.output.startsWith('Running "flutter pub get"') ||
output.output.startsWith('Resolving dependencies') ||
output.output.startsWith('Got dependencies'))
.toList()
: output;
}