fix(flutter): updated to the way flutter build warnings are handled and added message to indicate more than one attached device has been found so device id needs to be specified

This commit is contained in:
Jon Samwell 2019-12-19 12:04:22 +11:00
parent ac6e68525d
commit e396af8758
4 changed files with 25 additions and 7 deletions

View File

@ -1,3 +1,7 @@
## [1.1.5+2] - 19/12/2019
* When more than one connected device is present the device to run against was unknown causing a failure, now a message is logged saying the --device-id argument needs to be set
* Fixed issue where depricated api warnings when build a flutter app were written to the stderr stream
## [1.1.5+1] - 18/12/2019
* Migrated example to AndroidX

View File

@ -16,6 +16,16 @@ class FlutterRunProcessHandler extends ProcessHandler {
static RegExp _noConnectedDeviceRegex =
RegExp(r"no connected device", caseSensitive: false, multiLine: false);
static RegExp _moreThanOneDeviceConnectedDeviceRegex = RegExp(
r"more than one device connected",
caseSensitive: false,
multiLine: false);
static RegExp _errorMessageRegex = RegExp(
r"aborted|error|failure|unexpected|failed|exception",
caseSensitive: false,
multiLine: false);
static RegExp _restartedApplicationSuccessRegex = RegExp(
r"Restarted application (.*)ms.",
caseSensitive: false,
@ -100,13 +110,12 @@ class FlutterRunProcessHandler extends ProcessHandler {
.map((events) => String.fromCharCodes(events).trim())
.where((event) => event.isNotEmpty)
.listen((event) {
if (event.startsWith('Note:')) {
if (event.contains(_errorMessageRegex)) {
stderr.writeln("${FAIL_COLOR}Flutter build error: $event$RESET_COLOR");
} else {
// This is most likely a depricated api usage warnings (from Gradle) and should not
// cause the test run to fail.
stdout
.writeln("${WARN_COLOR}Flutter build warning: $event$RESET_COLOR");
} else {
stderr.writeln("${FAIL_COLOR}Flutter build error: $event$RESET_COLOR");
stdout.writeln("$WARN_COLOR$event$RESET_COLOR");
}
}));
}
@ -179,6 +188,11 @@ class FlutterRunProcessHandler extends ProcessHandler {
stderr.writeln(
"${FAIL_COLOR}No connected devices found to run app on and tests against$RESET_COLOR");
}
} else if (_moreThanOneDeviceConnectedDeviceRegex.hasMatch(logLine)) {
sub?.cancel();
if (!completer.isCompleted) {
stderr.writeln("${FAIL_COLOR}$logLine$RESET_COLOR");
}
}
},
cancelOnError: true,

View File

@ -438,7 +438,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
version: "2.1.4"
vm_service_client:
dependency: transitive
description:

View File

@ -1,6 +1,6 @@
name: flutter_gherkin
description: A Gherkin / Cucumber parser and test runner for Dart and Flutter
version: 1.1.5+1
version: 1.1.5+2
author: Jon Samwell <jonsamwell@gmail.com>
homepage: https://github.com/jonsamwell/flutter_gherkin