run method

  1. @override
void run()
override

Runs this command.

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

Implementation

@override
void run() async {
  final String? feature = argResults?['feature'];

  if (feature != null && !feature.contains('/')) {
    String workingDirectory = join(current);
    switch (feature) {
      case 'core':
        workingDirectory = join(current, 'core');
        break;
      case 'assets':
        workingDirectory = join(current, 'assets');
        break;
      case 'asset':
        workingDirectory = join(current, 'assets');
        break;
      case 'main':
        workingDirectory = current;
        break;
      default:
        workingDirectory = join(current, 'features', feature);
    }
    await FlutterHelper.start('test', workingDirectory: workingDirectory);
  } else if (feature != null && feature.contains('/')) {
    await FlutterHelper.start('test', workingDirectory: feature);
  } else {
    final argMorphemeYaml = argResults.getOptionMorphemeYaml();

    YamlHelper.validateMorphemeYaml(argMorphemeYaml);
    final yaml = YamlHelper.loadFileYaml(argMorphemeYaml);

    await ModularHelper.test(concurrent: yaml.concurrent);
  }

  StatusHelper.success('morpheme test');
}