@@ -436,39 +436,39 @@ class TestCommand extends Command<bool> with ArgUtils {
436
436
'test' ,
437
437
));
438
438
439
- if (isUnitTestsScreenshotsAvailable) {
440
- // Separate screenshot tests from unit-tests. Screenshot tests must run
441
- // one at a time. Otherwise, they will end up screenshotting each other.
442
- // This is not an issue for unit-tests.
443
- final FilePath failureSmokeTestPath = FilePath .fromWebUi (
444
- 'test/golden_tests/golden_failure_smoke_test.dart' ,
445
- );
446
- final List <FilePath > screenshotTestFiles = < FilePath > [];
447
- final List <FilePath > unitTestFiles = < FilePath > [];
448
-
449
- for (io.File testFile
450
- in testDir.listSync (recursive: true ).whereType< io.File > ()) {
451
- final FilePath testFilePath = FilePath .fromCwd (testFile.path);
452
- if (! testFilePath.absolute.endsWith ('_test.dart' )) {
453
- // Not a test file at all. Skip.
454
- continue ;
455
- }
456
- if (testFilePath == failureSmokeTestPath) {
457
- // A smoke test that fails on purpose. Skip.
458
- continue ;
459
- }
439
+ // Separate screenshot tests from unit-tests. Screenshot tests must run
440
+ // one at a time. Otherwise, they will end up screenshotting each other.
441
+ // This is not an issue for unit-tests.
442
+ final FilePath failureSmokeTestPath = FilePath .fromWebUi (
443
+ 'test/golden_tests/golden_failure_smoke_test.dart' ,
444
+ );
445
+ final List <FilePath > screenshotTestFiles = < FilePath > [];
446
+ final List <FilePath > unitTestFiles = < FilePath > [];
447
+
448
+ for (io.File testFile
449
+ in testDir.listSync (recursive: true ).whereType< io.File > ()) {
450
+ final FilePath testFilePath = FilePath .fromCwd (testFile.path);
451
+ if (! testFilePath.absolute.endsWith ('_test.dart' )) {
452
+ // Not a test file at all. Skip.
453
+ continue ;
454
+ }
455
+ if (testFilePath == failureSmokeTestPath) {
456
+ // A smoke test that fails on purpose. Skip.
457
+ continue ;
458
+ }
460
459
461
- // All files under test/golden_tests are considered golden tests.
462
- final bool isUnderGoldenTestsDirectory = path.split (testFilePath.relativeToWebUi).contains ('golden_tests' );
463
- // Any file whose name ends with "_golden_test.dart" is run as a golden test.
464
- final bool isGoldenTestFile = path.basename (testFilePath.relativeToWebUi).endsWith ('_golden_test.dart' );
465
- if (isUnderGoldenTestsDirectory || isGoldenTestFile) {
466
- screenshotTestFiles.add (testFilePath);
467
- } else {
468
- unitTestFiles.add (testFilePath);
469
- }
460
+ // All files under test/golden_tests are considered golden tests.
461
+ final bool isUnderGoldenTestsDirectory = path.split (testFilePath.relativeToWebUi).contains ('golden_tests' );
462
+ // Any file whose name ends with "_golden_test.dart" is run as a golden test.
463
+ final bool isGoldenTestFile = path.basename (testFilePath.relativeToWebUi).endsWith ('_golden_test.dart' );
464
+ if (isUnderGoldenTestsDirectory || isGoldenTestFile) {
465
+ screenshotTestFiles.add (testFilePath);
466
+ } else {
467
+ unitTestFiles.add (testFilePath);
470
468
}
469
+ }
471
470
471
+ if (isUnitTestsScreenshotsAvailable) {
472
472
// This test returns a non-zero exit code on purpose. Run it separately.
473
473
if (io.Platform .environment['CIRRUS_CI' ] != 'true' ) {
474
474
await _runTestBatch (
@@ -478,11 +478,13 @@ class TestCommand extends Command<bool> with ArgUtils {
478
478
);
479
479
_checkExitCode ();
480
480
}
481
+ }
481
482
482
- // Run all unit-tests as a single batch.
483
- await _runTestBatch (unitTestFiles, concurrency: 10 , expectFailure: false );
484
- _checkExitCode ();
483
+ // Run all unit-tests as a single batch.
484
+ await _runTestBatch (unitTestFiles, concurrency: 10 , expectFailure: false );
485
+ _checkExitCode ();
485
486
487
+ if (isUnitTestsScreenshotsAvailable) {
486
488
// Run screenshot tests one at a time.
487
489
for (FilePath testFilePath in screenshotTestFiles) {
488
490
await _runTestBatch (
@@ -492,24 +494,6 @@ class TestCommand extends Command<bool> with ArgUtils {
492
494
);
493
495
_checkExitCode ();
494
496
}
495
- } else {
496
- final List <FilePath > unitTestFiles = < FilePath > [];
497
- for (io.File testFile
498
- in testDir.listSync (recursive: true ).whereType< io.File > ()) {
499
- final FilePath testFilePath = FilePath .fromCwd (testFile.path);
500
- if (! testFilePath.absolute.endsWith ('_test.dart' )) {
501
- // Not a test file at all. Skip.
502
- continue ;
503
- }
504
- if (! path
505
- .split (testFilePath.relativeToWebUi)
506
- .contains ('golden_tests' )) {
507
- unitTestFiles.add (testFilePath);
508
- }
509
- }
510
- // Run all unit-tests as a single batch.
511
- await _runTestBatch (unitTestFiles, concurrency: 10 , expectFailure: false );
512
- _checkExitCode ();
513
497
}
514
498
}
515
499
0 commit comments