Add support for custom test error reporters (#17727)

This allows test environments other than `flutter test` to have a hook
into the test exception reporting. Some test environments, for example,
don't just dump error details to the console, but rather require them
to be reported to a separate server.
This commit is contained in:
Todd Volkert
2018-05-18 13:58:08 -07:00
committed by GitHub
parent 19ec264909
commit 1808ac338c
7 changed files with 121 additions and 13 deletions

View File

@@ -0,0 +1,13 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('tests must restore the value of reportTestException', (WidgetTester tester) async {
// This test is expected to fail.
reportTestException = (FlutterErrorDetails details, String testDescription) {};
});
}

View File

@@ -179,6 +179,13 @@ Future<Null> _runTests({List<String> options: const <String>[]}) async {
printOutput: false,
timeout: _kShortTimeout,
);
await _runFlutterTest(automatedTests,
script: path.join('test_smoke_test', 'disallow_error_reporter_modification_test.dart'),
options: options,
expectFailure: true,
printOutput: false,
timeout: _kShortTimeout,
);
await _runCommand(flutter,
<String>['drive', '--use-existing-app']
..addAll(options)