resolveTestArgs method
Resolves the test args to pass to the test
package.
Implementation
List<String> resolveTestArgs() {
var testPlatform = platform;
var testPauseAfterLoad = parsedArgs.pauseAfterLoad;
var testDebug = parsedArgs.debug;
var includeTags = parsedArgs.includeTags.variables.toList();
var excludeTags = parsedArgs.excludeTags.variables.toList();
var testsNames = parsedArgs.globalPatterns;
var testCoverage = parsedArgs.coverage;
var testReporter = parsedArgs.reporter;
var testFileReporters = parsedArgs.fileReporters;
var testNoRetry = parsedArgs.noRetry;
final suiteDefaults = parsedArgs.suiteDefaults;
var testTimeout = !headless ? Timeout.none : suiteDefaults.metadata.timeout;
var testIgnoreTimeouts = suiteDefaults.ignoreTimeouts;
var testRunSkipped = suiteDefaults.runSkipped;
var testDart2jsArgs2 = suiteDefaults.dart2jsArgs;
var testJsTrace = suiteDefaults.jsTrace;
var testSelections = parsedArgs.testSelections;
var testsPaths =
testSelections.keys.where((p) => p.endsWith('.dart')).toList();
var jsonReportFilePath = this.jsonReportFilePath;
var logDirectory = this.logDirectory;
if (logDirectory != null) {
logDirectory.createSync(recursive: true);
}
final enableDeferredLibraries = this.enableDeferredLibraries;
if (enableDeferredLibraries != null) {
testDart2jsArgs2 = testDart2jsArgs2.toList();
if (enableDeferredLibraries) {
testDart2jsArgs2.removeWhere((e) => e == '--disable-program-split');
} else {
if (!testDart2jsArgs2.contains('--disable-program-split')) {
testDart2jsArgs2.add('--disable-program-split');
}
}
}
var testArgs = <String>[
'--platform',
testPlatform,
if (testPauseAfterLoad) '--pause-after-load',
if (testDebug || showUI) '--debug',
if (testTimeout !=
Configuration.empty.suiteDefaults.metadata.timeout) ...[
'--timeout',
testTimeout.toString()
],
if (testIgnoreTimeouts) '--ignore-timeouts',
if (testRunSkipped) '--run-skipped',
if (testNoRetry) '--no-retry',
if (testReporter.isNotEmpty) ...['--reporter', testReporter],
if (testFileReporters.isNotEmpty)
...testFileReporters.entries
.expand((e) => ['--file-reporter', '${e.key}:${e.value}']),
if (jsonReportFilePath != null) ...[
'--file-reporter',
'json:$jsonReportFilePath'
],
if (includeTags.isNotEmpty) ...includeTags.expand((t) => ['-t', t]),
if (excludeTags.isNotEmpty) ...excludeTags.expand((t) => ['-x', t]),
if (testsNames.isNotEmpty)
...testsNames
.expand((p) => ['-n', p is RegExp ? p.pattern : p.toString()]),
if (testCoverage != null && testCoverage.isNotEmpty) ...[
'--coverage',
testCoverage
],
if (testJsTrace) '--js-trace',
if (testDart2jsArgs2.isNotEmpty) ...[
'--dart2js-args',
testDart2jsArgs2.join(' ')
],
...testsPaths
];
return testArgs;
}