run method

  1. @override
FutureOr<int> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
FutureOr<int> run() async {
  exitIfNotValidDartPackage();
  _reportGenerator = ReportGenerator(getPackageRoot());
  final bool shouldShardTests = argResults?['faster'] ?? false;
  runCoverage = argResults?['coverage'] ?? false;
  buildReport = argResults?['report'] ?? false;

  if (shouldShardTests) {
    final testShards = await _shardTests(3);
    await _runShards(testShards);
  } else {
    await generateTestBundle(packageRoot: getPackageRoot());
    return await _runTestBundle();
  }
  return 0;
}