allow passing --file-reporter option to test running refs #69425 (#120716)

* allow passing --file-reporter option to test running refs #69425

* Add trailing comma to help to meet style requirements

* Add space between tests for clarity

---------

Co-authored-by: daniel-v <dvarga@skawa.hu>
This commit is contained in:
Mateus Felipe C. C. Pinto
2023-02-21 14:24:11 -03:00
committed by GitHub
parent 23df770860
commit ebbc94bc2b
3 changed files with 48 additions and 0 deletions

View File

@@ -208,6 +208,11 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
'json': 'A machine-readable format. See: https://dart.dev/go/test-docs/json_reporter.md',
},
)
..addOption('file-reporter',
help: 'Enable an additional reporter writing test results to a file.\n'
'Should be in the form <reporter>:<filepath>, '
'Example: "json:reports/tests.json".'
)
..addOption('timeout',
help: 'The default test timeout, specified either '
'in seconds (e.g. "60s"), '
@@ -463,6 +468,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
web: stringArgDeprecated('platform') == 'chrome',
randomSeed: stringArgDeprecated('test-randomize-ordering-seed'),
reporter: stringArgDeprecated('reporter'),
fileReporter: stringArg('file-reporter'),
timeout: stringArgDeprecated('timeout'),
runSkipped: boolArgDeprecated('run-skipped'),
shardIndex: shardIndex,

View File

@@ -45,6 +45,7 @@ abstract class FlutterTestRunner {
bool web = false,
String? randomSeed,
String? reporter,
String? fileReporter,
String? timeout,
bool runSkipped = false,
int? shardIndex,
@@ -82,6 +83,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
bool web = false,
String? randomSeed,
String? reporter,
String? fileReporter,
String? timeout,
bool runSkipped = false,
int? shardIndex,
@@ -103,6 +105,8 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
...<String>['-r', 'json']
else if (reporter != null)
...<String>['-r', reporter],
if (fileReporter != null)
'--file-reporter=$fileReporter',
if (timeout != null)
...<String>['--timeout', timeout],
'--concurrency=$concurrency',