@@ -436,39 +436,39 @@ class TestCommand extends Command<bool> with ArgUtils {
436436 'test' ,
437437 ));
438438
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+ }
460459
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);
470468 }
469+ }
471470
471+ if (isUnitTestsScreenshotsAvailable) {
472472 // This test returns a non-zero exit code on purpose. Run it separately.
473473 if (io.Platform .environment['CIRRUS_CI' ] != 'true' ) {
474474 await _runTestBatch (
@@ -478,11 +478,13 @@ class TestCommand extends Command<bool> with ArgUtils {
478478 );
479479 _checkExitCode ();
480480 }
481+ }
481482
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 ();
485486
487+ if (isUnitTestsScreenshotsAvailable) {
486488 // Run screenshot tests one at a time.
487489 for (FilePath testFilePath in screenshotTestFiles) {
488490 await _runTestBatch (
@@ -492,24 +494,6 @@ class TestCommand extends Command<bool> with ArgUtils {
492494 );
493495 _checkExitCode ();
494496 }
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 ();
513497 }
514498 }
515499
0 commit comments