diff --git a/lib/src/cli/flutter_cli.dart b/lib/src/cli/flutter_cli.dart index e8cc1ebd..2cece1af 100644 --- a/lib/src/cli/flutter_cli.dart +++ b/lib/src/cli/flutter_cli.dart @@ -398,19 +398,17 @@ Future _flutterTest({ var testPath = suite.path!; var testName = test.name; - if (optimizationApplied) { - // When there is a test error before any group is computed, it means - // that there is an error when compiling the test optimizer file. - if (groups.isNotEmpty) { - final topGroupName = _topGroupName(test, groups)!; - - testPath = testPath.replaceFirst( - _testOptimizerFileName, - topGroupName, - ); + // When there is a test error before any group is computed, it means + // that there is an error when compiling the test optimizer file. + if (optimizationApplied && groups.isNotEmpty) { + final topGroupName = _topGroupName(test, groups)!; - testName = testName.replaceFirst(topGroupName, '').trim(); - } + testPath = testPath.replaceFirst( + _testOptimizerFileName, + topGroupName, + ); + + testName = testName.replaceFirst(topGroupName, '').trim(); } final relativeTestPath = p.relative(testPath, from: cwd);