selectReport static method

String? selectReport(
  1. String output, {
  2. required bool jsonReport,
  3. required bool junitReport,
  4. required bool machineReport,
  5. required bool streamLiveOutput,
})

Returns the report selected by the same precedence as the CLI presenter.

Implementation

static String? selectReport(
  String output, {
  required bool jsonReport,
  required bool junitReport,
  required bool machineReport,
  required bool streamLiveOutput,
}) {
  final rawJson = extractJsonReport(output);
  final json = jsonReport ? rawJson : '';
  final junit = junitReport ? extractJunitReport(output) : '';
  if (junit.isNotEmpty) return junit;
  if (json.isNotEmpty) return json;
  if (machineReport) return null;
  final report = extractSuiteReport(
    output,
    includeScreenTracker: !streamLiveOutput,
  );
  return report.isEmpty ? null : report;
}