testRunSummary function

List<String> testRunSummary(
  1. String report, {
  2. String? directory,
})

What a run of flutter test --reporter json wrote in report, for a log: its lines that are no events, such as what flutter says before the tests, and a line for each test that it shows, with its result, its test file, by its path in the app when it is in directory, and its name, followed by the first lines of the message of its first failure if it did not pass; see expectedFailureProblems.

Implementation

List<String> testRunSummary(String report, {String? directory}) {
  final run = _Run.parse(report);
  return [
    ...run.other,
    for (final test in run.tests)
      if (!test.hidden) ...[
        '${test.outcome}: ${_shown(test.path, directory)}: ${test.name}',
        if (test.result case final result? when result != _success)
          ..._indented(test.firstFailure?.message ?? result),
      ],
  ];
}