@@ -19,6 +19,8 @@ const expectedTestUsage = [
1919 '''-r, --recursive Run tests recursively for all nested packages.\n '''
2020 ''' --[no-]optimization Whether to apply optimizations for test performance.\n '''
2121 ' (defaults to on)\n '
22+ '''-j, --concurrency The number of concurrent test suites run.\n '''
23+ ' (defaults to "4")\n '
2224 ''' --exclude-coverage A glob which will be used to exclude files that match from the coverage.\n '''
2325 '''-x, --exclude-tags Run only tests that do not have the specified tags.\n '''
2426 ''' --min-coverage Whether to enforce a minimum coverage percentage.\n '''
@@ -54,7 +56,8 @@ class MockFlutterTestCommand extends Mock implements FlutterTestCommand {}
5456void main () {
5557 group ('test' , () {
5658 final cwd = Directory .current;
57- const defaultArguments = ['--no-pub' ];
59+ const concurrency = '4' ;
60+ const defaultArguments = ['-j' , concurrency, '--no-pub' ];
5861
5962 late Logger logger;
6063 late bool isFlutterInstalled;
@@ -88,6 +91,7 @@ void main() {
8891 stderr: any (named: 'stderr' ),
8992 ),
9093 ).thenAnswer ((_) async => [0 ]);
94+ when < dynamic > (() => argResults['concurrency' ]).thenReturn (concurrency);
9195 when < dynamic > (() => argResults['recursive' ]).thenReturn (false );
9296 when < dynamic > (() => argResults['coverage' ]).thenReturn (false );
9397 when < dynamic > (() => argResults['update-goldens' ]).thenReturn (false );
@@ -189,6 +193,21 @@ void main() {
189193 ).called (1 );
190194 });
191195
196+ test ('completes normally --concurrency 1' , () async {
197+ when < dynamic > (() => argResults['concurrency' ]).thenReturn ('1' );
198+ final result = await testCommand.run ();
199+ expect (result, equals (ExitCode .success.code));
200+ verify (
201+ () => flutterTest (
202+ arguments: ['-j' , '1' , '--no-pub' ],
203+ optimizePerformance: true ,
204+ progress: logger.progress,
205+ stdout: logger.write,
206+ stderr: logger.err,
207+ ),
208+ ).called (1 );
209+ });
210+
192211 test ('completes normally --no-optimization' , () async {
193212 when < dynamic > (() => argResults['optimization' ]).thenReturn (false );
194213 final result = await testCommand.run ();
0 commit comments