Pass --run-skipped through to package:test (#76133)

This commit is contained in:
Danny Tuppeny 2021-02-17 20:51:02 +00:00 committed by GitHub
parent 815976a8e4
commit 74b6ce9abb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 0 deletions

View file

@ -63,6 +63,10 @@ class TestCommand extends FlutterCommand {
'Instructions for connecting with a debugger are printed to the '
'console once the test has started.',
)
..addFlag('run-skipped',
defaultsTo: false,
help: 'Run skipped tests instead of skipping them.',
)
..addFlag('disable-service-auth-codes',
defaultsTo: false,
negatable: false,
@ -309,6 +313,7 @@ class TestCommand extends FlutterCommand {
randomSeed: stringArg('test-randomize-ordering-seed'),
reporter: stringArg('reporter'),
timeout: stringArg('timeout'),
runSkipped: boolArg('run-skipped'),
);
if (collector != null) {

View file

@ -50,6 +50,7 @@ abstract class FlutterTestRunner {
String randomSeed,
String reporter,
String timeout,
bool runSkipped = false,
});
}
@ -81,6 +82,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
String randomSeed,
String reporter,
String timeout,
bool runSkipped = false,
}) async {
// Configure package:test to use the Flutter engine for child processes.
final String shellPath = globals.artifacts.getArtifactPath(Artifact.flutterTester);
@ -108,6 +110,8 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
...<String>['--tags', tags],
if (excludeTags != null)
...<String>['--exclude-tags', excludeTags],
if (runSkipped)
'--run-skipped',
];
if (web) {
final String tempBuildDir = globals.fs.systemTempDirectory

View file

@ -106,6 +106,31 @@ void main() {
Cache: () => FakeCache(),
});
testUsingContext('Pipes run-skipped to package:test',
() async {
final FakePackageTest fakePackageTest = FakePackageTest();
final TestCommand testCommand = TestCommand(testWrapper: fakePackageTest);
final CommandRunner<void> commandRunner =
createTestCommandRunner(testCommand);
await commandRunner.run(const <String>[
'test',
'--no-pub',
'--run-skipped',
'--',
'test/fake_test.dart',
]);
expect(
fakePackageTest.lastArgs,
contains('--run-skipped'),
);
}, overrides: <Type, Generator>{
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
Cache: () => FakeCache(),
});
testUsingContext('Pipes enable-observatory', () async {
final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner(0);
@ -190,6 +215,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
@override List<String> extraFrontEndOptions,
String reporter,
String timeout,
bool runSkipped = false,
}) async {
lastEnableObservatoryValue = enableObservatory;
return exitCode;