cucumberjs complex example
xxxxxxxxxx
import { loadConfiguration, loadSupport, runCucumber } from '@cucumber/cucumber/api'
export async function runTests(directory, configFile, failFast) {
// things we need to specify about the environment
const environment = { cwd: directory }
// load configuration from a particular file, and override a specific option
const { runConfiguration } = await loadConfiguration({ file: configFile, provided: { failFast } }, environment)
// load the support code upfront
const support = await loadSupport(runConfiguration, environment)
// run cucumber, using the support code we loaded already
const { success } = await runCucumber({ runConfiguration, support }, environment)
return success
}