mirror of
https://github.com/flutter/flutter
synced 2024-10-13 19:52:53 +00:00
change --machine flag for flutter test
to report test progress as JSON (#10848)
(The Flutter plugin will use this to update the UI with test progress.)
This commit is contained in:
parent
2f979914e4
commit
f01e9418fc
|
@ -172,8 +172,8 @@ class TestCommand extends FlutterCommand {
|
||||||
collector = new CoverageCollector();
|
collector = new CoverageCollector();
|
||||||
}
|
}
|
||||||
|
|
||||||
final bool wantEvents = argResults['machine'];
|
final bool machine = argResults['machine'];
|
||||||
if (collector != null && wantEvents) {
|
if (collector != null && machine) {
|
||||||
throwToolExit(
|
throwToolExit(
|
||||||
"The test command doesn't support --machine and coverage together");
|
"The test command doesn't support --machine and coverage together");
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ class TestCommand extends FlutterCommand {
|
||||||
TestWatcher watcher;
|
TestWatcher watcher;
|
||||||
if (collector != null) {
|
if (collector != null) {
|
||||||
watcher = collector;
|
watcher = collector;
|
||||||
} else if (wantEvents) {
|
} else if (machine) {
|
||||||
watcher = new EventPrinter();
|
watcher = new EventPrinter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +192,9 @@ class TestCommand extends FlutterCommand {
|
||||||
watcher: watcher,
|
watcher: watcher,
|
||||||
enableObservatory: collector != null || startPaused,
|
enableObservatory: collector != null || startPaused,
|
||||||
startPaused: startPaused,
|
startPaused: startPaused,
|
||||||
ipv6: argResults['ipv6']);
|
ipv6: argResults['ipv6'],
|
||||||
|
json: machine,
|
||||||
|
);
|
||||||
|
|
||||||
if (collector != null) {
|
if (collector != null) {
|
||||||
if (!await _collectCoverageData(collector, mergeCoverageData: argResults['merge-coverage']))
|
if (!await _collectCoverageData(collector, mergeCoverageData: argResults['merge-coverage']))
|
||||||
|
|
|
@ -24,6 +24,7 @@ Future<int> runTests(
|
||||||
bool enableObservatory: false,
|
bool enableObservatory: false,
|
||||||
bool startPaused: false,
|
bool startPaused: false,
|
||||||
bool ipv6: false,
|
bool ipv6: false,
|
||||||
|
bool json: false,
|
||||||
TestWatcher watcher,
|
TestWatcher watcher,
|
||||||
}) async {
|
}) async {
|
||||||
// Compute the command-line arguments for package:test.
|
// Compute the command-line arguments for package:test.
|
||||||
|
@ -36,6 +37,10 @@ Future<int> runTests(
|
||||||
testArgs.add('--concurrency=1');
|
testArgs.add('--concurrency=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (json) {
|
||||||
|
testArgs.addAll(<String>['-r', 'json']);
|
||||||
|
}
|
||||||
|
|
||||||
testArgs.add('--');
|
testArgs.add('--');
|
||||||
testArgs.addAll(testFiles);
|
testArgs.addAll(testFiles);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue