exec method

  1. @override
Future<void> exec(
  1. ExecContext context
)
override

Run command.

The contents of katana.yaml and the arguments of the command are passed to context.

コマンドを実行します。

contextkatana.yamlの内容やコマンドの引数が渡されます。

Implementation

@override
Future<void> exec(ExecContext context) async {
  if (!Directory("${Directory.current.path}/test").existsSync()) {
    // ignore: avoid_print
    print("Skipping because the test directory was not found.");
    return;
  }
  final bin = context.yaml.getAsMap("bin");
  final flutter = bin.get("flutter", "flutter");
  final target = context.args.get(2, "");
  await command(
    "Update the golden test images.",
    [
      flutter,
      "test",
      "--update-goldens",
      "--dart-define=CI=true",
      "--dart-define-from-file=dart_defines/dev.env",
      if (target.isNotEmpty) ...[
        "--plain-name",
        target,
      ]
    ],
    catchError: true,
  );
}