File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ class TestCommand extends Command<int> {
50
50
help: 'Run tests recursively for all nested packages.' ,
51
51
negatable: false ,
52
52
)
53
+ ..addOption (
54
+ 'tags' ,
55
+ abbr: 't' ,
56
+ help: 'Run only tests associated with the specified tags.' ,
57
+ )
53
58
..addFlag (
54
59
'optimization' ,
55
60
defaultsTo: true ,
@@ -125,6 +130,7 @@ This command should be run from the root of your Flutter project.''',
125
130
_argResults['min-coverage' ] as String ? ?? '' ,
126
131
);
127
132
final excludeTags = _argResults['exclude-tags' ] as String ? ;
133
+ final tags = _argResults['tags' ] as String ? ;
128
134
final isFlutterInstalled = await _flutterInstalled ();
129
135
final excludeFromCoverage = _argResults['exclude-coverage' ] as String ? ;
130
136
final randomOrderingSeed =
@@ -150,6 +156,7 @@ This command should be run from the root of your Flutter project.''',
150
156
randomSeed: randomSeed,
151
157
arguments: [
152
158
if (excludeTags != null ) ...['-x' , excludeTags],
159
+ if (tags != null ) ...['-t' , tags],
153
160
if (updateGoldens) '--update-goldens' ,
154
161
...['-j' , concurrency],
155
162
'--no-pub' ,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ const expectedTestUsage = [
17
17
'-h, --help Print this usage information.\n '
18
18
''' --coverage Whether to collect coverage information.\n '''
19
19
'''-r, --recursive Run tests recursively for all nested packages.\n '''
20
+ '''-t, --tags Run only tests associated with the specified tags.\n '''
20
21
''' --[no-]optimization Whether to apply optimizations for test performance.\n '''
21
22
' (defaults to on)\n '
22
23
'''-j, --concurrency The number of concurrent test suites run.\n '''
@@ -290,6 +291,21 @@ void main() {
290
291
).called (1 );
291
292
});
292
293
294
+ test ('completes normally -t test-tag' , () async {
295
+ when < dynamic > (() => argResults['tags' ]).thenReturn ('test-tag' );
296
+ final result = await testCommand.run ();
297
+ expect (result, equals (ExitCode .success.code));
298
+ verify (
299
+ () => flutterTest (
300
+ optimizePerformance: true ,
301
+ arguments: ['-t' , 'test-tag' , ...defaultArguments],
302
+ progress: logger.progress,
303
+ stdout: logger.write,
304
+ stderr: logger.err,
305
+ ),
306
+ ).called (1 );
307
+ });
308
+
293
309
test ('completes normally -x test-tag' , () async {
294
310
when < dynamic > (() => argResults['exclude-tags' ]).thenReturn ('test-tag' );
295
311
final result = await testCommand.run ();
You can’t perform that action at this time.
0 commit comments