build method

Future<void> build()

Implementation

Future<void> build() async {
  await _findMethodStyleStepRunners();
  await _findClassStyleStepRunners();

  if (steps.isNotEmpty) {
    await findHooks(Before, namedBeforeTagHooks, beforeScenarioHooks);
    await findHooks(After, namedAfterTagHooks, afterScenarioHooks);
    await findHooks(BeforeStep, namedBeforeStepHooks, beforeStepGlobalHooks);
    await findHooks(AfterStep, namedAfterStepHooks, afterStepGlobalHooks);
  }

  if (formatters.isEmpty) {
    if (Platform.environment['CUCUMBER'] != null) {
      formatters.add(IntellijFormatter(resultBuffer));
    } else {
      formatters.add(BasicFormatter(resultBuffer));
    }
  }

  fmt = DelegatingFormatter(formatters);

  if (runTags == null) {
    runTags = [];
  }

  // grab the negs
  negativeTags = runTags!
      .where((prefix) => prefix.startsWith("~"))
      .map((tag) => tag.substring(1))
      .toList();

  // take the negs out - can't do the previous way because negative tags will have stripped the "~"
  runTags!.removeWhere((tag) => tag.startsWith("~"));
}