diff --git a/pkgs/test/test/runner/configuration/randomize_order_test.dart b/pkgs/test/test/runner/configuration/randomize_order_test.dart index 6aaf8c417..984cd0f81 100644 --- a/pkgs/test/test/runner/configuration/randomize_order_test.dart +++ b/pkgs/test/test/runner/configuration/randomize_order_test.dart @@ -74,6 +74,12 @@ void main() { 'Shuffling test order with --test-randomize-ordering-seed=0')) ])); await test.shouldExit(0); + + // Doesn't log about shuffling with the json reporter + test = await runTest( + ['test.dart', '--test-randomize-ordering-seed=random', '-r', 'json']); + expect(test.stdout, neverEmits(contains('Shuffling test order'))); + await test.shouldExit(0); }); test('shuffles each suite with the same seed', () async { diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md index 162069d33..d530d188c 100644 --- a/pkgs/test_core/CHANGELOG.md +++ b/pkgs/test_core/CHANGELOG.md @@ -3,6 +3,7 @@ * Remove support for `FORCE_TEST_EXIT`. * Report incomplete tests as errors in the JSON reporter when the run is canceled early. +* Don't log the --test-randomization-ordering-seed if using the json reporter. ## 0.3.29 diff --git a/pkgs/test_core/lib/src/runner/configuration/args.dart b/pkgs/test_core/lib/src/runner/configuration/args.dart index 102becee3..e81c632d6 100644 --- a/pkgs/test_core/lib/src/runner/configuration/args.dart +++ b/pkgs/test_core/lib/src/runner/configuration/args.dart @@ -223,12 +223,18 @@ class _Parser { } } + var reporter = _ifParsed('reporter') as String?; + var testRandomizeOrderingSeed = _parseOption('test-randomize-ordering-seed', (value) { var seed = value == 'random' ? Random().nextInt(4294967295) : int.parse(value).toUnsigned(32); - print('Shuffling test order with --test-randomize-ordering-seed=$seed'); + + // TODO(#1547): Less hacky way of not breaking the json reporter + if (reporter != 'json') { + print('Shuffling test order with --test-randomize-ordering-seed=$seed'); + } return seed; }); @@ -251,7 +257,7 @@ class _Parser { dart2jsPath: _ifParsed('dart2js-path'), dart2jsArgs: _ifParsed('dart2js-args'), precompiledPath: _ifParsed('precompiled'), - reporter: _ifParsed('reporter'), + reporter: reporter, fileReporters: _parseFileReporterOption(), coverage: _ifParsed('coverage'), pubServePort: _parseOption('pub-serve', int.parse),