From 07dade429d22ca7d8659db2d2fde2fde3acfaae6 Mon Sep 17 00:00:00 2001 From: Jia Hao Date: Fri, 29 Jan 2021 10:34:57 +0800 Subject: [PATCH] [integration_test] Fix tests from changes to `flutter test` machine output (#3480) --- packages/integration_test/CHANGELOG.md | 4 ++++ packages/integration_test/pubspec.yaml | 2 +- packages/integration_test/test/binding_fail_test.dart | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/integration_test/CHANGELOG.md b/packages/integration_test/CHANGELOG.md index 5ae0883ed0817..71ab0e86266b2 100644 --- a/packages/integration_test/CHANGELOG.md +++ b/packages/integration_test/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.2+2 + +* Fix tests from changes to `flutter test` machine output. + ## 1.0.2+1 * Update vm_service constraint diff --git a/packages/integration_test/pubspec.yaml b/packages/integration_test/pubspec.yaml index a233f066ea378..33c174a9724a1 100644 --- a/packages/integration_test/pubspec.yaml +++ b/packages/integration_test/pubspec.yaml @@ -1,6 +1,6 @@ name: integration_test description: Runs tests that use the flutter_test API as integration tests. -version: 1.0.2+1 +version: 1.0.2+2 homepage: https://github.com/flutter/plugins/tree/master/packages/integration_test environment: diff --git a/packages/integration_test/test/binding_fail_test.dart b/packages/integration_test/test/binding_fail_test.dart index bb5961b18fc72..7ec176897c0cf 100644 --- a/packages/integration_test/test/binding_fail_test.dart +++ b/packages/integration_test/test/binding_fail_test.dart @@ -61,13 +61,18 @@ Future> _runTest(String scriptPath) async { final String testResults = (await process.stdout .transform(utf8.decoder) .expand((String text) => text.split('\n')) - .map((String line) { + .map((String line) { try { return jsonDecode(line); } on FormatException { // Only interested in test events which are JSON. } }) + .expand>((dynamic json) { + return json is List + ? json.cast() + : >[json as Map]; + }) .where((dynamic testEvent) => testEvent != null && testEvent['type'] == 'print') .map((dynamic printEvent) => printEvent['message'] as String)