diff --git a/bricks/test_optimizer/__brick__/test/.test_optimizer.dart b/bricks/test_optimizer/__brick__/test/.test_optimizer.dart index 2e9b4efe3..d2032c4e3 100644 --- a/bricks/test_optimizer/__brick__/test/.test_optimizer.dart +++ b/bricks/test_optimizer/__brick__/test/.test_optimizer.dart @@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; {{/tests}} void main() { {{#isFlutter}} goldenFileComparator = _TestOptimizationAwareGoldenFileComparator();{{/isFlutter}} -{{#tests}} group('{{#snakeCase}}{{{.}}}{{/snakeCase}}', () { {{#snakeCase}}{{{.}}}{{/snakeCase}}.main(); }); +{{#tests}} group('{{{.}}}', () { {{#snakeCase}}{{{.}}}{{/snakeCase}}.main(); }); {{/tests}}} {{#isFlutter}} diff --git a/lib/src/cli/cli.dart b/lib/src/cli/cli.dart index 2f98a8573..e1a3ac4de 100644 --- a/lib/src/cli/cli.dart +++ b/lib/src/cli/cli.dart @@ -1,12 +1,11 @@ import 'dart:async'; - +import 'package:collection/collection.dart'; import 'package:glob/glob.dart'; import 'package:lcov_parser/lcov_parser.dart'; import 'package:mason/mason.dart'; import 'package:meta/meta.dart'; import 'package:path/path.dart' as p; import 'package:pubspec_parse/pubspec_parse.dart'; -import 'package:stack_trace/stack_trace.dart'; import 'package:universal_io/io.dart'; import 'package:very_good_cli/src/commands/test/templates/test_optimizer_bundle.dart'; import 'package:very_good_test_runner/very_good_test_runner.dart'; diff --git a/lib/src/cli/flutter_cli.dart b/lib/src/cli/flutter_cli.dart index f4ee1cb60..f73d03453 100644 --- a/lib/src/cli/flutter_cli.dart +++ b/lib/src/cli/flutter_cli.dart @@ -1,5 +1,7 @@ part of 'cli.dart'; +const _testOptimizerFileName = '.test_optimizer.dart'; + /// Thrown when `flutter packages get` or `flutter pub get` /// is executed without a `pubspec.yaml`. class PubspecNotFound implements Exception {} @@ -207,14 +209,14 @@ class Flutter { '--test-randomize-ordering-seed', randomSeed ], - if (optimizePerformance) p.join('test', '.test_optimizer.dart') + if (optimizePerformance) p.join('test', _testOptimizerFileName) ], stdout: stdout ?? noop, stderr: stderr ?? noop, ), ).whenComplete(() { if (optimizePerformance) { - File(p.join(cwd, 'test', '.test_optimizer.dart')).delete().ignore(); + File(p.join(cwd, 'test', _testOptimizerFileName)).delete().ignore(); } }); }, @@ -321,14 +323,15 @@ Future _flutterTest({ final suites = {}; final groups = {}; final tests = {}; - final failedTestErrorMessages = {}; + final failedTestErrorMessages = >{}; var successCount = 0; var skipCount = 0; String computeStats() { final passingTests = successCount.formatSuccess(); - final failingTests = failedTestErrorMessages.length.formatFailure(); + final failingTests = + failedTestErrorMessages.values.expand((e) => e).length.formatFailure(); final skippedTests = skipCount.formatSkipped(); final result = [passingTests, failingTests, skippedTests] ..removeWhere((element) => element.isEmpty); @@ -375,16 +378,21 @@ Future _flutterTest({ if (event.stackTrace.trim().isNotEmpty) { stderr('$clearLine${event.stackTrace}'); } - - final traceLocation = _getTraceLocation(stackTrace: event.stackTrace); - - // When failing to recover the location from the stack trace, - // save a short description of the error - final testErrorDescription = traceLocation ?? - event.error.replaceAll('\n', ' ').truncated(_lineLength); - + final test = tests[event.testID]!; + final suite = suites[test.suiteID]!; final prefix = event.isFailure ? '[FAILED]' : '[ERROR]'; - failedTestErrorMessages[event.testID] = '$prefix $testErrorDescription'; + + final optimizationApplied = _isOptimizationApplied(suite); + final topGroupName = _topGroupName(test, groups); + final testPath = + _actualTestPath(optimizationApplied, suite.path!, topGroupName); + final testName = + _actualTestName(optimizationApplied, test.name, topGroupName); + final relativeTestPath = p.relative(testPath, from: cwd); + failedTestErrorMessages[relativeTestPath] = [ + ...failedTestErrorMessages[relativeTestPath] ?? [], + '$prefix $testName' + ]; } if (event is TestDoneEvent) { @@ -392,24 +400,30 @@ Future _flutterTest({ final test = tests[event.testID]!; final suite = suites[test.suiteID]!; + final optimizationApplied = _isOptimizationApplied(suite); + final firstGroupName = _topGroupName(test, groups); + final testPath = + _actualTestPath(optimizationApplied, suite.path!, firstGroupName); + final testName = + _actualTestName(optimizationApplied, test.name, firstGroupName); if (event.skipped) { stdout( - '''$clearLine${lightYellow.wrap('${test.name} ${suite.path} (SKIPPED)')}\n''', + '''$clearLine${lightYellow.wrap('$testName $testPath (SKIPPED)')}\n''', ); skipCount++; } else if (event.result == TestResult.success) { successCount++; } else { - stderr('$clearLine${test.name} ${suite.path} (FAILED)'); + stderr('$clearLine$testName $testPath (FAILED)'); } final timeElapsed = Duration(milliseconds: event.time).formatted(); final stats = computeStats(); - final testName = test.name.toSingleLine().truncated( + final truncatedTestName = testName.toSingleLine().truncated( _lineLength - (timeElapsed.length + stats.length + 2), ); - stdout('''$clearLine$timeElapsed $stats: $testName'''); + stdout('''$clearLine$timeElapsed $stats: $truncatedTestName'''); } if (event is DoneTestEvent) { @@ -430,9 +444,15 @@ Future _flutterTest({ final title = styleBold.wrap('Failing Tests:'); final lines = StringBuffer('$clearLine$title\n'); - for (final errorMessage in failedTestErrorMessages.values) { - lines.writeln('$clearLine - $errorMessage'); + for (final testSuiteErrorMessages + in failedTestErrorMessages.entries) { + lines.writeln('$clearLine - ${testSuiteErrorMessages.key} '); + + for (final errorMessage in testSuiteErrorMessages.value) { + lines.writeln('$clearLine \t- $errorMessage'); + } } + stderr(lines.toString()); } } @@ -456,6 +476,29 @@ Future _flutterTest({ return completer.future; } +bool _isOptimizationApplied(TestSuite suite) => + suite.path?.contains(_testOptimizerFileName) ?? false; + +String? _topGroupName(Test test, Map groups) => test.groupIDs + .map((groupID) => groups[groupID]?.name) + .firstWhereOrNull((groupName) => groupName?.isNotEmpty ?? false); + +String _actualTestPath( + bool optimizationApplied, + String path, + String? groupName, +) => + optimizationApplied + ? path.replaceFirst(_testOptimizerFileName, groupName!) + : path; + +String _actualTestName( + bool optimizationApplied, + String name, + String? topGroupName, +) => + optimizationApplied ? name.replaceFirst(topGroupName!, '').trim() : name; + final int _lineLength = () { try { return stdout.terminalColumns; @@ -508,22 +551,3 @@ extension on String { String toSingleLine() => replaceAll('\n', '').replaceAll(RegExp(r'\s\s+'), ' '); } - -String? _getTraceLocation({ - required String stackTrace, -}) { - final trace = Trace.parse(stackTrace); - if (trace.frames.isEmpty) { - return null; - } - - final lastFrame = trace.frames.last; - - final library = lastFrame.library; - final line = lastFrame.line; - final column = lastFrame.column; - - if (line == null) return library; - if (column == null) return '$library:$line'; - return '$library:$line:$column'; -} diff --git a/lib/src/commands/test/templates/test_optimizer_bundle.dart b/lib/src/commands/test/templates/test_optimizer_bundle.dart index 7598d6c0f..57e10ca1e 100644 --- a/lib/src/commands/test/templates/test_optimizer_bundle.dart +++ b/lib/src/commands/test/templates/test_optimizer_bundle.dart @@ -9,7 +9,7 @@ final testOptimizerBundle = MasonBundle.fromJson({ { "path": "test/.test_optimizer.dart", "data": - "Ly8gR0VORVJBVEVEIENPREUgLSBETyBOT1QgTU9ESUZZIEJZIEhBTkQKLy8gQ29uc2lkZXIgYWRkaW5nIHRoaXMgZmlsZSB0byB5b3VyIC5naXRpZ25vcmUuCgp7eyNpc0ZsdXR0ZXJ9fWltcG9ydCAnZGFydDppbyc7CgppbXBvcnQgJ3BhY2thZ2U6Zmx1dHRlcl90ZXN0L2ZsdXR0ZXJfdGVzdC5kYXJ0JzsKe3svaXNGbHV0dGVyfX17e15pc0ZsdXR0ZXJ9fWltcG9ydCAncGFja2FnZTp0ZXN0L3Rlc3QuZGFydCc7e3svaXNGbHV0dGVyfX0KCnt7I3Rlc3RzfX1pbXBvcnQgJ3t7ey59fX0nIGFzIHt7I3NuYWtlQ2FzZX19e3t7Ln19fXt7L3NuYWtlQ2FzZX19Owp7ey90ZXN0c319CnZvaWQgbWFpbigpIHsKe3sjaXNGbHV0dGVyfX0gIGdvbGRlbkZpbGVDb21wYXJhdG9yID0gX1Rlc3RPcHRpbWl6YXRpb25Bd2FyZUdvbGRlbkZpbGVDb21wYXJhdG9yKCk7e3svaXNGbHV0dGVyfX0Ke3sjdGVzdHN9fSAgZ3JvdXAoJ3t7I3NuYWtlQ2FzZX19e3t7Ln19fXt7L3NuYWtlQ2FzZX19JywgKCkgeyB7eyNzbmFrZUNhc2V9fXt7ey59fX17ey9zbmFrZUNhc2V9fS5tYWluKCk7IH0pOwp7ey90ZXN0c319fQoKe3sjaXNGbHV0dGVyfX0KY2xhc3MgX1Rlc3RPcHRpbWl6YXRpb25Bd2FyZUdvbGRlbkZpbGVDb21wYXJhdG9yIGV4dGVuZHMgTG9jYWxGaWxlQ29tcGFyYXRvciB7CiAgZmluYWwgTGlzdDxTdHJpbmc+IGdvbGRlbkZpbGVQYXRoczsKCiAgX1Rlc3RPcHRpbWl6YXRpb25Bd2FyZUdvbGRlbkZpbGVDb21wYXJhdG9yKCkKICAgICAgOiBnb2xkZW5GaWxlUGF0aHMgPSBfZ29sZGVuRmlsZVBhdGhzLAogICAgICAgIHN1cGVyKF90ZXN0RmlsZSk7CgogIHN0YXRpYyBVcmkgZ2V0IF90ZXN0RmlsZSB7CiAgICBmaW5hbCBiYXNlZGlyID0KICAgICAgICAoZ29sZGVuRmlsZUNvbXBhcmF0b3IgYXMgTG9jYWxGaWxlQ29tcGFyYXRvcikuYmFzZWRpci50b1N0cmluZygpOwogICAgcmV0dXJuIFVyaS5wYXJzZSgiJGJhc2VkaXIvLnRlc3Rfb3B0aW1pemVyLmRhcnQiKTsKICB9CgogIHN0YXRpYyBMaXN0PFN0cmluZz4gZ2V0IF9nb2xkZW5GaWxlUGF0aHMgPT4KICAgICAgRGlyZWN0b3J5LmZyb21VcmkoKGdvbGRlbkZpbGVDb21wYXJhdG9yIGFzIExvY2FsRmlsZUNvbXBhcmF0b3IpLmJhc2VkaXIpCiAgICAgICAgICAubGlzdFN5bmMocmVjdXJzaXZlOiB0cnVlLCBmb2xsb3dMaW5rczogdHJ1ZSkKICAgICAgICAgIC53aGVyZVR5cGU8RmlsZT4oKQogICAgICAgICAgLm1hcCgoZmlsZSkgPT4gZmlsZS5wYXRoKQogICAgICAgICAgLndoZXJlKChwYXRoKSA9PiBwYXRoLmVuZHNXaXRoKCcucG5nJykpCiAgICAgICAgICAudG9MaXN0KCk7CgogIEBvdmVycmlkZQogIFVyaSBnZXRUZXN0VXJpKFVyaSBrZXksIGludD8gdmVyc2lvbikgewogICAgZmluYWwga2V5U3RyaW5nID0ga2V5LnBhdGg7CiAgICByZXR1cm4gVXJpLnBhcnNlKGdvbGRlbkZpbGVQYXRocwogICAgICAgIC5zaW5nbGVXaGVyZSgoZ29sZGVuRmlsZVBhdGgpID0+IGdvbGRlbkZpbGVQYXRoLmVuZHNXaXRoKGtleVN0cmluZykpKTsKICB9Cn0Ke3svaXNGbHV0dGVyfX0=", + "Ly8gR0VORVJBVEVEIENPREUgLSBETyBOT1QgTU9ESUZZIEJZIEhBTkQKLy8gQ29uc2lkZXIgYWRkaW5nIHRoaXMgZmlsZSB0byB5b3VyIC5naXRpZ25vcmUuCgp7eyNpc0ZsdXR0ZXJ9fWltcG9ydCAnZGFydDppbyc7CgppbXBvcnQgJ3BhY2thZ2U6Zmx1dHRlcl90ZXN0L2ZsdXR0ZXJfdGVzdC5kYXJ0JzsKe3svaXNGbHV0dGVyfX17e15pc0ZsdXR0ZXJ9fWltcG9ydCAncGFja2FnZTp0ZXN0L3Rlc3QuZGFydCc7e3svaXNGbHV0dGVyfX0KCnt7I3Rlc3RzfX1pbXBvcnQgJ3t7ey59fX0nIGFzIHt7I3NuYWtlQ2FzZX19e3t7Ln19fXt7L3NuYWtlQ2FzZX19Owp7ey90ZXN0c319CnZvaWQgbWFpbigpIHsKe3sjaXNGbHV0dGVyfX0gIGdvbGRlbkZpbGVDb21wYXJhdG9yID0gX1Rlc3RPcHRpbWl6YXRpb25Bd2FyZUdvbGRlbkZpbGVDb21wYXJhdG9yKCk7e3svaXNGbHV0dGVyfX0Ke3sjdGVzdHN9fSAgZ3JvdXAoJ3t7ey59fX0nLCAoKSB7IHt7I3NuYWtlQ2FzZX19e3t7Ln19fXt7L3NuYWtlQ2FzZX19Lm1haW4oKTsgfSk7Cnt7L3Rlc3RzfX19Cgp7eyNpc0ZsdXR0ZXJ9fQpjbGFzcyBfVGVzdE9wdGltaXphdGlvbkF3YXJlR29sZGVuRmlsZUNvbXBhcmF0b3IgZXh0ZW5kcyBMb2NhbEZpbGVDb21wYXJhdG9yIHsKICBmaW5hbCBMaXN0PFN0cmluZz4gZ29sZGVuRmlsZVBhdGhzOwoKICBfVGVzdE9wdGltaXphdGlvbkF3YXJlR29sZGVuRmlsZUNvbXBhcmF0b3IoKQogICAgICA6IGdvbGRlbkZpbGVQYXRocyA9IF9nb2xkZW5GaWxlUGF0aHMsCiAgICAgICAgc3VwZXIoX3Rlc3RGaWxlKTsKCiAgc3RhdGljIFVyaSBnZXQgX3Rlc3RGaWxlIHsKICAgIGZpbmFsIGJhc2VkaXIgPQogICAgICAgIChnb2xkZW5GaWxlQ29tcGFyYXRvciBhcyBMb2NhbEZpbGVDb21wYXJhdG9yKS5iYXNlZGlyLnRvU3RyaW5nKCk7CiAgICByZXR1cm4gVXJpLnBhcnNlKCIkYmFzZWRpci8udGVzdF9vcHRpbWl6ZXIuZGFydCIpOwogIH0KCiAgc3RhdGljIExpc3Q8U3RyaW5nPiBnZXQgX2dvbGRlbkZpbGVQYXRocyA9PgogICAgICBEaXJlY3RvcnkuZnJvbVVyaSgoZ29sZGVuRmlsZUNvbXBhcmF0b3IgYXMgTG9jYWxGaWxlQ29tcGFyYXRvcikuYmFzZWRpcikKICAgICAgICAgIC5saXN0U3luYyhyZWN1cnNpdmU6IHRydWUsIGZvbGxvd0xpbmtzOiB0cnVlKQogICAgICAgICAgLndoZXJlVHlwZTxGaWxlPigpCiAgICAgICAgICAubWFwKChmaWxlKSA9PiBmaWxlLnBhdGgpCiAgICAgICAgICAud2hlcmUoKHBhdGgpID0+IHBhdGguZW5kc1dpdGgoJy5wbmcnKSkKICAgICAgICAgIC50b0xpc3QoKTsKCiAgQG92ZXJyaWRlCiAgVXJpIGdldFRlc3RVcmkoVXJpIGtleSwgaW50PyB2ZXJzaW9uKSB7CiAgICBmaW5hbCBrZXlTdHJpbmcgPSBrZXkucGF0aDsKICAgIHJldHVybiBVcmkucGFyc2UoZ29sZGVuRmlsZVBhdGhzCiAgICAgICAgLnNpbmdsZVdoZXJlKChnb2xkZW5GaWxlUGF0aCkgPT4gZ29sZGVuRmlsZVBhdGguZW5kc1dpdGgoa2V5U3RyaW5nKSkpOwogIH0KfQp7ey9pc0ZsdXR0ZXJ9fQ==", "type": "text" } ], diff --git a/pubspec.yaml b/pubspec.yaml index 71f80272b..bfa0f0bcd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,6 +9,7 @@ environment: dependencies: args: ^2.1.0 cli_completion: ^0.2.0 + collection: ^1.17.1 glob: ^2.0.2 lcov_parser: ^0.1.2 mason: ">=0.1.0-dev.41 <0.1.0-dev.42" @@ -22,6 +23,7 @@ dependencies: usage: ^4.0.2 very_good_test_runner: ^0.1.2 + dev_dependencies: build_runner: ^2.0.0 build_verify: ^3.0.0 diff --git a/test/fixtures/test_runner_fixtures.dart b/test/fixtures/test_runner_fixtures.dart index fdecdbb8a..50ca0bb79 100644 --- a/test/fixtures/test_runner_fixtures.dart +++ b/test/fixtures/test_runner_fixtures.dart @@ -407,1037 +407,1037 @@ const passingJsonOutput = [ {'success': true, 'type': 'done', 'time': 4015}, ]; -const failingJsonOutput = [ - { - 'protocolVersion': '0.1.1', - 'runnerVersion': '1.21.1', - 'pid': 70841, - 'type': 'start', - 'time': 0 - }, - { - 'suite': { - 'id': 0, - 'platform': 'vm', - 'path': '/my_app/test/app/view/app_test.dart' - }, - 'type': 'suite', - 'time': 0 - }, - { - 'test': { - 'id': 1, - 'name': 'loading /my_app/test/app/view/app_test.dart', - 'suiteID': 0, - 'groupIDs': [], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 2 - }, - { - 'suite': { - 'id': 2, - 'platform': 'vm', - 'path': '/my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'suite', - 'time': 8 - }, - { - 'test': { - 'id': 3, - 'name': 'loading /my_app/test/counter/cubit/counter_cubit_test.dart', - 'suiteID': 2, - 'groupIDs': [], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 8 - }, - { - 'suite': { - 'id': 4, - 'platform': 'vm', - 'path': '/my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'suite', - 'time': 10 - }, - { - 'test': { - 'id': 5, - 'name': 'loading /my_app/test/counter/view/counter_page_test.dart', - 'suiteID': 4, - 'groupIDs': [], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 10 - }, - {'count': 3, 'time': 10, 'type': 'allSuites'}, - { - 'testID': 1, - 'result': 'success', - 'skipped': false, - 'hidden': true, - 'type': 'testDone', - 'time': 10947 - }, - { - 'group': { - 'id': 6, - 'suiteID': 0, - 'parentID': null, - 'name': '', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 1, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'group', - 'time': 10953 - }, - { - 'group': { - 'id': 7, - 'suiteID': 0, - 'parentID': 6, - 'name': 'App', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 1, - 'line': 13, - 'column': 3, - 'url': 'file:///my_app/test/app/view/app_test.dart' - }, - 'type': 'group', - 'time': 10954 - }, - { - 'test': { - 'id': 8, - 'name': 'App renders CounterPage', - 'suiteID': 0, - 'groupIDs': [6, 7], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 14, - 'root_column': 5, - 'root_url': 'file:///my_app/test/app/view/app_test.dart' - }, - 'type': 'testStart', - 'time': 10954 - }, - { - 'testID': 3, - 'result': 'success', - 'skipped': false, - 'hidden': true, - 'type': 'testDone', - 'time': 11237 - }, - { - 'group': { - 'id': 9, - 'suiteID': 2, - 'parentID': null, - 'name': '', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 3, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'group', - 'time': 11238 - }, - { - 'group': { - 'id': 10, - 'suiteID': 2, - 'parentID': 9, - 'name': 'CounterCubit', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 3, - 'line': 14, - 'column': 3, - 'url': 'file:///my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'group', - 'time': 11238 - }, - { - 'test': { - 'id': 11, - 'name': 'CounterCubit initial state is 0', - 'suiteID': 2, - 'groupIDs': [9, 10], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 15, - 'column': 5, - 'url': 'file:///my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'testStart', - 'time': 11238 - }, - { - 'testID': 11, - 'error': 'Expected: <1>\n Actual: <0>\n', - 'stackTrace': - 'package:test_api expect\npackage:flutter_test/src/widget_tester.dart 455:16 expect\ntest/counter/cubit/counter_cubit_test.dart 16:7 main..\n', - 'isFailure': true, - 'type': 'error', - 'time': 11305 - }, - { - 'testID': 11, - 'result': 'failure', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 11306 - }, - { - 'test': { - 'id': 12, - 'name': 'CounterCubit emits [1] when increment is called', - 'suiteID': 2, - 'groupIDs': [9, 10], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 8, - 'url': 'package:bloc_test/src/bloc_test.dart', - 'root_line': 19, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'testStart', - 'time': 11306 - }, - { - 'testID': 12, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 11321 - }, - { - 'test': { - 'id': 13, - 'name': 'CounterCubit emits [-1] when decrement is called', - 'suiteID': 2, - 'groupIDs': [9, 10], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 8, - 'url': 'package:bloc_test/src/bloc_test.dart', - 'root_line': 26, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'testStart', - 'time': 11322 - }, - { - 'testID': 13, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 11326 - }, - { - 'testID': 5, - 'result': 'success', - 'skipped': false, - 'hidden': true, - 'type': 'testDone', - 'time': 11543 - }, - { - 'group': { - 'id': 14, - 'suiteID': 4, - 'parentID': null, - 'name': '', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 4, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'group', - 'time': 11543 - }, - { - 'group': { - 'id': 15, - 'suiteID': 4, - 'parentID': 14, - 'name': 'CounterPage', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 1, - 'line': 21, - 'column': 3, - 'url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'group', - 'time': 11544 - }, - { - 'test': { - 'id': 16, - 'name': 'CounterPage renders CounterView', - 'suiteID': 4, - 'groupIDs': [14, 15], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 22, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'testStart', - 'time': 11544 - }, - { - 'testID': 8, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 11990 - }, - { - 'testID': 16, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 12481 - }, - { - 'group': { - 'id': 17, - 'suiteID': 4, - 'parentID': 14, - 'name': 'CounterView', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 3, - 'line': 28, - 'column': 3, - 'url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'group', - 'time': 12481 - }, - { - 'test': { - 'id': 18, - 'name': 'CounterView renders current count', - 'suiteID': 4, - 'groupIDs': [14, 17], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 35, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'testStart', - 'time': 12481 - }, - { - 'testID': 18, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 12554 - }, - { - 'test': { - 'id': 19, - 'name': 'CounterView calls increment when increment button is tapped', - 'suiteID': 4, - 'groupIDs': [14, 17], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 47, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'testStart', - 'time': 12554 - }, - { - 'testID': 19, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 12684 - }, - { - 'test': { - 'id': 20, - 'name': 'CounterView calls decrement when decrement button is tapped', - 'suiteID': 4, - 'groupIDs': [14, 17], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 61, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'testStart', - 'time': 12684 - }, - { - 'testID': 20, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 12728 - }, - {'success': false, 'type': 'done', 'time': 12745}, -]; - -const skipExceptionMessageJsonOuput = [ - { - 'protocolVersion': '0.1.1', - 'runnerVersion': '1.21.1', - 'pid': 90255, - 'type': 'start', - 'time': 0 - }, - { - 'suite': { - 'id': 0, - 'platform': 'vm', - 'path': '/my_app/test/app/view/app_test.dart' - }, - 'type': 'suite', - 'time': 0 - }, - { - 'test': { - 'id': 1, - 'name': 'loading /my_app/test/app/view/app_test.dart', - 'suiteID': 0, - 'groupIDs': [], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 1 - }, - { - 'suite': { - 'id': 2, - 'platform': 'vm', - 'path': '/my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'suite', - 'time': 8 - }, - { - 'test': { - 'id': 3, - 'name': 'loading /my_app/test/counter/cubit/counter_cubit_test.dart', - 'suiteID': 2, - 'groupIDs': [], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 8 - }, - { - 'suite': { - 'id': 4, - 'platform': 'vm', - 'path': '/my_app/test/counter/view/long_name_test.dart' - }, - 'type': 'suite', - 'time': 9 - }, - { - 'test': { - 'id': 5, - 'name': 'loading /my_app/test/counter/view/long_name_test.dart', - 'suiteID': 4, - 'groupIDs': [], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 9 - }, - { - 'suite': { - 'id': 6, - 'platform': 'vm', - 'path': '/my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'suite', - 'time': 9 - }, - { - 'test': { - 'id': 7, - 'name': 'loading /my_app/test/counter/view/counter_page_test.dart', - 'suiteID': 6, - 'groupIDs': [], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 9 - }, - { - 'suite': { - 'id': 8, - 'platform': 'vm', - 'path': '/my_app/test/counter/view/other_test.dart' - }, - 'type': 'suite', - 'time': 10 - }, - { - 'test': { - 'id': 9, - 'name': 'loading /my_app/test/counter/view/other_test.dart', - 'suiteID': 8, - 'groupIDs': [], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 11 - }, - {'count': 5, 'time': 11, 'type': 'allSuites'}, - { - 'testID': 9, - 'result': 'success', - 'skipped': false, - 'hidden': true, - 'type': 'testDone', - 'time': 109 - }, - { - 'group': { - 'id': 10, - 'suiteID': 8, - 'parentID': null, - 'name': '', - 'metadata': { - 'skip': true, - 'skipReason': 'currently failing (see issue 1234)' - }, - 'testCount': 1, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'group', - 'time': 113 - }, - { - 'test': { - 'id': 11, - 'name': '(suite)', - 'suiteID': 8, - 'groupIDs': [10], - 'metadata': { - 'skip': true, - 'skipReason': 'currently failing (see issue 1234)' - }, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'testStart', - 'time': 113 - }, - { - 'testID': 11, - 'messageType': 'skip', - 'message': 'Skip: currently failing (see issue 1234)', - 'type': 'print', - 'time': 114 - }, - { - 'testID': 11, - 'result': 'success', - 'skipped': true, - 'hidden': false, - 'type': 'testDone', - 'time': 114 - }, - { - 'testID': 3, - 'result': 'success', - 'skipped': false, - 'hidden': true, - 'type': 'testDone', - 'time': 2724 - }, - { - 'group': { - 'id': 12, - 'suiteID': 2, - 'parentID': null, - 'name': '', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 3, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'group', - 'time': 2724 - }, - { - 'group': { - 'id': 13, - 'suiteID': 2, - 'parentID': 12, - 'name': 'CounterCubit', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 3, - 'line': 14, - 'column': 3, - 'url': 'file:///my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'group', - 'time': 2725 - }, - { - 'test': { - 'id': 14, - 'name': 'CounterCubit initial state is 0', - 'suiteID': 2, - 'groupIDs': [12, 13], - 'metadata': {'skip': true, 'skipReason': null}, - 'line': 15, - 'column': 5, - 'url': 'file:///my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'testStart', - 'time': 2725 - }, - { - 'testID': 14, - 'result': 'success', - 'skipped': true, - 'hidden': false, - 'type': 'testDone', - 'time': 2725 - }, - { - 'test': { - 'id': 15, - 'name': 'CounterCubit emits [1] when increment is called', - 'suiteID': 2, - 'groupIDs': [12, 13], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 8, - 'url': 'package:bloc_test/src/bloc_test.dart', - 'root_line': 23, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'testStart', - 'time': 2726 - }, - { - 'testID': 5, - 'result': 'success', - 'skipped': false, - 'hidden': true, - 'type': 'testDone', - 'time': 2757 - }, - { - 'group': { - 'id': 16, - 'suiteID': 4, - 'parentID': null, - 'name': '', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 1, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'group', - 'time': 2757 - }, - { - 'test': { - 'id': 17, - 'name': - 'this is a really long test name that should get truncated by very_good test', - 'suiteID': 4, - 'groupIDs': [16], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 4, - 'column': 3, - 'url': 'file:///my_app/test/counter/view/long_name_test.dart' - }, - 'type': 'testStart', - 'time': 2757 - }, - { - 'test': { - 'id': 29, - 'name': '''this is the case of a multiline test name that should ''' - ''' be well processed by very_good test ''', - 'suiteID': 4, - 'groupIDs': [16], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 4, - 'column': 3, - 'url': 'file:///my_app/test/counter/view/long_name_test.dart' - }, - 'type': 'testStart', - 'time': 2757 - }, - { - 'testID': 15, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 2789 - }, - { - 'test': { - 'id': 18, - 'name': 'CounterCubit emits [-1] when decrement is called', - 'suiteID': 2, - 'groupIDs': [12, 13], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 8, - 'url': 'package:bloc_test/src/bloc_test.dart', - 'root_line': 30, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/cubit/counter_cubit_test.dart' - }, - 'type': 'testStart', - 'time': 2789 - }, - { - 'testID': 18, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 2801 - }, - { - 'testID': 17, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 2813 - }, - { - 'testID': 1, - 'result': 'success', - 'skipped': false, - 'hidden': true, - 'type': 'testDone', - 'time': 2819 - }, - { - 'group': { - 'id': 19, - 'suiteID': 0, - 'parentID': null, - 'name': '', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 1, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'group', - 'time': 2820 - }, - { - 'group': { - 'id': 20, - 'suiteID': 0, - 'parentID': 19, - 'name': 'App', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 1, - 'line': 13, - 'column': 3, - 'url': 'file:///my_app/test/app/view/app_test.dart' - }, - 'type': 'group', - 'time': 2820 - }, - { - 'test': { - 'id': 21, - 'name': 'App renders CounterPage', - 'suiteID': 0, - 'groupIDs': [19, 20], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 14, - 'root_column': 5, - 'root_url': 'file:///my_app/test/app/view/app_test.dart' - }, - 'type': 'testStart', - 'time': 2820 - }, - { - 'testID': 7, - 'result': 'success', - 'skipped': false, - 'hidden': true, - 'type': 'testDone', - 'time': 3113 - }, - { - 'group': { - 'id': 22, - 'suiteID': 6, - 'parentID': null, - 'name': '', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 4, - 'line': null, - 'column': null, - 'url': null - }, - 'type': 'group', - 'time': 3113 - }, - { - 'group': { - 'id': 23, - 'suiteID': 6, - 'parentID': 22, - 'name': 'CounterPage', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 1, - 'line': 21, - 'column': 3, - 'url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'group', - 'time': 3113 - }, - { - 'test': { - 'id': 24, - 'name': 'CounterPage renders CounterView', - 'suiteID': 6, - 'groupIDs': [22, 23], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 22, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'testStart', - 'time': 3113 - }, - { - 'testID': 21, - 'messageType': 'print', - 'message': - '══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════\nThe following _Exception was thrown running a test:\nException: oops\n\nWhen the exception was thrown, this was the stack:\n#0 main.. (file:///my_app/test/app/view/app_test.dart:15:7)\n#1 main.. (file:///my_app/test/app/view/app_test.dart:14:40)\n#2 testWidgets.. (package:flutter_test/src/widget_tester.dart:170:29)\n\n\n(elided one frame from package:stack_trace)\n\nThe test description was:\n renders CounterPage\n════════════════════════════════════════════════════════════════════════════════════════════════════', - 'type': 'print', - 'time': 3142 - }, - { - 'testID': 21, - 'error': - 'Test failed. See exception logs above.\nThe test description was: renders CounterPage', - 'stackTrace': '', - 'isFailure': false, - 'type': 'error', - 'time': 3147 - }, - { - 'testID': 21, - 'result': 'error', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 3151 - }, - { - 'testID': 24, - 'messageType': 'print', - 'message': 'hello', - 'type': 'print', - 'time': 3341 - }, - { - 'testID': 24, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 4019 - }, - { - 'group': { - 'id': 25, - 'suiteID': 6, - 'parentID': 22, - 'name': 'CounterView', - 'metadata': {'skip': false, 'skipReason': null}, - 'testCount': 3, - 'line': 29, - 'column': 3, - 'url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'group', - 'time': 4019 - }, - { - 'test': { - 'id': 26, - 'name': 'CounterView renders current count', - 'suiteID': 6, - 'groupIDs': [22, 25], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 36, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'testStart', - 'time': 4020 - }, - { - 'testID': 26, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 4092 - }, - { - 'test': { - 'id': 27, - 'name': 'CounterView calls increment when increment button is tapped', - 'suiteID': 6, - 'groupIDs': [22, 25], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 51, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'testStart', - 'time': 4092 - }, - { - 'testID': 27, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 4212 - }, - { - 'test': { - 'id': 28, - 'name': 'CounterView calls decrement when decrement button is tapped', - 'suiteID': 6, - 'groupIDs': [22, 25], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 153, - 'column': 5, - 'url': 'package:flutter_test/src/widget_tester.dart', - 'root_line': 65, - 'root_column': 5, - 'root_url': 'file:///my_app/test/counter/view/counter_page_test.dart' - }, - 'type': 'testStart', - 'time': 4213 - }, - { - 'testID': 28, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 4248 - }, - { - 'test': { - 'id': 29, - 'name': '''this is the case of a multiline test name that should ''' - ''' be well processed by very_good test ''', - 'suiteID': 4, - 'groupIDs': [16], - 'metadata': {'skip': false, 'skipReason': null}, - 'line': 4, - 'column': 3, - 'url': 'file:///my_app/test/counter/view/multiline_test.dart' - }, - 'type': 'testStart', - 'time': 5440 - }, - { - 'testID': 29, - 'result': 'success', - 'skipped': false, - 'hidden': false, - 'type': 'testDone', - 'time': 5449 - }, - {'success': false, 'type': 'done', 'time': 5466}, -]; +List> failingJsonOutput(String cwd) => [ + { + 'protocolVersion': '0.1.1', + 'runnerVersion': '1.21.1', + 'pid': 70841, + 'type': 'start', + 'time': 0 + }, + { + 'suite': { + 'id': 0, + 'platform': 'vm', + 'path': '$cwd/test/app/view/app_test.dart' + }, + 'type': 'suite', + 'time': 0 + }, + { + 'test': { + 'id': 1, + 'name': 'loading /my_app/test/app/view/app_test.dart', + 'suiteID': 0, + 'groupIDs': [], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 2 + }, + { + 'suite': { + 'id': 2, + 'platform': 'vm', + 'path': '$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'suite', + 'time': 8 + }, + { + 'test': { + 'id': 3, + 'name': 'loading /my_app/test/counter/cubit/counter_cubit_test.dart', + 'suiteID': 2, + 'groupIDs': [], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 8 + }, + { + 'suite': { + 'id': 4, + 'platform': 'vm', + 'path': '$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'suite', + 'time': 10 + }, + { + 'test': { + 'id': 5, + 'name': 'loading /my_app/test/counter/view/counter_page_test.dart', + 'suiteID': 4, + 'groupIDs': [], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 10 + }, + {'count': 3, 'time': 10, 'type': 'allSuites'}, + { + 'testID': 1, + 'result': 'success', + 'skipped': false, + 'hidden': true, + 'type': 'testDone', + 'time': 10947 + }, + { + 'group': { + 'id': 6, + 'suiteID': 0, + 'parentID': null, + 'name': '', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 1, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'group', + 'time': 10953 + }, + { + 'group': { + 'id': 7, + 'suiteID': 0, + 'parentID': 6, + 'name': 'App', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 1, + 'line': 13, + 'column': 3, + 'url': 'file://$cwd/test/app/view/app_test.dart' + }, + 'type': 'group', + 'time': 10954 + }, + { + 'test': { + 'id': 8, + 'name': 'App renders CounterPage', + 'suiteID': 0, + 'groupIDs': [6, 7], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 14, + 'root_column': 5, + 'root_url': 'file://$cwd/test/app/view/app_test.dart' + }, + 'type': 'testStart', + 'time': 10954 + }, + { + 'testID': 3, + 'result': 'success', + 'skipped': false, + 'hidden': true, + 'type': 'testDone', + 'time': 11237 + }, + { + 'group': { + 'id': 9, + 'suiteID': 2, + 'parentID': null, + 'name': '', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 3, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'group', + 'time': 11238 + }, + { + 'group': { + 'id': 10, + 'suiteID': 2, + 'parentID': 9, + 'name': 'CounterCubit', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 3, + 'line': 14, + 'column': 3, + 'url': 'file://$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'group', + 'time': 11238 + }, + { + 'test': { + 'id': 11, + 'name': 'CounterCubit initial state is 0', + 'suiteID': 2, + 'groupIDs': [9, 10], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 15, + 'column': 5, + 'url': 'file://$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'testStart', + 'time': 11238 + }, + { + 'testID': 11, + 'error': 'Expected: <1>\n Actual: <0>\n', + 'stackTrace': + 'package:test_api expect\npackage:flutter_test/src/widget_tester.dart 455:16 expect\ntest/counter/cubit/counter_cubit_test.dart 16:7 main..\n', + 'isFailure': true, + 'type': 'error', + 'time': 11305 + }, + { + 'testID': 11, + 'result': 'failure', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 11306 + }, + { + 'test': { + 'id': 12, + 'name': 'CounterCubit emits [1] when increment is called', + 'suiteID': 2, + 'groupIDs': [9, 10], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 8, + 'url': 'package:bloc_test/src/bloc_test.dart', + 'root_line': 19, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'testStart', + 'time': 11306 + }, + { + 'testID': 12, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 11321 + }, + { + 'test': { + 'id': 13, + 'name': 'CounterCubit emits [-1] when decrement is called', + 'suiteID': 2, + 'groupIDs': [9, 10], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 8, + 'url': 'package:bloc_test/src/bloc_test.dart', + 'root_line': 26, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'testStart', + 'time': 11322 + }, + { + 'testID': 13, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 11326 + }, + { + 'testID': 5, + 'result': 'success', + 'skipped': false, + 'hidden': true, + 'type': 'testDone', + 'time': 11543 + }, + { + 'group': { + 'id': 14, + 'suiteID': 4, + 'parentID': null, + 'name': '', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 4, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'group', + 'time': 11543 + }, + { + 'group': { + 'id': 15, + 'suiteID': 4, + 'parentID': 14, + 'name': 'CounterPage', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 1, + 'line': 21, + 'column': 3, + 'url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'group', + 'time': 11544 + }, + { + 'test': { + 'id': 16, + 'name': 'CounterPage renders CounterView', + 'suiteID': 4, + 'groupIDs': [14, 15], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 22, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'testStart', + 'time': 11544 + }, + { + 'testID': 8, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 11990 + }, + { + 'testID': 16, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 12481 + }, + { + 'group': { + 'id': 17, + 'suiteID': 4, + 'parentID': 14, + 'name': 'CounterView', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 3, + 'line': 28, + 'column': 3, + 'url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'group', + 'time': 12481 + }, + { + 'test': { + 'id': 18, + 'name': 'CounterView renders current count', + 'suiteID': 4, + 'groupIDs': [14, 17], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 35, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'testStart', + 'time': 12481 + }, + { + 'testID': 18, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 12554 + }, + { + 'test': { + 'id': 19, + 'name': 'CounterView calls increment when increment button is tapped', + 'suiteID': 4, + 'groupIDs': [14, 17], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 47, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'testStart', + 'time': 12554 + }, + { + 'testID': 19, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 12684 + }, + { + 'test': { + 'id': 20, + 'name': 'CounterView calls decrement when decrement button is tapped', + 'suiteID': 4, + 'groupIDs': [14, 17], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 61, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'testStart', + 'time': 12684 + }, + { + 'testID': 20, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 12728 + }, + {'success': false, 'type': 'done', 'time': 12745}, + ]; + +List> skipExceptionMessageJsonOutput(String cwd) => [ + { + 'protocolVersion': '0.1.1', + 'runnerVersion': '1.21.1', + 'pid': 90255, + 'type': 'start', + 'time': 0 + }, + { + 'suite': { + 'id': 0, + 'platform': 'vm', + 'path': '$cwd/test/app/view/app_test.dart' + }, + 'type': 'suite', + 'time': 0 + }, + { + 'test': { + 'id': 1, + 'name': 'loading $cwd/test/app/view/app_test.dart', + 'suiteID': 0, + 'groupIDs': [], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 1 + }, + { + 'suite': { + 'id': 2, + 'platform': 'vm', + 'path': '$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'suite', + 'time': 8 + }, + { + 'test': { + 'id': 3, + 'name': 'loading $cwd/test/counter/cubit/counter_cubit_test.dart', + 'suiteID': 2, + 'groupIDs': [], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 8 + }, + { + 'suite': { + 'id': 4, + 'platform': 'vm', + 'path': '$cwd/test/counter/view/long_name_test.dart' + }, + 'type': 'suite', + 'time': 9 + }, + { + 'test': { + 'id': 5, + 'name': 'loading $cwd/test/counter/view/long_name_test.dart', + 'suiteID': 4, + 'groupIDs': [], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 9 + }, + { + 'suite': { + 'id': 6, + 'platform': 'vm', + 'path': '$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'suite', + 'time': 9 + }, + { + 'test': { + 'id': 7, + 'name': 'loading $cwd/test/counter/view/counter_page_test.dart', + 'suiteID': 6, + 'groupIDs': [], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 9 + }, + { + 'suite': { + 'id': 8, + 'platform': 'vm', + 'path': '$cwd/test/counter/view/other_test.dart' + }, + 'type': 'suite', + 'time': 10 + }, + { + 'test': { + 'id': 9, + 'name': 'loading $cwd/test/counter/view/other_test.dart', + 'suiteID': 8, + 'groupIDs': [], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 11 + }, + {'count': 5, 'time': 11, 'type': 'allSuites'}, + { + 'testID': 9, + 'result': 'success', + 'skipped': false, + 'hidden': true, + 'type': 'testDone', + 'time': 109 + }, + { + 'group': { + 'id': 10, + 'suiteID': 8, + 'parentID': null, + 'name': '', + 'metadata': { + 'skip': true, + 'skipReason': 'currently failing (see issue 1234)' + }, + 'testCount': 1, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'group', + 'time': 113 + }, + { + 'test': { + 'id': 11, + 'name': '(suite)', + 'suiteID': 8, + 'groupIDs': [10], + 'metadata': { + 'skip': true, + 'skipReason': 'currently failing (see issue 1234)' + }, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'testStart', + 'time': 113 + }, + { + 'testID': 11, + 'messageType': 'skip', + 'message': 'Skip: currently failing (see issue 1234)', + 'type': 'print', + 'time': 114 + }, + { + 'testID': 11, + 'result': 'success', + 'skipped': true, + 'hidden': false, + 'type': 'testDone', + 'time': 114 + }, + { + 'testID': 3, + 'result': 'success', + 'skipped': false, + 'hidden': true, + 'type': 'testDone', + 'time': 2724 + }, + { + 'group': { + 'id': 12, + 'suiteID': 2, + 'parentID': null, + 'name': '', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 3, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'group', + 'time': 2724 + }, + { + 'group': { + 'id': 13, + 'suiteID': 2, + 'parentID': 12, + 'name': 'CounterCubit', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 3, + 'line': 14, + 'column': 3, + 'url': 'file://$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'group', + 'time': 2725 + }, + { + 'test': { + 'id': 14, + 'name': 'CounterCubit initial state is 0', + 'suiteID': 2, + 'groupIDs': [12, 13], + 'metadata': {'skip': true, 'skipReason': null}, + 'line': 15, + 'column': 5, + 'url': 'file://$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'testStart', + 'time': 2725 + }, + { + 'testID': 14, + 'result': 'success', + 'skipped': true, + 'hidden': false, + 'type': 'testDone', + 'time': 2725 + }, + { + 'test': { + 'id': 15, + 'name': 'CounterCubit emits [1] when increment is called', + 'suiteID': 2, + 'groupIDs': [12, 13], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 8, + 'url': 'package:bloc_test/src/bloc_test.dart', + 'root_line': 23, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'testStart', + 'time': 2726 + }, + { + 'testID': 5, + 'result': 'success', + 'skipped': false, + 'hidden': true, + 'type': 'testDone', + 'time': 2757 + }, + { + 'group': { + 'id': 16, + 'suiteID': 4, + 'parentID': null, + 'name': '', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 1, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'group', + 'time': 2757 + }, + { + 'test': { + 'id': 17, + 'name': + 'this is a really long test name that should get truncated by very_good test', + 'suiteID': 4, + 'groupIDs': [16], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 4, + 'column': 3, + 'url': 'file://$cwd/test/counter/view/long_name_test.dart' + }, + 'type': 'testStart', + 'time': 2757 + }, + { + 'test': { + 'id': 29, + 'name': '''this is the case of a multiline test name that should ''' + ''' be well processed by very_good test ''', + 'suiteID': 4, + 'groupIDs': [16], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 4, + 'column': 3, + 'url': 'file://$cwd/test/counter/view/long_name_test.dart' + }, + 'type': 'testStart', + 'time': 2757 + }, + { + 'testID': 15, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 2789 + }, + { + 'test': { + 'id': 18, + 'name': 'CounterCubit emits [-1] when decrement is called', + 'suiteID': 2, + 'groupIDs': [12, 13], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 8, + 'url': 'package:bloc_test/src/bloc_test.dart', + 'root_line': 30, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/cubit/counter_cubit_test.dart' + }, + 'type': 'testStart', + 'time': 2789 + }, + { + 'testID': 18, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 2801 + }, + { + 'testID': 17, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 2813 + }, + { + 'testID': 1, + 'result': 'success', + 'skipped': false, + 'hidden': true, + 'type': 'testDone', + 'time': 2819 + }, + { + 'group': { + 'id': 19, + 'suiteID': 0, + 'parentID': null, + 'name': '', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 1, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'group', + 'time': 2820 + }, + { + 'group': { + 'id': 20, + 'suiteID': 0, + 'parentID': 19, + 'name': 'App', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 1, + 'line': 13, + 'column': 3, + 'url': 'file://$cwd/test/app/view/app_test.dart' + }, + 'type': 'group', + 'time': 2820 + }, + { + 'test': { + 'id': 21, + 'name': 'App renders CounterPage', + 'suiteID': 0, + 'groupIDs': [19, 20], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 14, + 'root_column': 5, + 'root_url': 'file://$cwd/test/app/view/app_test.dart' + }, + 'type': 'testStart', + 'time': 2820 + }, + { + 'testID': 7, + 'result': 'success', + 'skipped': false, + 'hidden': true, + 'type': 'testDone', + 'time': 3113 + }, + { + 'group': { + 'id': 22, + 'suiteID': 6, + 'parentID': null, + 'name': '', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 4, + 'line': null, + 'column': null, + 'url': null + }, + 'type': 'group', + 'time': 3113 + }, + { + 'group': { + 'id': 23, + 'suiteID': 6, + 'parentID': 22, + 'name': 'CounterPage', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 1, + 'line': 21, + 'column': 3, + 'url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'group', + 'time': 3113 + }, + { + 'test': { + 'id': 24, + 'name': 'CounterPage renders CounterView', + 'suiteID': 6, + 'groupIDs': [22, 23], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 22, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'testStart', + 'time': 3113 + }, + { + 'testID': 21, + 'messageType': 'print', + 'message': + '══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════\nThe following _Exception was thrown running a test:\nException: oops\n\nWhen the exception was thrown, this was the stack:\n#0 main.. (file://$cwd/test/app/view/app_test.dart:15:7)\n#1 main.. (file://$cwd/test/app/view/app_test.dart:14:40)\n#2 testWidgets.. (package:flutter_test/src/widget_tester.dart:170:29)\n\n\n(elided one frame from package:stack_trace)\n\nThe test description was:\n renders CounterPage\n════════════════════════════════════════════════════════════════════════════════════════════════════', + 'type': 'print', + 'time': 3142 + }, + { + 'testID': 21, + 'error': + 'Test failed. See exception logs above.\nThe test description was: renders CounterPage', + 'stackTrace': '', + 'isFailure': false, + 'type': 'error', + 'time': 3147 + }, + { + 'testID': 21, + 'result': 'error', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 3151 + }, + { + 'testID': 24, + 'messageType': 'print', + 'message': 'hello', + 'type': 'print', + 'time': 3341 + }, + { + 'testID': 24, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 4019 + }, + { + 'group': { + 'id': 25, + 'suiteID': 6, + 'parentID': 22, + 'name': 'CounterView', + 'metadata': {'skip': false, 'skipReason': null}, + 'testCount': 3, + 'line': 29, + 'column': 3, + 'url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'group', + 'time': 4019 + }, + { + 'test': { + 'id': 26, + 'name': 'CounterView renders current count', + 'suiteID': 6, + 'groupIDs': [22, 25], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 36, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'testStart', + 'time': 4020 + }, + { + 'testID': 26, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 4092 + }, + { + 'test': { + 'id': 27, + 'name': 'CounterView calls increment when increment button is tapped', + 'suiteID': 6, + 'groupIDs': [22, 25], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 51, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'testStart', + 'time': 4092 + }, + { + 'testID': 27, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 4212 + }, + { + 'test': { + 'id': 28, + 'name': 'CounterView calls decrement when decrement button is tapped', + 'suiteID': 6, + 'groupIDs': [22, 25], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 153, + 'column': 5, + 'url': 'package:flutter_test/src/widget_tester.dart', + 'root_line': 65, + 'root_column': 5, + 'root_url': 'file://$cwd/test/counter/view/counter_page_test.dart' + }, + 'type': 'testStart', + 'time': 4213 + }, + { + 'testID': 28, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 4248 + }, + { + 'test': { + 'id': 29, + 'name': '''this is the case of a multiline test name that should ''' + ''' be well processed by very_good test ''', + 'suiteID': 4, + 'groupIDs': [16], + 'metadata': {'skip': false, 'skipReason': null}, + 'line': 4, + 'column': 3, + 'url': 'file://$cwd/test/counter/view/multiline_test.dart' + }, + 'type': 'testStart', + 'time': 5440 + }, + { + 'testID': 29, + 'result': 'success', + 'skipped': false, + 'hidden': false, + 'type': 'testDone', + 'time': 5449 + }, + {'success': false, 'type': 'done', 'time': 5466}, + ]; diff --git a/test/src/cli/flutter_cli_test.dart b/test/src/cli/flutter_cli_test.dart index dc5131f4c..f84c469e2 100644 --- a/test/src/cli/flutter_cli_test.dart +++ b/test/src/cli/flutter_cli_test.dart @@ -90,7 +90,10 @@ void main() { test('throws when there is no pubspec.yaml', () { ProcessOverrides.runZoned( () => expectLater( - Flutter.packagesGet(cwd: Directory.systemTemp.path, logger: logger), + Flutter.packagesGet( + cwd: Directory.systemTemp.path, + logger: logger, + ), throwsA(isA()), ), runProcess: process.run, @@ -113,7 +116,10 @@ void main() { ProcessOverrides.runZoned( () => expectLater( - Flutter.packagesGet(cwd: Directory.systemTemp.path, logger: logger), + Flutter.packagesGet( + cwd: Directory.systemTemp.path, + logger: logger, + ), throwsException, ), runProcess: process.run, @@ -361,7 +367,9 @@ void main() { controller ..add(const DoneTestEvent(success: true, time: 0)) - ..add(const ExitTestEvent(exitCode: 0, time: 0)); + ..add( + const ExitTestEvent(exitCode: 0, time: 0), + ); await Future.delayed(Duration.zero); @@ -466,7 +474,7 @@ void main() { stderr: stderrLogs.add, testRunner: testRunner( Stream.fromIterable([ - ...failingJsonOutput.map(TestEvent.fromJson), + ...failingJsonOutput(directory.path).map(TestEvent.fromJson), const ExitTestEvent(exitCode: 1, time: 0), ]), ), @@ -498,9 +506,10 @@ void main() { '''\x1B[2K\rpackage:test_api expect\n''' 'package:flutter_test/src/widget_tester.dart 455:16 expect\n' 'test/counter/cubit/counter_cubit_test.dart 16:7 main..\n', - '\x1B[2K\rCounterCubit initial state is 0 /my_app/test/counter/cubit/counter_cubit_test.dart (FAILED)', + '\x1B[2K\rCounterCubit initial state is 0 ${directory.path}/test/counter/cubit/counter_cubit_test.dart (FAILED)', '\x1B[2K\rFailing Tests:\n' - '\x1B[2K\r - [FAILED] test/counter/cubit/counter_cubit_test.dart:16:7\n' + '\x1B[2K\r - test/counter/cubit/counter_cubit_test.dart \n' + '\x1B[2K\r \t- [FAILED] CounterCubit initial state is 0\n', ], ), ); @@ -518,7 +527,8 @@ void main() { stderr: stderrLogs.add, testRunner: testRunner( Stream.fromIterable([ - ...skipExceptionMessageJsonOuput.map(TestEvent.fromJson), + ...skipExceptionMessageJsonOutput(directory.path) + .map(TestEvent.fromJson), const ExitTestEvent(exitCode: 0, time: 0), ]), ), @@ -531,9 +541,9 @@ void main() { equals([ 'Running "flutter test" in ${p.dirname(directory.path)}...\n', '\x1B[2K\rSkip: currently failing (see issue 1234)\n', - '\x1B[2K\r(suite) /my_app/test/counter/view/other_test.dart (SKIPPED)\n', + '\x1B[2K\r(suite) ${directory.path}/test/counter/view/other_test.dart (SKIPPED)\n', '\x1B[2K\r00:00 ~1: (suite)', - '\x1B[2K\rCounterCubit initial state is 0 /my_app/test/counter/cubit/counter_cubit_test.dart (SKIPPED)\n', + '\x1B[2K\rCounterCubit initial state is 0 ${directory.path}/test/counter/cubit/counter_cubit_test.dart (SKIPPED)\n', '\x1B[2K\r00:02 ~2: CounterCubit initial state is 0', '''\x1B[2K\r00:02 +1 ~2: CounterCubit emits [1] when increment is called''', '''\x1B[2K\r00:02 +2 ~2: CounterCubit emits [-1] when decrement is called''', @@ -556,8 +566,8 @@ void main() { 'Exception: oops\n' '\n' 'When the exception was thrown, this was the stack:\n' - '#0 main.. (file:///my_app/test/app/view/app_test.dart:15:7)\n' - '#1 main.. (file:///my_app/test/app/view/app_test.dart:14:40)\n' + '#0 main.. (file://${directory.path}/test/app/view/app_test.dart:15:7)\n' + '#1 main.. (file://${directory.path}/test/app/view/app_test.dart:14:40)\n' '#2 testWidgets.. (package:flutter_test/src/widget_tester.dart:170:29)\n' '\n' '\n' @@ -568,9 +578,10 @@ void main() { '''════════════════════════════════════════════════════════════════════════════════════════════════════''', '\x1B[2K\rTest failed. See exception logs above.\n' 'The test description was: renders CounterPage', - '\x1B[2K\rApp renders CounterPage /my_app/test/app/view/app_test.dart (FAILED)', + '\x1B[2K\rApp renders CounterPage ${directory.path}/test/app/view/app_test.dart (FAILED)', '\x1B[2K\rFailing Tests:\n' - '''\x1B[2K\r - [ERROR] ...failed. See exception logs above. The test description was: renders CounterPage\n''' + '\x1B[2K\r - test/app/view/app_test.dart \n' + '\x1B[2K\r \t- [ERROR] App renders CounterPage\n', ]), ); directory.delete(recursive: true).ignore(); @@ -610,6 +621,36 @@ void main() { stderr: stderrLogs.add, testRunner: testRunner( Stream.fromIterable([ + SuiteTestEvent( + suite: TestSuite( + id: 4, + platform: 'vm', + path: '${directory.path}/test/app/view/app_test.dart', + ), + time: 0, + ), + GroupTestEvent( + group: TestGroup( + id: 10, + suiteID: 4, + name: 'CounterCubit', + metadata: TestMetadata( + skip: false, + ), + testCount: 1, + ), + time: 0, + ), + TestStartEvent( + test: Test( + id: 0, + name: 'CounterCubit emits [1] when increment is called', + suiteID: 4, + groupIDs: [10], + metadata: TestMetadata(skip: false), + ), + time: 0, + ), ErrorTestEvent( testID: 0, error: 'error', @@ -633,7 +674,8 @@ void main() { '\x1B[2K\rerror', '\x1B[2K\rtest/example_test.dart 4 main\n', '\x1B[2K\rFailing Tests:\n' - '\x1B[2K\r - [FAILED] test/example_test.dart:4\n' + '\x1B[2K\r - test/app/view/app_test.dart \n' + '''\x1B[2K\r \t- [FAILED] CounterCubit emits [1] when increment is called\n''' ]), ); directory.delete(recursive: true).ignore(); @@ -973,6 +1015,90 @@ void main() { verify(() => progress.complete()).called(1); directory.delete(recursive: true).ignore(); }); + + test('runs tests w/optimizations (failing)', () async { + final directory = Directory.systemTemp.createTempSync(); + File(p.join(directory.path, 'pubspec.yaml')).createSync(); + Directory(p.join(directory.path, 'test')).createSync(); + await expectLater( + Flutter.test( + cwd: directory.path, + stdout: stdoutLogs.add, + stderr: stderrLogs.add, + testRunner: testRunner( + Stream.fromIterable([ + SuiteTestEvent( + suite: TestSuite( + id: 4, + platform: 'vm', + path: '${directory.path}/test/.test_optimizer.dart', + ), + time: 0, + ), + GroupTestEvent( + group: TestGroup( + id: 10, + suiteID: 4, + name: 'app/view/app_test.dart', + metadata: TestMetadata( + skip: false, + ), + testCount: 1, + ), + time: 0, + ), + GroupTestEvent( + group: TestGroup( + id: 99, + suiteID: 4, + name: 'app/view/app_test.dart CounterCubit', + metadata: TestMetadata( + skip: false, + ), + testCount: 1, + ), + time: 0, + ), + TestStartEvent( + test: Test( + id: 0, + name: + 'app/view/app_test.dart CounterCubit emits [1] when increment is called', + suiteID: 4, + groupIDs: [10, 99], + metadata: TestMetadata(skip: false), + ), + time: 0, + ), + ErrorTestEvent( + testID: 0, + error: 'error', + stackTrace: + stack_trace.Trace.parse('test/example_test.dart 4 main') + .toString(), + isFailure: true, + time: 0, + ), + const DoneTestEvent(success: false, time: 0), + const ExitTestEvent(exitCode: 1, time: 0), + ]), + ), + logger: logger, + ), + completion(equals([ExitCode.unavailable.code])), + ); + expect( + stderrLogs, + equals([ + '\x1B[2K\rerror', + '\x1B[2K\rtest/example_test.dart 4 main\n', + '\x1B[2K\rFailing Tests:\n' + '\x1B[2K\r - test/app/view/app_test.dart \n' + '''\x1B[2K\r \t- [FAILED] CounterCubit emits [1] when increment is called\n''' + ]), + ); + directory.delete(recursive: true).ignore(); + }); }); }); }