runMockitoCommand function

dynamic runMockitoCommand()

Implementation

runMockitoCommand() async {
  wtLog.startSpinner("Generating mocks");
  await Future.delayed(Duration(seconds: 1));
  final process = await Process.run(
      "dart", ["run", "build_runner", "build", "--delete-conflicting-outputs"],
      runInShell: true);

  if (process.exitCode != 0) {
    wtLog.stopSpinner(
        message: "Failed to generate mocks:",
        severity: MessageSeverity.Warning);
    wtLog.log(process.stderr);
    wtLog.log(
        'Note: You may also directly use the command `dart run build_runner build` to generate the mocks after fixing the above errors.');
  } else {
    wtLog.stopSpinner(
        message: 'Successfully generated mocks.',
        severity: MessageSeverity.Info);
  }
}