testReporter method

Future<bool> testReporter(
  1. TestReport report
)

When running on a non-web platform this will write the report to the file system using the reportPath.

Implementation

Future<bool> testReporter(TestReport report) async {
  var result = false;
  if (kIsWeb) {
    _logger.warning(
      '[IoTestStore] -- testReader not supported on web',
    );
  } else {
    var path = reportPath;

    if (report.suiteName != null) {
      path = '$path/${report.suiteName}';
    }

    path = '$path/${report.name}.json';

    var encoder = JsonEncoder.withIndent('  ');
    var file = File(path);

    file.createSync(recursive: true);
    file.writeAsStringSync(encoder.convert(report.toJson()));
    _logger.info('[REPORT]: ${file.absolute.path}');
    result = true;
  }
  return result;
}