import type { EventEmitter } from 'node:events'; import { type GherkinDocument, type IdGenerator, type Pickle, type PickleStep, type TestCase, type TestStep, type TestStepResult, TestStepResultStatus } from '@cucumber/messages'; import type { JsonObject } from 'type-fest'; import type StepDefinitionSnippetBuilder from '../formatter/step_definition_snippet_builder'; import type { IDefinition } from '../models/definition'; import type TestCaseHookDefinition from '../models/test_case_hook_definition'; import type TestStepHookDefinition from '../models/test_step_hook_definition'; import type { ITestCaseHookParameter, SupportCodeLibrary } from '../support_code_library_builder/types'; import { type RunStepResult } from './step_runner'; export interface INewTestCaseRunnerOptions { workerId?: string; eventBroadcaster: EventEmitter; gherkinDocument: GherkinDocument; newId: IdGenerator.NewId; pickle: Pickle; testCase: TestCase; retries: number; skip: boolean; filterStackTraces: boolean; supportCodeLibrary: SupportCodeLibrary; worldParameters: JsonObject; snippetBuilder: StepDefinitionSnippetBuilder; } export default class TestCaseRunner { private readonly workerId; private readonly attachmentManager; private currentTestCaseStartedId; private currentTestStepId; private readonly eventBroadcaster; private readonly gherkinDocument; private readonly newId; private readonly pickle; private readonly testCase; private readonly maxAttempts; private readonly skip; private readonly filterStackTraces; private readonly supportCodeLibrary; private readonly snippetBuilder; private testStepResults; private world; private readonly worldParameters; constructor({ workerId, eventBroadcaster, gherkinDocument, newId, pickle, testCase, retries, skip, filterStackTraces, supportCodeLibrary, worldParameters, snippetBuilder, }: INewTestCaseRunnerOptions); resetTestProgressData(): void; getBeforeStepHookDefinitions(): TestStepHookDefinition[]; getAfterStepHookDefinitions(): TestStepHookDefinition[]; getWorstStepResult(): TestStepResult; invokeStep(step: PickleStep, stepDefinition: IDefinition, hookParameter?: ITestCaseHookParameter): Promise; isSkippingSteps(): boolean; isExplicitlySkipped(): boolean; shouldSkipHook(isBeforeHook: boolean): boolean; aroundTestStep(testStepId: string, runStepFn: () => Promise): Promise; run(): Promise; runAttempt(attempt: number, moreAttemptsRemaining: boolean): Promise; runHook(hookDefinition: TestCaseHookDefinition, hookParameter: ITestCaseHookParameter, isBeforeHook: boolean): Promise; runStepHooks(stepHooks: TestStepHookDefinition[], pickleStep: PickleStep, stepResult?: RunStepResult): Promise; runStep(pickleStep: PickleStep, testStep: TestStep): Promise; }