run method

  1. @override
Future<void> run()
override

Runs this command.

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

Implementation

@override
Future<void> run() async {
  final directory = Directory.current;

  final isFlutter = await _isFlutterProject(directory);
  final isDart = await _isDartProject(directory);
  final isReactNative = await _isReactNativeProject(directory);
  final isRuby = await _isRubyProject(directory);

  if (isFlutter) {
    await _runCommand('flutter', ['test']);
  } else if (isDart) {
    await _runCommand('dart', ['test']);
  } else if (isReactNative) {
    await _runCommand('npm', ['test']);
  } else if (isRuby) {
    await _runCommand('rspec', []);
  } else {
    stderr.writeln(
      'Could not detect project type or no test command available.',
    );
    exit(1);
  }
}