Skip to content

Commit

Permalink
[integration_test] Fix tests from changes to flutter test machine o…
Browse files Browse the repository at this point in the history
…utput (flutter#3480)
  • Loading branch information
jiahaog authored Jan 29, 2021
1 parent cd358b0 commit 07dade4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/integration_test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/integration_test/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
7 changes: 6 additions & 1 deletion packages/integration_test/test/binding_fail_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,18 @@ Future<Map<String, dynamic>> _runTest(String scriptPath) async {
final String testResults = (await process.stdout
.transform(utf8.decoder)
.expand((String text) => text.split('\n'))
.map((String line) {
.map<dynamic>((String line) {
try {
return jsonDecode(line);
} on FormatException {
// Only interested in test events which are JSON.
}
})
.expand<Map<String, dynamic>>((dynamic json) {
return json is List<dynamic>
? json.cast()
: <Map<String, dynamic>>[json as Map<String, dynamic>];
})
.where((dynamic testEvent) =>
testEvent != null && testEvent['type'] == 'print')
.map((dynamic printEvent) => printEvent['message'] as String)
Expand Down

0 comments on commit 07dade4

Please sign in to comment.