in src/core/runner.ts [498:535]
async _run(options: RunOptions): Promise<RunResult> {
this.config = options;
let result: RunResult = {};
if (this.#active) {
return result;
}
this.#active = true;
log(`Runner: run ${this.#journeys.length} journeys`);
this.#init(options);
const hookArgs = this.buildHookArgs();
await this.#runBeforeAllHook(hookArgs).catch(e => (this.#hookError = e));
const { dryRun, grepOpts } = options;
// collect all journeys with `.only` annotation and skip the rest
const onlyJournerys = this.#journeys.filter(j => j.only);
if (onlyJournerys.length > 0) {
this.#journeys = onlyJournerys;
} else {
// filter journeys based on tags and skip annotations
this.#journeys = this.#journeys.filter(
j => j._isMatch(grepOpts?.match, grepOpts?.tags) && !j.skip
);
}
// Used by heartbeat to gather all registered journeys
if (dryRun) {
this.#journeys.forEach(journey =>
this.#reporter.onJourneyRegister?.(journey)
);
} else if (this.#journeys.length > 0) {
result = await this._runJourneys(options);
}
await this.#runAfterAllHook(hookArgs).catch(
async () => await this._reset()
);
await this._reset();
return result;
}