failed property

List<Map<String, Object?>> get failed

Every scenario that came back red, and every package that could not run at all, as one flat list — what a script reads instead of walking every package's every scenario to find the one that failed.

Each entry names its package and, for a scenario, its file, its scenario and the first line of its first error; a package that did not run has only package and error. Derived, like ok, and written into run.json beside it for the same reason.

Implementation

List<Map<String, Object?>> get failed => [
  for (var package in packages) ...[
    if (package.error case var error?)
      {'package': package.path, 'error': _firstLine(error)},
    for (var scenario in package.scenarios)
      if (!scenario.ok)
        {
          'package': package.path,
          'file': scenario.file,
          'scenario': scenario.name,
          if (scenario.errors.firstOrNull case var error?)
            'error': _firstLine(error.error),
        },
  ],
];