@autometa/executor 1.0.0-rc.1 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/runtime/step-data.d.ts +35 -21
- package/package.json +6 -6
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/timeouts.ts","../src/hooks.ts","../src/scenario-runner.ts","../src/runtime/step-data.ts","../src/pending.ts","../src/events.ts","../src/execute-plan.ts","../src/tag-filter.ts","../src/modes.ts","../src/scope-lifecycle.ts","../src/async-context.ts","../src/index.ts"],"names":["value","unit","multiplier","getTable","require","evaluator","getEventEmitter","isGherkinStepError","path","isScenarioOutlineExample"],"mappings":";AAGA,IAAM,uBAAoD;AAAA,EACxD,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAWA,IAAM,gBAAgB,CAAC,SAA2C;AAChE,MAAI,SAAS,UAAa,SAAS,MAAM;AACvC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,QAAQ,IAAI,SAAY;AAAA,EACjC;AAEA,MAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,UAAM,CAACA,QAAOC,KAAI,IAAI;AACtB,QAAI,OAAOD,WAAU,YAAYA,UAAS,GAAG;AAC3C,aAAO;AAAA,IACT;AACA,UAAME,cAAa,qBAAqBD,KAAmB,KAAK;AAChE,WAAOD,SAAQE;AAAA,EACjB;AAEA,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,cAAc,OAAO,KAAK,WAAY,KAA4B;AAChF,MAAI,OAAO,UAAU,YAAY,SAAS,GAAG;AAC3C,WAAO;AAAA,EACT;AACA,QAAM,OAAO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AI,aAAa,UAAU,eAAe,CAAC;AAAA,EACjE;AACA,SAAO,GAAG,UAAU,IAAI,KAAK,UAAU;AACzC;AAEA,SAAS,wBACP,SACoB;AACpB,QAAM,WAAqB,CAAC;AAC5B,WAAS,KAAK,WAAW,QAAQ,eAAe,CAAC,EAAE;AACnD,QAAM,YAAY,QAAQ,aAAa,MAAM,KAAK;AAClD,MAAI,WAAW;AACb,aAAS,KAAK,SAAS;AAAA,EACzB;AACA,QAAM,eAAe,oBAAoB,QAAQ,cAAc,QAAQ,YAAY;AACnF,MAAI,cAAc;AAChB,aAAS,KAAK,YAAY;AAAA,EAC5B;AACA,SAAO,SAAS,SAAS,IAAI,SAAS,KAAK,QAAK,IAAI;AACtD;AAEA,SAAS,oBACP,OACA,OACoB;AACpB,QAAM,UAAU,MAAM,eAAe,CAAC;AACtC,QAAM,OAAO,MAAM,aAAa,CAAC;AACjC,QAAM,MAAM,KAAK,KAAK;AACtB,MAAI,CAAC,OAAO,QAAQ,WAAW,GAAG;AAChC,WAAO;AAAA,EACT;AACA,QAAM,QAAkB,CAAC;AACzB,UAAQ,QAAQ,CAAC,QAAQ,gBAAgB;AACvC,UAAM,MAAM,QAAQ,KAAK;AACzB,QAAI,CAAC,KAAK;AACR;AAAA,IACF;AACA,UAAM,QAAQ,IAAI,WAAW,KAAK;AAClC,UAAM,KAAK,GAAG,GAAG,IAAI,OAAO,KAAK,EAAE,KAAK,CAAC,EAAE;AAAA,EAC7C,CAAC;AACD,SAAO,MAAM,SAAS,IAAI,MAAM,KAAK,IAAI,IAAI;AAC/C;;;AKvdA,IAAO,cAAQ,CAAC","sourcesContent":["import type { ExecutorConfig, TimeoutSetting } from \"@autometa/config\";\nimport type { TimeoutSpec, TimeoutUnit } from \"@autometa/scopes\";\n\nconst UNIT_TO_MILLISECONDS: Record<TimeoutUnit, number> = {\n ms: 1,\n s: 1000,\n m: 60_000,\n h: 3_600_000,\n};\n\ntype TimeoutInput = TimeoutSpec | TimeoutSetting | undefined;\n\nexport type TimeoutSource = \"scenario\" | \"hook\" | \"config\" | \"default\";\n\nexport interface TimeoutResolution {\n milliseconds: number | undefined;\n source: TimeoutSource;\n}\n\nconst normalizeSpec = (spec: TimeoutInput): number | undefined => {\n if (spec === undefined || spec === null) {\n return undefined;\n }\n\n if (typeof spec === \"number\") {\n return spec <= 0 ? undefined : spec;\n }\n\n if (Array.isArray(spec)) {\n const [value, unit] = spec;\n if (typeof value !== \"number\" || value <= 0) {\n return undefined;\n }\n const multiplier = UNIT_TO_MILLISECONDS[unit as TimeoutUnit] ?? 1;\n return value * multiplier;\n }\n\n if (typeof spec !== \"object\") {\n return undefined;\n }\n\n const value = \"duration\" in spec ? spec.duration : (spec as { value?: number }).value;\n if (typeof value !== \"number\" || value <= 0) {\n return undefined;\n }\n const unit = \"duration\" in spec ? spec.unit : (spec as { unit?: TimeoutUnit }).unit;\n if (!unit) {\n return value;\n }\n const multiplier = UNIT_TO_MILLISECONDS[unit as TimeoutUnit] ?? 1;\n return value * multiplier;\n};\n\nexport const resolveTimeout = (\n explicit: TimeoutSpec | undefined,\n config: ExecutorConfig,\n explicitSource: TimeoutSource = \"scenario\"\n): TimeoutResolution => {\n const explicitMs = normalizeSpec(explicit);\n if (explicitMs !== undefined) {\n return { milliseconds: explicitMs, source: explicitSource };\n }\n\n const configMs = normalizeSpec(config.test?.timeout as TimeoutSetting | undefined);\n if (configMs !== undefined) {\n return { milliseconds: configMs, source: \"config\" };\n }\n\n return { milliseconds: undefined, source: \"default\" };\n};\n\nexport const chooseTimeout = (\n primary: TimeoutSpec | undefined,\n secondary: TimeoutSpec | undefined,\n config: ExecutorConfig\n): TimeoutResolution => {\n const secondaryResolution = resolveTimeout(secondary, config, \"hook\");\n if (secondaryResolution.milliseconds !== undefined) {\n return secondaryResolution;\n }\n\n return resolveTimeout(primary, config, \"scenario\");\n};\n","import type {\n HookDefinition,\n HookType,\n ScopeExecutionAdapter,\n ScopeNode,\n} from \"@autometa/scopes\";\nimport type { ScenarioExecution } from \"@autometa/test-builder\";\n\nexport interface ResolvedHook<World> {\n readonly hook: HookDefinition<World>;\n readonly scope: ScopeNode<World>;\n}\n\nexport interface HookCollection<World> {\n readonly beforeFeature: ResolvedHook<World>[];\n readonly afterFeature: ResolvedHook<World>[];\n readonly beforeRule: ResolvedHook<World>[];\n readonly afterRule: ResolvedHook<World>[];\n readonly beforeScenario: ResolvedHook<World>[];\n readonly afterScenario: ResolvedHook<World>[];\n readonly beforeScenarioOutline: ResolvedHook<World>[];\n readonly afterScenarioOutline: ResolvedHook<World>[];\n readonly beforeStep: ResolvedHook<World>[];\n readonly afterStep: ResolvedHook<World>[];\n}\n\nconst EMPTY_COLLECTION: HookCollection<unknown> = {\n beforeFeature: [],\n afterFeature: [],\n beforeRule: [],\n afterRule: [],\n beforeScenario: [],\n afterScenario: [],\n beforeScenarioOutline: [],\n afterScenarioOutline: [],\n beforeStep: [],\n afterStep: [],\n};\n\nexport function collectScenarioHooks<World>(\n adapter: ScopeExecutionAdapter<World>,\n execution: ScenarioExecution<World>\n): HookCollection<World> {\n const scopes = buildScopeChain(adapter, execution);\n if (scopes.length === 0) {\n return EMPTY_COLLECTION as HookCollection<World>;\n }\n\n const buckets: HookCollection<World> = {\n beforeFeature: [],\n afterFeature: [],\n beforeRule: [],\n afterRule: [],\n beforeScenario: [],\n afterScenario: [],\n beforeScenarioOutline: [],\n afterScenarioOutline: [],\n beforeStep: [],\n afterStep: [],\n };\n\n for (const scope of scopes) {\n for (const hook of scope.hooks) {\n addHookToBuckets(buckets, hook, scope);\n }\n }\n\n return buckets;\n}\n\nfunction buildScopeChain<World>(\n adapter: ScopeExecutionAdapter<World>,\n execution: ScenarioExecution<World>\n): ScopeNode<World>[] {\n const chain: ScopeNode<World>[] = [adapter.plan.root];\n chain.push(...execution.ancestors);\n chain.push(execution.scope);\n return chain;\n}\n\nfunction addHookToBuckets<World>(\n buckets: HookCollection<World>,\n hook: HookDefinition<World>,\n scope: ScopeNode<World>\n): void {\n const entry: ResolvedHook<World> = { hook, scope };\n switch (hook.type as HookType) {\n case \"beforeFeature\":\n buckets.beforeFeature.push(entry);\n break;\n case \"afterFeature\":\n buckets.afterFeature.push(entry);\n break;\n case \"beforeRule\":\n buckets.beforeRule.push(entry);\n break;\n case \"afterRule\":\n buckets.afterRule.push(entry);\n break;\n case \"beforeScenario\":\n buckets.beforeScenario.push(entry);\n break;\n case \"afterScenario\":\n buckets.afterScenario.push(entry);\n break;\n case \"beforeScenarioOutline\":\n buckets.beforeScenarioOutline.push(entry);\n break;\n case \"afterScenarioOutline\":\n buckets.afterScenarioOutline.push(entry);\n break;\n case \"beforeStep\":\n buckets.beforeStep.push(entry);\n break;\n case \"afterStep\":\n buckets.afterStep.push(entry);\n break;\n default:\n break;\n }\n}\n","import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport {\n CucumberExpression,\n ParameterTypeRegistry,\n RegularExpression,\n} from \"@cucumber/cucumber-expressions\";\nimport { getEventEmitter } from \"@autometa/events\";\nimport type {\n ParameterRegistryLike,\n SourceRef,\n StepDefinition,\n StepExpression,\n} from \"@autometa/scopes\";\nimport type { ScenarioExecution, ScenarioOutlineExample } from \"@autometa/test-builder\";\nimport type {\n SimpleExampleGroup,\n SimpleLocation,\n SimpleScenario,\n SimpleStep,\n} from \"@autometa/gherkin\";\nimport {\n GherkinStepError,\n isGherkinStepError,\n type GherkinContextPathSegment,\n type GherkinErrorContext,\n type GherkinStepSummary,\n type SourceLocation,\n} from \"@autometa/errors\";\nimport {\n clearStepDocstring,\n clearStepTable,\n clearStepMetadata,\n setStepDocstringInfo,\n setStepMetadata,\n setStepTable,\n type StepRuntimeMetadata,\n} from \"./runtime/step-data\";\nimport { isScenarioPendingError } from \"./pending\";\nimport type {\n ScenarioRunContext,\n StepHookDetails,\n StepHookInvocationOptions,\n StepStatus,\n} from \"./scope-lifecycle\";\nimport { findPickleStep } from \"./events\";\n\nexport type { ScenarioRunContext } from \"./scope-lifecycle\";\n\ntype StepArgumentMatcher<World> = (text: string, world: World) => unknown[];\n\ninterface ParameterRegistryCarrier {\n readonly registry?: ParameterTypeRegistry;\n}\n\nconst matcherCache = new WeakMap<\n StepDefinition<unknown>,\n StepArgumentMatcher<unknown>\n>();\n\nexport async function runScenarioExecution<World>(\n execution: ScenarioExecution<World>,\n context: ScenarioRunContext<World>\n): Promise<void> {\n execution.reset();\n const eventEmitter = context.events ? getEventEmitter() : undefined;\n const pickle = context.events?.pickle;\n const { world, beforeStepHooks, afterStepHooks, invokeHooks } = context;\n const parameterRegistry = resolveParameterRegistry(context.parameterRegistry);\n const stepSummaries: GherkinStepSummary[] = [];\n\n try {\n const { steps, gherkinSteps } = execution;\n for (let index = 0; index < steps.length; index++) {\n const step = steps[index];\n if (!step) {\n continue;\n }\n const gherkinStep = gherkinSteps[index];\n const metadata = buildStepMetadata(execution, index);\n const stepDetails: StepHookDetails<World> = {\n index,\n definition: step,\n ...(gherkinStep ? { gherkin: gherkinStep } : {}),\n };\n const beforeOptions: StepHookInvocationOptions<World> = {\n direction: \"asc\",\n step: stepDetails,\n };\n await invokeHooks(beforeStepHooks, beforeOptions);\n\n const pickleStep = pickle && gherkinStep?.id\n ? findPickleStep(pickle, gherkinStep.id)\n : undefined;\n if (eventEmitter && pickle && pickleStep) {\n await eventEmitter.stepStarted({\n feature: pickle.feature,\n scenario: pickle.scenario,\n step: pickleStep,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n metadata: { index },\n });\n }\n\n setStepMetadata(world, metadata);\n setStepTable(world, gherkinStep?.dataTable);\n if (!gherkinStep?.docString) {\n setStepDocstringInfo(world, undefined);\n } else if (gherkinStep.docString.mediaType === undefined) {\n setStepDocstringInfo(world, { content: gherkinStep.docString.content });\n } else {\n setStepDocstringInfo(world, {\n content: gherkinStep.docString.content,\n mediaType: gherkinStep.docString.mediaType,\n });\n }\n let status: StepStatus = \"passed\";\n try {\n const args = resolveStepArguments(\n step,\n gherkinStep,\n parameterRegistry,\n world\n );\n await step.handler(world, ...args);\n stepSummaries.push(createStepSummary(metadata, gherkinStep, \"passed\"));\n } catch (error) {\n if (isScenarioPendingError(error)) {\n status = \"skipped\";\n throw error;\n }\n status = \"failed\";\n if (eventEmitter && pickle && pickleStep) {\n await eventEmitter.errorRaised({\n error,\n phase: \"step\",\n feature: pickle.feature,\n scenario: pickle.scenario,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n pickle,\n metadata: { index, stepId: pickleStep.id },\n });\n }\n stepSummaries.push(createStepSummary(metadata, gherkinStep, \"failed\"));\n for (let remaining = index + 1; remaining < gherkinSteps.length; remaining++) {\n const remainingMetadata = buildStepMetadata(execution, remaining);\n const remainingStep = gherkinSteps[remaining];\n stepSummaries.push(\n createStepSummary(remainingMetadata, remainingStep, \"skipped\")\n );\n }\n throw enrichStepError(error, metadata, stepSummaries);\n } finally {\n const afterStepDetails: StepHookDetails<World> = {\n ...stepDetails,\n status,\n };\n const afterOptions: StepHookInvocationOptions<World> = {\n direction: \"desc\",\n step: afterStepDetails,\n };\n await invokeHooks(afterStepHooks, afterOptions);\n\n if (eventEmitter && pickle && pickleStep) {\n await eventEmitter.stepCompleted({\n feature: pickle.feature,\n scenario: pickle.scenario,\n step: pickleStep,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n metadata: { index, status },\n });\n }\n\n clearStepTable(world);\n clearStepDocstring(world);\n clearStepMetadata(world);\n }\n }\n execution.markPassed();\n } catch (error) {\n if (isScenarioPendingError(error)) {\n execution.markPending(error.reason);\n return;\n }\n execution.markFailed(error);\n throw error;\n }\n}\n\nfunction resolveStepArguments<World>(\n definition: StepDefinition<World>,\n gherkinStep: SimpleStep | undefined,\n registry: ParameterTypeRegistry,\n world: World\n): unknown[] {\n if (!gherkinStep) {\n return [];\n }\n const matcher = getStepArgumentMatcher(definition, registry);\n return matcher(gherkinStep.text, world);\n}\n\nfunction getStepArgumentMatcher<World>(\n definition: StepDefinition<World>,\n registry: ParameterTypeRegistry\n): StepArgumentMatcher<World> {\n const cached = matcherCache.get(definition as StepDefinition<unknown>);\n if (cached) {\n return cached as StepArgumentMatcher<World>;\n }\n const matcher = createStepArgumentMatcher<World>(\n definition.expression,\n registry\n );\n matcherCache.set(\n definition as StepDefinition<unknown>,\n matcher as StepArgumentMatcher<unknown>\n );\n return matcher;\n}\n\nfunction createStepArgumentMatcher<World>(\n expression: StepExpression,\n registry: ParameterTypeRegistry\n): StepArgumentMatcher<World> {\n if (expression instanceof RegExp) {\n const evaluator = new RegularExpression(expression, registry);\n return (text, world) =>\n collectArguments(evaluator.match(text), world, text, expression);\n }\n const evaluator = new CucumberExpression(expression, registry);\n return (text, world) =>\n collectArguments(evaluator.match(text), world, text, expression);\n}\n\nfunction collectArguments<World>(\n match:\n | readonly { getValue(context?: unknown): unknown }[]\n | null,\n world: World,\n text: string,\n expression: StepExpression\n): unknown[] {\n if (!match) {\n throw new Error(\n `Step '${text}' did not match expression ${String(expression)}`\n );\n }\n return match.map((argument) => argument.getValue(world));\n}\n\nfunction resolveParameterRegistry(\n source: ParameterRegistryLike | undefined\n): ParameterTypeRegistry {\n if (isParameterTypeRegistry(source)) {\n return source;\n }\n\n const carrier = source as ParameterRegistryCarrier | undefined;\n const registry = carrier?.registry;\n if (isParameterTypeRegistry(registry)) {\n return registry;\n }\n\n return new ParameterTypeRegistry();\n}\n\nfunction isParameterTypeRegistry(\n value: unknown\n): value is ParameterTypeRegistry {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n\n if (value instanceof ParameterTypeRegistry) {\n return true;\n }\n\n const registry = value as ParameterTypeRegistry & {\n lookupByRegexp?: unknown;\n };\n\n return (\n typeof registry.lookupByTypeName === \"function\" &&\n typeof registry.defineParameterType === \"function\" &&\n typeof registry.lookupByRegexp === \"function\"\n );\n}\n\nfunction buildStepMetadata<World>(\n execution: ScenarioExecution<World>,\n index: number\n): StepRuntimeMetadata | undefined {\n const stepDefinition = execution.steps[index];\n const gherkinStep = execution.gherkinSteps[index];\n const featureNode = execution.feature;\n const feature = featureNode.feature;\n\n const featureSource = combineSourceRef(\n featureNode.scope.source,\n feature.uri,\n feature.location\n );\n const featureMeta = {\n name: featureNode.name,\n keyword: featureNode.keyword,\n uri: feature.uri,\n ...(featureSource ? { source: featureSource } : {}),\n } as StepRuntimeMetadata[\"feature\"];\n\n const scenarioSource = combineSourceRef(\n execution.scope.source,\n feature.uri,\n extractScenarioLocation(execution)\n );\n const scenarioMeta = {\n name: execution.name,\n keyword: execution.keyword,\n ...(scenarioSource ? { source: scenarioSource } : {}),\n } as StepRuntimeMetadata[\"scenario\"];\n\n const outlineMeta = execution.outline\n ? (() => {\n const outlineSource = combineSourceRef(\n execution.outline?.scope.source,\n feature.uri,\n execution.outline.outline.location\n );\n return {\n name: execution.outline.name,\n keyword: execution.outline.keyword,\n ...(outlineSource ? { source: outlineSource } : {}),\n } as StepRuntimeMetadata[\"outline\"];\n })()\n : undefined;\n\n const exampleMeta = isScenarioOutlineExample(execution)\n ? (() => {\n const group = execution.exampleGroup;\n const exampleSource = combineSourceRef(\n undefined,\n feature.uri,\n group.location\n );\n return {\n name: group.name,\n index: execution.exampleIndex,\n values: buildExampleValues(group, execution.exampleIndex),\n ...(exampleSource ? { source: exampleSource } : {}),\n } as StepRuntimeMetadata[\"example\"];\n })()\n : undefined;\n\n const stepMeta = gherkinStep\n ? (() => {\n const stepSource = combineSourceRef(\n undefined,\n feature.uri,\n gherkinStep.location\n );\n return {\n keyword: gherkinStep.keyword,\n text: gherkinStep.text,\n ...(stepSource ? { source: stepSource } : {}),\n } as StepRuntimeMetadata[\"step\"];\n })()\n : undefined;\n\n const definitionMeta = stepDefinition\n ? (() => {\n const definitionSource = normalizeDefinitionSource(stepDefinition.source);\n return {\n keyword: stepDefinition.keyword,\n expression: stepDefinition.expression,\n ...(definitionSource ? { source: definitionSource } : {}),\n } as StepRuntimeMetadata[\"definition\"];\n })()\n : undefined;\n\n const metadata: StepRuntimeMetadata = {\n ...(featureMeta ? { feature: featureMeta } : {}),\n ...(scenarioMeta ? { scenario: scenarioMeta } : {}),\n ...(outlineMeta ? { outline: outlineMeta } : {}),\n ...(exampleMeta ? { example: exampleMeta } : {}),\n ...(stepMeta ? { step: stepMeta } : {}),\n ...(definitionMeta ? { definition: definitionMeta } : {}),\n };\n\n return hasMetadata(metadata) ? metadata : undefined;\n}\n\nfunction combineSourceRef(\n source: SourceRef | undefined,\n uri?: string,\n location?: SimpleLocation\n): SourceRef | undefined {\n const file = source?.file ?? uri;\n const line = source?.line ?? location?.line;\n const column = source?.column ?? location?.column;\n\n if (file === undefined && line === undefined && column === undefined) {\n return undefined;\n }\n\n return {\n ...(file !== undefined ? { file } : {}),\n ...(line !== undefined ? { line } : {}),\n ...(column !== undefined ? { column } : {}),\n } satisfies SourceRef;\n}\n\nfunction normalizeDefinitionSource(source: SourceRef | undefined): SourceRef | undefined {\n if (!source) {\n return undefined;\n }\n\n return {\n ...(source.file !== undefined ? { file: source.file } : {}),\n ...(source.line !== undefined ? { line: source.line } : {}),\n ...(source.column !== undefined ? { column: source.column } : {}),\n } satisfies SourceRef;\n}\n\nfunction extractScenarioLocation<World>(\n execution: ScenarioExecution<World>\n): SimpleLocation | undefined {\n if (execution.type === \"example\") {\n return execution.outline?.outline.location;\n }\n const scenario = execution.gherkin as SimpleScenario;\n return scenario.location;\n}\n\nfunction isScenarioOutlineExample<World>(\n execution: ScenarioExecution<World>\n): execution is ScenarioOutlineExample<World> {\n return execution.type === \"example\";\n}\n\nfunction buildExampleValues(\n group: SimpleExampleGroup,\n index: number\n): Readonly<Record<string, string>> {\n const values: Record<string, string> = {};\n const headers = group.tableHeader;\n const row = group.tableBody[index] ?? [];\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i];\n if (header === undefined || header.length === 0) {\n continue;\n }\n values[header] = row[i] ?? \"\";\n }\n return Object.freeze(values);\n}\n\nfunction hasMetadata(metadata: StepRuntimeMetadata): boolean {\n return Boolean(\n metadata.feature ||\n metadata.scenario ||\n metadata.outline ||\n metadata.example ||\n metadata.step ||\n metadata.definition\n );\n}\n\nfunction enrichStepError(\n error: unknown,\n metadata: StepRuntimeMetadata | undefined,\n steps?: readonly GherkinStepSummary[]\n): Error {\n const base = error instanceof Error ? error : new Error(String(error));\n\n if (isGherkinStepError(base)) {\n return base;\n }\n\n const wrapped = new GherkinStepError(base.message, {\n cause: base,\n context: buildGherkinErrorContext(metadata, base, steps) ?? {},\n });\n\n if (base.stack) {\n Object.defineProperty(wrapped, \"stack\", {\n configurable: true,\n enumerable: false,\n writable: true,\n value: base.stack,\n });\n }\n\n return wrapped;\n}\n\nfunction buildGherkinErrorContext(\n metadata: StepRuntimeMetadata | undefined,\n error?: Error,\n steps?: readonly GherkinStepSummary[]\n): GherkinErrorContext | undefined {\n if (!metadata) {\n return undefined;\n }\n\n const gherkinLocation = toSourceLocation(metadata.step?.source);\n const definitionLocation = toSourceLocation(metadata.definition?.source);\n const errorLocation = extractErrorLocation(error);\n const pathSegments = buildGherkinPath(metadata);\n\n const gherkinSegment = gherkinLocation\n ? {\n location: gherkinLocation,\n ...(metadata.feature?.name !== undefined\n ? { featureName: metadata.feature.name }\n : {}),\n ...(metadata.step?.keyword !== undefined\n ? { stepKeyword: metadata.step.keyword }\n : {}),\n ...(metadata.step?.text !== undefined ? { stepText: metadata.step.text } : {}),\n }\n : undefined;\n\n const expression = metadata.definition?.expression;\n const functionName =\n typeof expression === \"string\"\n ? expression\n : expression !== undefined\n ? String(expression)\n : undefined;\n\n const codeLocation = errorLocation ?? definitionLocation;\n\n const codeSegment = codeLocation\n ? {\n location: codeLocation,\n ...(functionName !== undefined ? { functionName } : {}),\n }\n : undefined;\n\n const hasSteps = Boolean(steps && steps.length > 0);\n\n if (!gherkinSegment && !codeSegment && !pathSegments && !hasSteps) {\n return undefined;\n }\n\n return {\n ...(gherkinSegment ? { gherkin: gherkinSegment } : {}),\n ...(codeSegment ? { code: codeSegment } : {}),\n ...(pathSegments ? { path: pathSegments } : {}),\n ...(hasSteps && steps ? { steps } : {}),\n };\n}\n\nfunction createStepSummary(\n metadata: StepRuntimeMetadata | undefined,\n gherkinStep: SimpleStep | undefined,\n status: GherkinStepSummary[\"status\"]\n): GherkinStepSummary {\n const keyword = metadata?.step?.keyword ?? gherkinStep?.keyword;\n const text = metadata?.step?.text ?? gherkinStep?.text;\n const location = metadata?.step?.source\n ? toSourceLocation(metadata.step.source)\n : undefined;\n\n return {\n status,\n ...(keyword !== undefined ? { keyword } : {}),\n ...(text !== undefined ? { text } : {}),\n ...(location ? { location } : {}),\n } satisfies GherkinStepSummary;\n}\n\nfunction buildGherkinPath(\n metadata: StepRuntimeMetadata | undefined\n): GherkinContextPathSegment[] | undefined {\n if (!metadata) {\n return undefined;\n }\n\n const segments: GherkinContextPathSegment[] = [];\n\n const featureLocation = toSourceLocation(metadata.feature?.source);\n if (featureLocation) {\n segments.push({\n role: \"feature\",\n location: featureLocation,\n ...(metadata.feature?.keyword !== undefined\n ? { keyword: metadata.feature.keyword }\n : {}),\n ...(metadata.feature?.name !== undefined ? { name: metadata.feature.name } : {}),\n });\n }\n\n const outlineLocation = toSourceLocation(metadata.outline?.source);\n if (outlineLocation) {\n segments.push({\n role: \"outline\",\n location: outlineLocation,\n ...(metadata.outline?.keyword !== undefined\n ? { keyword: metadata.outline.keyword }\n : {}),\n ...(metadata.outline?.name !== undefined ? { name: metadata.outline.name } : {}),\n });\n }\n\n const scenarioLocation = toSourceLocation(metadata.scenario?.source);\n if (scenarioLocation) {\n segments.push({\n role: \"scenario\",\n location: scenarioLocation,\n ...(metadata.scenario?.keyword !== undefined\n ? { keyword: metadata.scenario.keyword }\n : {}),\n ...(metadata.scenario?.name !== undefined ? { name: metadata.scenario.name } : {}),\n });\n }\n\n const exampleLocation = toSourceLocation(metadata.example?.source);\n if (exampleLocation) {\n segments.push({\n role: \"example\",\n keyword: \"Example\",\n location: exampleLocation,\n ...(metadata.example?.name !== undefined ? { name: metadata.example.name } : {}),\n ...(metadata.example?.index !== undefined ? { index: metadata.example.index } : {}),\n });\n }\n\n const stepLocation = toSourceLocation(metadata.step?.source);\n if (stepLocation) {\n segments.push({\n role: \"step\",\n location: stepLocation,\n ...(metadata.step?.keyword !== undefined ? { keyword: metadata.step.keyword } : {}),\n ...(metadata.step?.text !== undefined ? { text: metadata.step.text } : {}),\n });\n }\n\n return segments.length ? segments : undefined;\n}\n\ninterface ParsedStackFrame {\n readonly file: string;\n readonly line: number;\n readonly column: number;\n}\n\nconst STACK_FRAME_IGNORE_PATTERNS: readonly RegExp[] = [\n /^node:/,\n /node:internal\\//,\n /internal\\/(?:modules|process)/,\n /node_modules\\/@autometa\\//,\n /packages\\/(?:runner|executor|errors|cli|assertions)\\//,\n /\\/\\.autometa-cli\\/cache\\//,\n /\\/\\.autometa\\/cache\\//,\n /\\/node_modules\\/\\.cache\\/autometa\\//,\n];\n\nfunction extractErrorLocation(error: Error | undefined): SourceLocation | undefined {\n if (!error?.stack) {\n return undefined;\n }\n\n const lines = error.stack.split(\"\\n\").slice(1);\n for (const raw of lines) {\n const trimmed = raw.trim();\n if (!trimmed.startsWith(\"at \")) {\n continue;\n }\n const parsed = parseStackFrame(trimmed);\n if (!parsed) {\n continue;\n }\n if (isFrameworkStackFile(parsed.file)) {\n continue;\n }\n const filePath = normalizeFilePath(parsed.file);\n return {\n filePath,\n start: {\n line: parsed.line,\n column: parsed.column,\n },\n } satisfies SourceLocation;\n }\n\n return undefined;\n}\n\nfunction parseStackFrame(line: string): ParsedStackFrame | undefined {\n const match = line.match(/at (?:.+?\\()?((?:[a-zA-Z]:)?[^():]+):(\\d+):(\\d+)\\)?$/);\n if (!match) {\n return undefined;\n }\n\n const [, file = \"\", lineText = \"\", columnText = \"\"] = match;\n if (!file || !lineText) {\n return undefined;\n }\n\n const lineNumber = Number.parseInt(lineText, 10);\n if (Number.isNaN(lineNumber)) {\n return undefined;\n }\n\n const columnNumber = Number.parseInt(columnText, 10);\n\n return {\n file,\n line: lineNumber,\n column: Number.isNaN(columnNumber) ? 1 : columnNumber,\n };\n}\n\nfunction isFrameworkStackFile(file: string): boolean {\n const normalized = file.replace(/\\\\/g, \"/\");\n return STACK_FRAME_IGNORE_PATTERNS.some((pattern) => pattern.test(normalized));\n}\n\nfunction toSourceLocation(source: SourceRef | undefined): SourceLocation | undefined {\n if (!source?.file) {\n return undefined;\n }\n\n const filePath = normalizeFilePath(source.file);\n const line = source.line ?? 1;\n const column = source.column ?? 1;\n\n return {\n filePath,\n start: {\n line,\n column,\n },\n };\n}\n\nfunction normalizeFilePath(file: string): string {\n if (file.startsWith(\"file://\")) {\n try {\n return fileURLToPath(file);\n } catch {\n // fall back to treating the URI as a plain path\n return file;\n }\n }\n return path.isAbsolute(file) ? file : path.resolve(file);\n}\n","import {\n createTable,\n DEFAULT_COERCE_BY_SHAPE,\n type HeaderlessTable,\n type HeaderlessTableOptions,\n type HorizontalTable,\n type HorizontalTableOptions,\n type MatrixTable,\n type MatrixTableOptions,\n type TableShape,\n type VerticalTable,\n type VerticalTableOptions,\n} from \"@autometa/gherkin\";\nimport type { SourceRef, StepExpression, StepKeyword } from \"@autometa/scopes\";\n\nexport type RawTable = readonly (readonly string[])[];\n\ndeclare const DATA_TABLE_SYMBOL_KEY: unique symbol;\ndeclare const DOCSTRING_SYMBOL_KEY: unique symbol;\ndeclare const DOCSTRING_MEDIA_TYPE_SYMBOL_KEY: unique symbol;\ndeclare const STEP_RUNTIME_SYMBOL_KEY: unique symbol;\ndeclare const STEP_METADATA_SYMBOL_KEY: unique symbol;\n\nconst DATA_TABLE_SYMBOL: typeof DATA_TABLE_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:data-table\"\n) as typeof DATA_TABLE_SYMBOL_KEY;\nconst DOCSTRING_SYMBOL: typeof DOCSTRING_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:docstring\"\n) as typeof DOCSTRING_SYMBOL_KEY;\nconst DOCSTRING_MEDIA_TYPE_SYMBOL: typeof DOCSTRING_MEDIA_TYPE_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:docstring:media-type\"\n) as typeof DOCSTRING_MEDIA_TYPE_SYMBOL_KEY;\nconst STEP_RUNTIME_SYMBOL: typeof STEP_RUNTIME_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:runtime\"\n) as typeof STEP_RUNTIME_SYMBOL_KEY;\nconst STEP_METADATA_SYMBOL: typeof STEP_METADATA_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:metadata\"\n) as typeof STEP_METADATA_SYMBOL_KEY;\n\ntype TableCarrier = Record<never, never> & {\n [DATA_TABLE_SYMBOL]?: RawTable;\n [DOCSTRING_SYMBOL]?: string | undefined;\n [DOCSTRING_MEDIA_TYPE_SYMBOL]?: string | undefined;\n [STEP_RUNTIME_SYMBOL]?: StepRuntimeHelpers;\n [STEP_METADATA_SYMBOL]?: StepRuntimeMetadata;\n runtime?: StepRuntimeHelpers;\n};\n\ntype TableConfig = Record<TableShape, boolean>;\n\nconst DEFAULT_CONFIG: TableConfig = { ...DEFAULT_COERCE_BY_SHAPE };\nlet activeConfig: TableConfig = { ...DEFAULT_CONFIG };\n\nexport interface DocstringInfo {\n readonly content: string;\n readonly mediaType?: string;\n}\n\nexport type DocstringTransformer<T = unknown> = (\n content: string,\n context: { readonly mediaType?: string }\n) => T;\n\nexport interface DocstringTransformConfig {\n readonly transformers: Readonly<Record<string, DocstringTransformer>>;\n}\n\nconst DEFAULT_DOCSTRING_CONFIG: DocstringTransformConfig = { transformers: {} };\nlet activeDocstringConfig: DocstringTransformConfig = { ...DEFAULT_DOCSTRING_CONFIG };\n\nfunction isObjectLike(value: unknown): value is TableCarrier {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction cloneTable(source: string[][] | readonly (readonly string[])[]): RawTable {\n return source.map((row) => [...row]) as readonly (readonly string[])[];\n}\n\nfunction withCarrier(world: unknown): TableCarrier | undefined {\n if (!isObjectLike(world)) {\n return undefined;\n }\n return world as TableCarrier;\n}\n\nexport interface TableAccessConfig {\n readonly coercePrimitives?: Partial<Record<TableShape, boolean>>;\n}\n\nexport function configureStepTables(config: TableAccessConfig): void {\n if (config.coercePrimitives) {\n activeConfig = {\n ...activeConfig,\n ...config.coercePrimitives,\n } as TableConfig;\n }\n}\n\nexport function resetStepTableConfig(): void {\n activeConfig = { ...DEFAULT_CONFIG };\n}\n\nexport function setStepTable(\n world: unknown,\n table: string[][] | readonly (readonly string[])[] | undefined\n): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n if (!table) {\n Reflect.deleteProperty(carrier, DATA_TABLE_SYMBOL);\n return;\n }\n const cloned = cloneTable(table);\n if (Object.prototype.hasOwnProperty.call(carrier, DATA_TABLE_SYMBOL)) {\n carrier[DATA_TABLE_SYMBOL] = cloned;\n } else {\n Object.defineProperty(carrier, DATA_TABLE_SYMBOL, {\n value: cloned,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n}\n\nexport function clearStepTable(world: unknown): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n Reflect.deleteProperty(carrier, DATA_TABLE_SYMBOL);\n}\n\nexport function setStepDocstring(world: unknown, docstring?: string): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n if (docstring === undefined) {\n Reflect.deleteProperty(carrier, DOCSTRING_SYMBOL);\n Reflect.deleteProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL);\n return;\n }\n if (Object.prototype.hasOwnProperty.call(carrier, DOCSTRING_SYMBOL)) {\n carrier[DOCSTRING_SYMBOL] = docstring;\n } else {\n Object.defineProperty(carrier, DOCSTRING_SYMBOL, {\n value: docstring,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n Reflect.deleteProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL);\n}\n\nexport function setStepDocstringInfo(world: unknown, docstring?: DocstringInfo): void {\n if (docstring === undefined) {\n setStepDocstring(world, undefined);\n return;\n }\n\n setStepDocstring(world, docstring.content);\n\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n\n const mediaType = docstring.mediaType;\n if (mediaType === undefined) {\n Reflect.deleteProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL);\n return;\n }\n\n if (Object.prototype.hasOwnProperty.call(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL)) {\n carrier[DOCSTRING_MEDIA_TYPE_SYMBOL] = mediaType;\n } else {\n Object.defineProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL, {\n value: mediaType,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n}\n\nexport function clearStepDocstring(world: unknown): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n Reflect.deleteProperty(carrier, DOCSTRING_SYMBOL);\n Reflect.deleteProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL);\n}\n\nexport interface StepRuntimeStepMetadata {\n readonly keyword?: string;\n readonly text?: string;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeFeatureMetadata {\n readonly name: string;\n readonly keyword: string;\n readonly uri?: string;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeScenarioMetadata {\n readonly name: string;\n readonly keyword: string;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeOutlineMetadata {\n readonly name: string;\n readonly keyword: string;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeExampleMetadata {\n readonly name?: string;\n readonly index: number;\n readonly values: Readonly<Record<string, string>>;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeDefinitionMetadata {\n readonly keyword: StepKeyword;\n readonly expression: StepExpression;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeMetadata {\n readonly feature?: StepRuntimeFeatureMetadata;\n readonly scenario?: StepRuntimeScenarioMetadata;\n readonly outline?: StepRuntimeOutlineMetadata;\n readonly example?: StepRuntimeExampleMetadata;\n readonly step?: StepRuntimeStepMetadata;\n readonly definition?: StepRuntimeDefinitionMetadata;\n}\n\nexport function setStepMetadata(world: unknown, metadata?: StepRuntimeMetadata): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n if (!metadata) {\n Reflect.deleteProperty(carrier, STEP_METADATA_SYMBOL);\n return;\n }\n if (Object.prototype.hasOwnProperty.call(carrier, STEP_METADATA_SYMBOL)) {\n carrier[STEP_METADATA_SYMBOL] = metadata;\n } else {\n Object.defineProperty(carrier, STEP_METADATA_SYMBOL, {\n value: metadata,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n}\n\nexport function clearStepMetadata(world: unknown): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n Reflect.deleteProperty(carrier, STEP_METADATA_SYMBOL);\n}\n\nexport function getStepMetadata(world: unknown): StepRuntimeMetadata | undefined {\n const carrier = withCarrier(world);\n return carrier?.[STEP_METADATA_SYMBOL];\n}\n\nexport function getDocstring(world: unknown): string | undefined {\n const carrier = withCarrier(world);\n return carrier?.[DOCSTRING_SYMBOL];\n}\n\nexport function getDocstringMediaType(world: unknown): string | undefined {\n const carrier = withCarrier(world);\n return carrier?.[DOCSTRING_MEDIA_TYPE_SYMBOL];\n}\n\nexport function getDocstringInfo(world: unknown): DocstringInfo | undefined {\n const content = getDocstring(world);\n if (content === undefined) {\n return undefined;\n }\n const mediaType = getDocstringMediaType(world);\n if (mediaType === undefined) {\n return { content };\n }\n return { content, mediaType };\n}\n\nexport function getRawTable(world: unknown): RawTable | undefined {\n const carrier = withCarrier(world);\n return carrier?.[DATA_TABLE_SYMBOL];\n}\n\nexport function getStepRuntimeFromWorld(world: unknown): StepRuntimeHelpers | undefined {\n const carrier = withCarrier(world);\n return carrier?.[STEP_RUNTIME_SYMBOL];\n}\n\nfunction resolveCoerceOverride(\n shape: TableShape,\n coerceOverride: boolean | undefined\n): boolean {\n if (typeof coerceOverride === \"boolean\") {\n return coerceOverride;\n }\n return activeConfig[shape];\n}\n\nexport function getTable(\n world: unknown,\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n): HeaderlessTable | undefined;\nexport function getTable(\n world: unknown,\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n): HorizontalTable | undefined;\nexport function getTable(\n world: unknown,\n shape: \"vertical\",\n options?: VerticalTableOptions\n): VerticalTable | undefined;\nexport function getTable(\n world: unknown,\n shape: \"matrix\",\n options?: MatrixTableOptions\n): MatrixTable | undefined;\nexport function getTable(\n world: unknown,\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n const table = getRawTable(world);\n if (!table) {\n return undefined;\n }\n const coerce = resolveCoerceOverride(shape, options?.coerce);\n switch (shape) {\n case \"headerless\":\n return createTable(table, \"headerless\", {\n ...(options as HeaderlessTableOptions | undefined),\n coerce,\n });\n case \"horizontal\":\n return createTable(table, \"horizontal\", {\n ...(options as HorizontalTableOptions | undefined),\n coerce,\n });\n case \"vertical\":\n return createTable(table, \"vertical\", {\n ...(options as VerticalTableOptions | undefined),\n coerce,\n });\n case \"matrix\":\n return createTable(table, \"matrix\", {\n ...(options as MatrixTableOptions | undefined),\n coerce,\n });\n default:\n return undefined;\n }\n}\n\nexport function consumeTable(\n world: unknown,\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n let instance:\n | HeaderlessTable\n | HorizontalTable\n | VerticalTable\n | MatrixTable\n | undefined;\n switch (shape) {\n case \"headerless\":\n instance = getTable(world, \"headerless\", options as HeaderlessTableOptions | undefined);\n break;\n case \"horizontal\":\n instance = getTable(world, \"horizontal\", options as HorizontalTableOptions | undefined);\n break;\n case \"vertical\":\n instance = getTable(world, \"vertical\", options as VerticalTableOptions | undefined);\n break;\n case \"matrix\":\n instance = getTable(world, \"matrix\", options as MatrixTableOptions | undefined);\n break;\n default:\n instance = undefined;\n }\n clearStepTable(world);\n return instance;\n}\n\nexport function consumeDocstring(world: unknown): string | undefined {\n const value = getDocstring(world);\n clearStepDocstring(world);\n return value;\n}\n\nfunction normalizeDocstringMediaType(mediaType: string | undefined): string | undefined {\n if (!mediaType) {\n return undefined;\n }\n const normalized = mediaType.trim();\n if (!normalized) {\n return undefined;\n }\n const [primary] = normalized.split(\";\", 1);\n return primary?.trim().toLowerCase() || undefined;\n}\n\nfunction resolveDocstringTransformer(\n transformers: Readonly<Record<string, DocstringTransformer>>,\n mediaType: string | undefined\n): DocstringTransformer | undefined {\n const normalized = normalizeDocstringMediaType(mediaType);\n if (!normalized) {\n return undefined;\n }\n\n if (transformers[normalized]) {\n return transformers[normalized];\n }\n\n const slashIndex = normalized.indexOf(\"/\");\n if (slashIndex !== -1) {\n const subtype = normalized.slice(slashIndex + 1);\n if (transformers[subtype]) {\n return transformers[subtype];\n }\n const plusIndex = subtype.lastIndexOf(\"+\");\n if (plusIndex !== -1) {\n const suffix = subtype.slice(plusIndex + 1);\n if (transformers[`+${suffix}`]) {\n return transformers[`+${suffix}`];\n }\n if (transformers[suffix]) {\n return transformers[suffix];\n }\n }\n }\n\n return undefined;\n}\n\nexport function configureStepDocstrings(\n config: Partial<DocstringTransformConfig>\n): void {\n if (config.transformers) {\n activeDocstringConfig = {\n ...activeDocstringConfig,\n transformers: {\n ...activeDocstringConfig.transformers,\n ...config.transformers,\n },\n };\n }\n}\n\nexport function resetStepDocstringConfig(): void {\n activeDocstringConfig = { ...DEFAULT_DOCSTRING_CONFIG };\n}\n\nexport interface StepRuntimeHelpers {\n readonly hasTable: boolean;\n readonly hasDocstring: boolean;\n readonly currentStep: StepRuntimeMetadata | undefined;\n getTable(\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n ): HeaderlessTable | undefined;\n getTable(\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n ): HorizontalTable | undefined;\n getTable(\n shape: \"vertical\",\n options?: VerticalTableOptions\n ): VerticalTable | undefined;\n getTable(\n shape: \"matrix\",\n options?: MatrixTableOptions\n ): MatrixTable | undefined;\n getTable(\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined;\n consumeTable(\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n ): HeaderlessTable | undefined;\n consumeTable(\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n ): HorizontalTable | undefined;\n consumeTable(\n shape: \"vertical\",\n options?: VerticalTableOptions\n ): VerticalTable | undefined;\n consumeTable(\n shape: \"matrix\",\n options?: MatrixTableOptions\n ): MatrixTable | undefined;\n consumeTable(\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined;\n requireTable(\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n ): HeaderlessTable;\n requireTable(\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n ): HorizontalTable;\n requireTable(\n shape: \"vertical\",\n options?: VerticalTableOptions\n ): VerticalTable;\n requireTable(\n shape: \"matrix\",\n options?: MatrixTableOptions\n ): MatrixTable;\n requireTable(\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable;\n getRawTable(): RawTable | undefined;\n getDocstring(): string | undefined;\n getDocstringMediaType(): string | undefined;\n getDocstringInfo(): DocstringInfo | undefined;\n consumeDocstring(): string | undefined;\n getDocstringTransformed(options?: { readonly fallback?: \"raw\" | \"throw\" }): unknown | undefined;\n consumeDocstringTransformed(options?: { readonly fallback?: \"raw\" | \"throw\" }): unknown | undefined;\n getStepMetadata(): StepRuntimeMetadata | undefined;\n}\n\nfunction bindGetTable(world: unknown) {\n function getTable(\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n ): HeaderlessTable | undefined;\n function getTable(\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n ): HorizontalTable | undefined;\n function getTable(\n shape: \"vertical\",\n options?: VerticalTableOptions\n ): VerticalTable | undefined;\n function getTable(\n shape: \"matrix\",\n options?: MatrixTableOptions\n ): MatrixTable | undefined;\n function getTable(\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n switch (shape) {\n case \"headerless\":\n return getTableForShape(world, \"headerless\", options as HeaderlessTableOptions | undefined);\n case \"horizontal\":\n return getTableForShape(world, \"horizontal\", options as HorizontalTableOptions | undefined);\n case \"vertical\":\n return getTableForShape(world, \"vertical\", options as VerticalTableOptions | undefined);\n case \"matrix\":\n return getTableForShape(world, \"matrix\", options as MatrixTableOptions | undefined);\n default:\n return undefined;\n }\n }\n return getTable;\n}\n\nfunction getTableForShape(\n world: unknown,\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n): HeaderlessTable | undefined;\nfunction getTableForShape(\n world: unknown,\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n): HorizontalTable | undefined;\nfunction getTableForShape(\n world: unknown,\n shape: \"vertical\",\n options?: VerticalTableOptions\n): VerticalTable | undefined;\nfunction getTableForShape(\n world: unknown,\n shape: \"matrix\",\n options?: MatrixTableOptions\n): MatrixTable | undefined;\nfunction getTableForShape(\n world: unknown,\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n switch (shape) {\n case \"headerless\":\n return getTable(world, \"headerless\", options as HeaderlessTableOptions | undefined);\n case \"horizontal\":\n return getTable(world, \"horizontal\", options as HorizontalTableOptions | undefined);\n case \"vertical\":\n return getTable(world, \"vertical\", options as VerticalTableOptions | undefined);\n case \"matrix\":\n return getTable(world, \"matrix\", options as MatrixTableOptions | undefined);\n default:\n return undefined;\n }\n}\n\nfunction bindConsumeTable(world: unknown) {\n function consume(\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n ): HeaderlessTable | undefined;\n function consume(\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n ): HorizontalTable | undefined;\n function consume(\n shape: \"vertical\",\n options?: VerticalTableOptions\n ): VerticalTable | undefined;\n function consume(\n shape: \"matrix\",\n options?: MatrixTableOptions\n ): MatrixTable | undefined;\n function consume(\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n switch (shape) {\n case \"headerless\":\n return consumeTable(world, \"headerless\", options as HeaderlessTableOptions | undefined);\n case \"horizontal\":\n return consumeTable(world, \"horizontal\", options as HorizontalTableOptions | undefined);\n case \"vertical\":\n return consumeTable(world, \"vertical\", options as VerticalTableOptions | undefined);\n case \"matrix\":\n return consumeTable(world, \"matrix\", options as MatrixTableOptions | undefined);\n default:\n return undefined;\n }\n }\n return consume;\n}\n\nfunction bindRequireTable(world: unknown) {\n function require(\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n ): HeaderlessTable;\n function require(\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n ): HorizontalTable;\n function require(\n shape: \"vertical\",\n options?: VerticalTableOptions\n ): VerticalTable;\n function require(\n shape: \"matrix\",\n options?: MatrixTableOptions\n ): MatrixTable;\n function require(\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable {\n switch (shape) {\n case \"headerless\": {\n const table = consumeTable(\n world,\n \"headerless\",\n options as HeaderlessTableOptions | undefined\n );\n if (!table) {\n throw new RangeError(\"No headerless data table is attached to the current step.\");\n }\n return table;\n }\n case \"horizontal\": {\n const table = consumeTable(\n world,\n \"horizontal\",\n options as HorizontalTableOptions | undefined\n );\n if (!table) {\n throw new RangeError(\"No horizontal data table is attached to the current step.\");\n }\n return table;\n }\n case \"vertical\": {\n const table = consumeTable(\n world,\n \"vertical\",\n options as VerticalTableOptions | undefined\n );\n if (!table) {\n throw new RangeError(\"No vertical data table is attached to the current step.\");\n }\n return table;\n }\n case \"matrix\": {\n const table = consumeTable(\n world,\n \"matrix\",\n options as MatrixTableOptions | undefined\n );\n if (!table) {\n throw new RangeError(\"No matrix data table is attached to the current step.\");\n }\n return table;\n }\n default:\n throw new RangeError(`Unsupported table shape: ${String(shape)}`);\n }\n }\n return require;\n}\n\nfunction cacheRuntime(world: unknown, runtime: StepRuntimeHelpers): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(carrier, STEP_RUNTIME_SYMBOL)) {\n Object.defineProperty(carrier, STEP_RUNTIME_SYMBOL, {\n value: runtime,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n } else {\n carrier[STEP_RUNTIME_SYMBOL] = runtime;\n }\n\n if (!Object.prototype.hasOwnProperty.call(carrier, \"runtime\")) {\n Object.defineProperty(carrier, \"runtime\", {\n get() {\n return carrier[STEP_RUNTIME_SYMBOL];\n },\n enumerable: false,\n configurable: true,\n });\n }\n}\n\nexport function createStepRuntime(world: unknown): StepRuntimeHelpers {\n const existing = getStepRuntimeFromWorld(world);\n if (existing) {\n return existing;\n }\n\n const getDocstringTransformed = (\n options?: { readonly fallback?: \"raw\" | \"throw\" }\n ): unknown | undefined => {\n const info = getDocstringInfo(world);\n if (!info) {\n return undefined;\n }\n const transformer = resolveDocstringTransformer(\n activeDocstringConfig.transformers,\n info.mediaType\n );\n if (!transformer) {\n if (options?.fallback === \"throw\") {\n const type = normalizeDocstringMediaType(info.mediaType) ?? \"<unknown>\";\n throw new RangeError(\n `No docstring transformer is configured for media type '${type}'.`\n );\n }\n return info.content;\n }\n return transformer(\n info.content,\n info.mediaType === undefined ? {} : { mediaType: info.mediaType }\n );\n };\n\n const runtime: StepRuntimeHelpers = {\n get hasTable() {\n return getRawTable(world) !== undefined;\n },\n get hasDocstring() {\n return getDocstring(world) !== undefined;\n },\n get currentStep() {\n return getStepMetadata(world);\n },\n getTable: bindGetTable(world),\n consumeTable: bindConsumeTable(world),\n getRawTable() {\n return getRawTable(world);\n },\n getDocstring() {\n return getDocstring(world);\n },\n getDocstringMediaType() {\n return getDocstringMediaType(world);\n },\n getDocstringInfo() {\n return getDocstringInfo(world);\n },\n consumeDocstring() {\n return consumeDocstring(world);\n },\n getDocstringTransformed,\n consumeDocstringTransformed(options) {\n const result = getDocstringTransformed(options);\n clearStepDocstring(world);\n return result;\n },\n getStepMetadata() {\n return getStepMetadata(world);\n },\n requireTable: bindRequireTable(world),\n };\n cacheRuntime(world, runtime);\n return runtime;\n}\n","import type { StepHandler } from \"@autometa/scopes\";\n\nconst PENDING_SCENARIO_SYMBOL: unique symbol = Symbol(\"autometa:scenario:pending\");\n\nexport class ScenarioPendingError extends Error {\n readonly reason?: string;\n readonly [PENDING_SCENARIO_SYMBOL] = true;\n\n constructor(reason?: string) {\n super(reason ? `Scenario pending: ${reason}` : \"Scenario pending\");\n this.name = \"ScenarioPendingError\";\n if (reason !== undefined && reason !== null) {\n const trimmed = String(reason).trim();\n if (trimmed.length > 0) {\n this.reason = trimmed;\n }\n }\n }\n}\n\nexport function isScenarioPendingError(error: unknown): error is ScenarioPendingError {\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as { [PENDING_SCENARIO_SYMBOL]?: unknown })[PENDING_SCENARIO_SYMBOL] === true\n );\n}\n\nfunction createPendingError(reason?: string): ScenarioPendingError {\n return new ScenarioPendingError(reason);\n}\n\n/**\n * Returns a step handler that marks the parent scenario as pending when executed.\n */\nexport function Pending<World = unknown>(reason?: string): StepHandler<World> {\n return function pendingStepHandler(world: World, ..._args: unknown[]): never {\n void world;\n throw createPendingError(reason);\n };\n}\n\n/**\n * Alias of {@link Pending} for teams that prefer the terminology used by some runners.\n */\nexport const ToDo = Pending;\n\n/**\n * Imperatively mark the current scenario as pending from within a step definition.\n *\n * @throws ScenarioPendingError to signal the executor that the scenario should be treated as pending.\n */\nexport function markScenarioPending(reason?: string): never {\n throw createPendingError(reason);\n}\n","import { generatePickleById } from \"@autometa/gherkin\";\nimport type {\n SimpleFeature,\n SimplePickle,\n SimplePickleFeatureRef,\n SimplePickleRuleRef,\n SimplePickleStep,\n SimpleRule,\n} from \"@autometa/gherkin\";\n\nexport function createFeatureRef(feature: SimpleFeature): SimplePickleFeatureRef {\n return {\n id: feature.id,\n name: feature.name,\n location: feature.location ?? { line: 1, column: 1 },\n tags: feature.tags,\n comments: feature.comments?.map((comment) => comment.text),\n };\n}\n\nexport function createRuleRef(rule: SimpleRule): SimplePickleRuleRef {\n return {\n id: rule.id,\n name: rule.name,\n location: rule.location ?? { line: 1, column: 1 },\n tags: rule.tags,\n };\n}\n\nexport function requirePickle(feature: SimpleFeature, scenarioId: string): SimplePickle {\n const pickle = generatePickleById(feature, scenarioId);\n if (!pickle) {\n throw new Error(\n `Unable to generate pickle for scenario \"${scenarioId}\". Ensure the feature contains compiled scenarios and stable ids.`\n );\n }\n return pickle;\n}\n\nexport function findPickleStep(\n pickle: SimplePickle,\n stepId: string\n): SimplePickleStep | undefined {\n return pickle.steps.find((step) => step.id === stepId || step.astNodeIds?.includes(stepId));\n}\n\n","import type { ExecutorConfig } from \"@autometa/config\";\nimport type { ScopeExecutionAdapter } from \"@autometa/scopes\";\nimport type {\n RuleNode,\n ScenarioExecution,\n ScenarioNode,\n ScenarioOutlineNode,\n ScenarioOutlineExample,\n TestPlan,\n} from \"@autometa/test-builder\";\nimport { getEventEmitter, TestStatus } from \"@autometa/events\";\nimport type { TestStatus as TestStatusValue } from \"@autometa/events\";\nimport { isGherkinStepError } from \"@autometa/errors\";\n\nimport { createTagFilter } from \"./tag-filter\";\nimport { resolveModeFromTags, selectSuiteByMode, selectTestByMode } from \"./modes\";\nimport { resolveTimeout } from \"./timeouts\";\nimport { runScenarioExecution } from \"./scenario-runner\";\nimport { ScopeLifecycle, type HookLogListener } from \"./scope-lifecycle\";\nimport type { ExecutorRuntime, SuiteFn } from \"./types\";\nimport { createFeatureRef, createRuleRef, requirePickle } from \"./events\";\n\nexport interface ExecuteFeatureOptions<World> {\n readonly plan: TestPlan<World>;\n readonly adapter: ScopeExecutionAdapter<World>;\n readonly runtime: ExecutorRuntime;\n readonly config: ExecutorConfig;\n readonly hookLogger?: HookLogListener;\n}\n\ntype SuiteMetadata = {\n readonly kind?: \"feature\" | \"rule\" | \"scenarioOutline\" | \"examples\";\n readonly keyword?: string;\n};\n\ntype SuiteFnWithMetadata = SuiteFn & {\n __withMetadata?: (metadata: SuiteMetadata | undefined, register: () => void) => void;\n};\n\ntype ScenarioOutlineExampleGroup<World> = {\n readonly group: ScenarioOutlineExample<World>[\"exampleGroup\"];\n readonly examples: ScenarioOutlineExample<World>[];\n};\n\ntype OutlineExampleCollection<World> = {\n readonly outline: ScenarioOutlineNode<World>;\n readonly order: string[];\n readonly groups: Map<string, ScenarioOutlineExampleGroup<World>>;\n};\n\nfunction runSuiteWithMetadata(\n suite: SuiteFn,\n metadata: SuiteMetadata,\n title: string,\n handler: () => void,\n timeout?: number\n): void {\n const target = suite as SuiteFnWithMetadata;\n if (typeof target.__withMetadata === \"function\") {\n target.__withMetadata(metadata, () => {\n suite(title, handler, timeout);\n });\n return;\n }\n suite(title, handler, timeout);\n}\n\nfunction isScenarioOutlineExample<World>(\n execution: ScenarioExecution<World>\n): execution is ScenarioOutlineExample<World> {\n return execution.type === \"example\";\n}\n\nfunction shouldDisplayExamplesGroup(group: ScenarioOutlineExample<unknown>[\"exampleGroup\"], totalGroups: number): boolean {\n if (totalGroups > 1) {\n return true;\n }\n\n const name = group.name?.trim();\n return Boolean(name && name.length > 0);\n}\n\nfunction formatExamplesGroupTitle(\n group: ScenarioOutlineExample<unknown>[\"exampleGroup\"],\n index: number\n): string {\n const trimmed = group.name?.trim();\n if (trimmed && trimmed.length > 0) {\n return trimmed;\n }\n return `Table #${index + 1}`;\n}\n\nexport function registerFeaturePlan<World>(options: ExecuteFeatureOptions<World>): void {\n const { plan, runtime, adapter, config, hookLogger } = options;\n const feature = plan.feature;\n const tagFilter = createTagFilter(config.test?.tagFilter);\n const scopeKeywords = collectScopeKeywords(feature);\n const eventEmitter = getEventEmitter();\n const featureRef = createFeatureRef(feature.feature);\n const lifecycle = new ScopeLifecycle(adapter, {\n ...(hookLogger ? { hookLogger } : {}),\n featureLanguage: feature.feature.language,\n scopeKeywords,\n });\n\n const featureTags = [\n ...(feature.feature.tags ?? []),\n ...(feature.scope.tags ?? []),\n ];\n const featureMode = resolveModeFromTags(feature.scope.mode, featureTags);\n const featureTimeout = resolveTimeout(feature.scope.timeout, config);\n const featureSuite = selectSuiteByMode(runtime.suite, featureMode);\n\n runSuiteWithMetadata(\n featureSuite,\n { kind: \"feature\", keyword: feature.keyword },\n feature.name,\n () => {\n runtime.beforeAll(async () => {\n await eventEmitter.featureStarted({ feature: featureRef });\n });\n runtime.afterAll(async () => {\n await eventEmitter.featureCompleted({ feature: featureRef });\n });\n lifecycle.configurePersistentScope(feature.scope, runtime);\n registerScenarios(feature.scenarios, runtime, config, tagFilter, lifecycle, feature.feature);\n registerScenarioOutlines(feature.scenarioOutlines, runtime, config, tagFilter, lifecycle, feature.feature, featureRef);\n registerRules(feature.rules, runtime, config, tagFilter, lifecycle, feature.feature, featureRef);\n },\n featureTimeout.milliseconds\n );\n}\n\nfunction collectScopeKeywords<World>(feature: TestPlan<World>[\"feature\"]): ReadonlyMap<string, string> {\n const entries: Array<[string, string]> = [];\n\n entries.push([feature.scope.id, feature.keyword]);\n\n for (const scenario of feature.scenarios) {\n entries.push([scenario.scope.id, scenario.keyword]);\n }\n\n for (const outline of feature.scenarioOutlines) {\n entries.push([outline.scope.id, outline.keyword]);\n for (const example of outline.examples) {\n entries.push([example.scope.id, example.keyword]);\n }\n }\n\n for (const rule of feature.rules) {\n entries.push([rule.scope.id, rule.keyword]);\n for (const scenario of rule.scenarios) {\n entries.push([scenario.scope.id, scenario.keyword]);\n }\n for (const outline of rule.scenarioOutlines) {\n entries.push([outline.scope.id, outline.keyword]);\n for (const example of outline.examples) {\n entries.push([example.scope.id, example.keyword]);\n }\n }\n }\n\n return new Map(entries);\n}\n\nfunction registerRules<World>(\n rules: readonly RuleNode<World>[],\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"],\n featureRef: ReturnType<typeof createFeatureRef>\n): void {\n const eventEmitter = getEventEmitter();\n for (const rule of rules) {\n const ruleRef = createRuleRef(rule.rule);\n const ruleTags = [\n ...(rule.rule.tags ?? []),\n ...(rule.scope.tags ?? []),\n ];\n const ruleMode = resolveModeFromTags(rule.scope.mode, ruleTags);\n const suite = selectSuiteByMode(runtime.suite, ruleMode);\n const timeout = resolveTimeout(rule.scope.timeout, config);\n runSuiteWithMetadata(\n suite,\n { kind: \"rule\", keyword: rule.keyword },\n rule.name,\n () => {\n runtime.beforeAll(async () => {\n await eventEmitter.ruleStarted({ feature: featureRef, rule: ruleRef });\n });\n runtime.afterAll(async () => {\n await eventEmitter.ruleCompleted({ feature: featureRef, rule: ruleRef });\n });\n lifecycle.configurePersistentScope(rule.scope, runtime);\n registerScenarios(rule.scenarios, runtime, config, tagFilter, lifecycle, feature);\n registerScenarioOutlines(rule.scenarioOutlines, runtime, config, tagFilter, lifecycle, feature, featureRef);\n },\n timeout.milliseconds\n );\n }\n}\n\nfunction registerScenarioOutlines<World>(\n outlines: readonly ScenarioOutlineNode<World>[],\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"],\n featureRef: ReturnType<typeof createFeatureRef>\n): void {\n const eventEmitter = getEventEmitter();\n for (const outline of outlines) {\n const outlineMode = resolveModeFromTags(outline.mode, outline.tags);\n const suite = selectSuiteByMode(runtime.suite, outlineMode);\n const timeout = resolveTimeout(outline.timeout, config);\n runSuiteWithMetadata(\n suite,\n { kind: \"scenarioOutline\", keyword: outline.keyword },\n outline.name,\n () => {\n const firstRule = outline.examples[0]?.rule?.rule;\n runtime.beforeAll(async () => {\n await eventEmitter.scenarioOutlineStarted({\n feature: featureRef,\n scenarioOutline: outline.outline,\n ...(firstRule ? { rule: createRuleRef(firstRule) } : {}),\n });\n });\n runtime.afterAll(async () => {\n await eventEmitter.scenarioOutlineCompleted({\n feature: featureRef,\n scenarioOutline: outline.outline,\n ...(firstRule ? { rule: createRuleRef(firstRule) } : {}),\n });\n });\n lifecycle.configurePersistentScope(outline.scope, runtime);\n registerScenarioExecutions(outline.examples, runtime, config, tagFilter, lifecycle, feature);\n },\n timeout.milliseconds\n );\n }\n}\n\nfunction registerScenarios<World>(\n scenarios: readonly ScenarioNode<World>[],\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"]\n): void {\n registerScenarioExecutions(scenarios, runtime, config, tagFilter, lifecycle, feature);\n}\n\nfunction registerScenarioExecutions<World>(\n executions: readonly ScenarioExecution<World>[],\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"]\n): void {\n const standaloneExecutions: ScenarioExecution<World>[] = [];\n const outlineExamples = new Map<string, OutlineExampleCollection<World>>();\n\n for (const execution of executions) {\n if (isScenarioOutlineExample(execution)) {\n const outlineId = execution.outline.scope.id;\n let collection = outlineExamples.get(outlineId);\n if (!collection) {\n collection = {\n outline: execution.outline,\n order: [],\n groups: new Map(),\n } satisfies OutlineExampleCollection<World>;\n outlineExamples.set(outlineId, collection);\n }\n\n const groupId = execution.exampleGroup.id;\n let groupInfo = collection.groups.get(groupId);\n if (!groupInfo) {\n groupInfo = {\n group: execution.exampleGroup,\n examples: [],\n } satisfies ScenarioOutlineExampleGroup<World>;\n collection.groups.set(groupId, groupInfo);\n collection.order.push(groupId);\n }\n\n groupInfo.examples.push(execution);\n continue;\n }\n\n standaloneExecutions.push(execution);\n }\n\n for (const execution of standaloneExecutions) {\n scheduleScenario(execution, runtime, config, tagFilter, lifecycle, feature);\n }\n\n for (const collection of outlineExamples.values()) {\n const orderedGroups = collection.order\n .map((id) => collection.groups.get(id))\n .filter((info): info is ScenarioOutlineExampleGroup<World> => Boolean(info));\n\n if (orderedGroups.length === 0) {\n continue;\n }\n\n if (orderedGroups.length === 1) {\n const [singleGroup] = orderedGroups;\n if (singleGroup && !shouldDisplayExamplesGroup(singleGroup.group, orderedGroups.length)) {\n for (const example of singleGroup.examples) {\n scheduleScenario(example, runtime, config, tagFilter, lifecycle, feature);\n }\n continue;\n }\n }\n\n orderedGroups.forEach((info, index) => {\n const title = formatExamplesGroupTitle(info.group, index);\n const keyword = (info.group.keyword ?? \"Examples\").trim() || \"Examples\";\n runSuiteWithMetadata(\n runtime.suite,\n { kind: \"examples\", keyword },\n title,\n () => {\n for (const example of info.examples) {\n scheduleScenario(example, runtime, config, tagFilter, lifecycle, feature);\n }\n }\n );\n });\n }\n}\n\nfunction scheduleScenario<World>(\n execution: ScenarioExecution<World>,\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"]\n): void {\n const title = buildScenarioTitle(execution);\n const eventEmitter = getEventEmitter();\n\n if (!tagFilter.evaluate(execution.tags)) {\n runtime.test.skip(title, () => undefined);\n return;\n }\n\n if (execution.pending) {\n execution.markPending(execution.pendingReason);\n registerPendingScenarioTest(execution, runtime, title);\n return;\n }\n\n const effectiveMode = resolveModeFromTags(execution.mode, execution.tags);\n const testFn = selectTestByMode(runtime.test, effectiveMode);\n const scenarioTimeout = resolveTimeout(execution.timeout, config);\n\n testFn(title, async () => {\n const hooks = lifecycle.collectScenarioHooks(execution);\n const pickle = requirePickle(feature, execution.gherkin.id);\n const scenarioScope = pickle.scenario;\n const isExample = isScenarioOutlineExample(execution);\n\n if (isExample) {\n await eventEmitter.exampleStarted({\n feature: pickle.feature,\n scenarioOutline: execution.outline.outline,\n example: execution.exampleGroup,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n });\n }\n\n await eventEmitter.scenarioStarted({\n feature: pickle.feature,\n scenario: scenarioScope,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n });\n\n let status: TestStatusValue | undefined;\n try {\n await lifecycle.runScenario(\n execution,\n hooks,\n async (_world, context) => {\n await runScenarioExecution(execution, context);\n },\n { events: { pickle } }\n );\n status = execution.result.status === \"passed\"\n ? TestStatus.PASSED\n : execution.result.status === \"failed\"\n ? TestStatus.FAILED\n : execution.result.status === \"skipped\"\n ? TestStatus.SKIPPED\n : execution.result.status === \"pending\"\n ? TestStatus.SKIPPED\n : undefined;\n } catch (error) {\n status = TestStatus.FAILED;\n if (!isGherkinStepError(error)) {\n await eventEmitter.errorRaised({\n error,\n phase: \"scenario\",\n feature: pickle.feature,\n scenario: pickle.scenario,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n pickle,\n });\n }\n throw error;\n } finally {\n if (status) {\n await eventEmitter.statusChanged({\n status,\n feature: pickle.feature,\n scenario: pickle.scenario,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n pickle,\n metadata: { result: execution.result },\n });\n }\n\n await eventEmitter.scenarioCompleted({\n feature: pickle.feature,\n scenario: scenarioScope,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n metadata: { result: execution.result },\n });\n\n if (isExample) {\n await eventEmitter.exampleCompleted({\n feature: pickle.feature,\n scenarioOutline: execution.outline.outline,\n example: execution.exampleGroup,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n metadata: { result: execution.result },\n });\n }\n }\n }, scenarioTimeout.milliseconds);\n}\n\nfunction registerPendingScenarioTest<World>(\n execution: ScenarioExecution<World>,\n runtime: ExecutorRuntime,\n title: string\n): void {\n const reason = execution.pendingReason;\n const { test } = runtime;\n\n if (typeof test.todo === \"function\") {\n test.todo(title, reason);\n return;\n }\n\n if (typeof test.pending === \"function\") {\n test.pending(title, reason);\n return;\n }\n\n if (typeof test.skip === \"function\") {\n test.skip(title, () => undefined);\n return;\n }\n\n test(title, () => undefined);\n}\n\nfunction buildScenarioTitle<World>(execution: ScenarioExecution<World>): string {\n if (!isScenarioOutlineExample(execution)) {\n return execution.name;\n }\n const descriptor = formatExampleDescriptor(execution);\n if (!descriptor) {\n return `${execution.name} [Example ${execution.exampleIndex + 1}]`;\n }\n return `${execution.name} [${descriptor}]`;\n}\n\nfunction formatExampleDescriptor<World>(\n example: ScenarioOutlineExample<World>\n): string | undefined {\n const segments: string[] = [];\n segments.push(`Example ${example.exampleIndex + 1}`);\n const groupName = example.exampleGroup.name?.trim();\n if (groupName) {\n segments.push(groupName);\n }\n const valueSummary = formatExampleValues(example.exampleGroup, example.exampleIndex);\n if (valueSummary) {\n segments.push(valueSummary);\n }\n return segments.length > 0 ? segments.join(\" · \") : undefined;\n}\n\nfunction formatExampleValues(\n group: ScenarioOutlineExample<unknown>[\"exampleGroup\"],\n index: number\n): string | undefined {\n const headers = group.tableHeader ?? [];\n const rows = group.tableBody ?? [];\n const row = rows[index];\n if (!row || headers.length === 0) {\n return undefined;\n }\n const pairs: string[] = [];\n headers.forEach((header, headerIndex) => {\n const key = header?.trim();\n if (!key) {\n return;\n }\n const value = row[headerIndex] ?? \"\";\n pairs.push(`${key}=${String(value).trim()}`);\n });\n return pairs.length > 0 ? pairs.join(\", \") : undefined;\n}\n","import * as TagExpressions from \"@cucumber/tag-expressions\";\n\nexport interface TagFilter {\n evaluate(tags: readonly string[]): boolean;\n}\n\nconst ALWAYS_TRUE: TagFilter = {\n evaluate: () => true,\n};\n\ntype TagExpressionParser = (expression: string) => { evaluate(tags: readonly string[]): boolean };\n\nconst resolveParser = (): TagExpressionParser => {\n const namespace = TagExpressions as {\n readonly parse?: unknown;\n readonly default?: unknown;\n };\n\n if (typeof namespace.parse === \"function\") {\n return namespace.parse as TagExpressionParser;\n }\n\n if (typeof namespace.default === \"function\") {\n return namespace.default as TagExpressionParser;\n }\n\n throw new Error(\"Unable to resolve @cucumber/tag-expressions parser export\");\n};\n\nconst parseExpression = resolveParser();\n\nexport const createTagFilter = (expression: string | undefined): TagFilter => {\n if (!expression || expression.trim().length === 0) {\n return ALWAYS_TRUE;\n }\n\n const parsed = parseExpression(expression);\n return {\n evaluate(tags: readonly string[]) {\n return parsed.evaluate(tags.map((tag) => tag.trim()));\n },\n };\n};\n","import type { ExecutionMode } from \"@autometa/scopes\";\nimport type { SuiteFn, TestFn } from \"./types\";\n\nconst MODE_TAG_ALIASES: Record<string, ExecutionMode> = {\n concurrent: \"concurrent\",\n sequential: \"sequential\",\n failing: \"failing\",\n fails: \"failing\",\n};\n\nfunction normalizeTagValue(tag: string): string {\n return tag.replace(/^@/, \"\").trim().toLowerCase();\n}\n\nfunction wrapFailingTest(test: TestFn): TestFn {\n const failing = ((title: string, handler: () => void | Promise<void>, timeout?: number) => {\n const wrapped = async () => {\n let threw = false;\n try {\n await handler();\n } catch (_error) {\n threw = true;\n return;\n }\n\n if (!threw) {\n throw new Error(\"Expected scenario to fail, but it passed\");\n }\n };\n\n test(title, wrapped, timeout);\n }) as TestFn;\n\n failing.skip = test.skip;\n failing.only = test.only;\n if (typeof test.concurrent === \"function\") {\n failing.concurrent = test.concurrent;\n }\n failing.failing = failing;\n failing.fails = failing;\n\n return failing;\n}\n\nfunction selectFailingTest(test: TestFn): TestFn {\n if (typeof test.failing === \"function\") {\n return test.failing;\n }\n if (typeof test.fails === \"function\") {\n return test.fails;\n }\n return wrapFailingTest(test);\n}\n\nexport const selectSuiteByMode = (suite: SuiteFn, mode: ExecutionMode): SuiteFn => {\n switch (mode) {\n case \"skip\":\n return suite.skip;\n case \"only\":\n return suite.only;\n case \"concurrent\":\n return typeof suite.concurrent === \"function\" ? suite.concurrent : suite;\n case \"sequential\":\n return typeof suite.sequential === \"function\" ? suite.sequential : suite;\n default:\n return suite;\n }\n};\n\nexport const selectTestByMode = (test: TestFn, mode: ExecutionMode): TestFn => {\n switch (mode) {\n case \"skip\":\n return test.skip;\n case \"only\":\n return test.only;\n case \"concurrent\":\n return typeof test.concurrent === \"function\" ? test.concurrent : test;\n case \"sequential\":\n return typeof test.sequential === \"function\" ? test.sequential : test;\n case \"failing\":\n return selectFailingTest(test);\n default:\n return test;\n }\n};\n\nexport const resolveModeFromTags = (\n currentMode: ExecutionMode,\n tags: readonly string[] | undefined\n): ExecutionMode => {\n if (currentMode !== \"default\") {\n return currentMode;\n }\n\n if (!tags || tags.length === 0) {\n return currentMode;\n }\n\n for (const tag of tags) {\n const normalized = normalizeTagValue(tag);\n const derived = MODE_TAG_ALIASES[normalized];\n if (derived) {\n return derived;\n }\n }\n\n return currentMode;\n};\n","import type {\n HookType,\n ParameterRegistryLike,\n ScopeExecutionAdapter,\n ScopeKind,\n ScopeNode,\n StepDefinition,\n} from \"@autometa/scopes\";\nimport { getEventEmitter } from \"@autometa/events\";\nimport type { HookDescriptor, HookKind } from \"@autometa/events\";\nimport type { SimpleStep } from \"@autometa/gherkin\";\nimport type { SimplePickle } from \"@autometa/gherkin\";\nimport type { ScenarioExecution } from \"@autometa/test-builder\";\n\nimport { collectScenarioHooks, type HookCollection, type ResolvedHook } from \"./hooks\";\nimport type { ExecutorRuntime } from \"./types\";\nimport { WorldContext } from \"./async-context\";\nimport { findPickleStep } from \"./events\";\n\nconst PERSISTENT_SCOPE_KINDS: ReadonlySet<ScopeKind> = new Set([\n \"feature\",\n \"rule\",\n \"scenarioOutline\",\n]);\n\nconst BEFORE_HOOK_TYPES: Record<ScopeKind, HookType | undefined> = {\n root: undefined,\n feature: \"beforeFeature\",\n rule: \"beforeRule\",\n scenario: \"beforeScenario\",\n scenarioOutline: \"beforeScenarioOutline\",\n};\n\nconst AFTER_HOOK_TYPES: Record<ScopeKind, HookType | undefined> = {\n root: undefined,\n feature: \"afterFeature\",\n rule: \"afterRule\",\n scenario: \"afterScenario\",\n scenarioOutline: \"afterScenarioOutline\",\n};\n\ninterface ScopeState<World> {\n readonly scope: ScopeNode<World>;\n readonly world: World;\n readonly dispose: () => Promise<void>;\n beforeExecuted: boolean;\n afterExecuted: boolean;\n}\n\nexport type StepStatus = \"passed\" | \"failed\" | \"skipped\";\n\nexport interface HookLifecycleTargetScopeMetadata {\n readonly id: string;\n readonly kind: ScopeKind;\n readonly name?: string;\n}\n\ntype ScenarioLifecycleType = ScenarioExecution<unknown>[\"type\"];\n\nexport interface HookLifecycleScenarioMetadata {\n readonly id: string;\n readonly name: string;\n readonly type: ScenarioLifecycleType;\n readonly tags: readonly string[];\n readonly qualifiedName: string;\n}\n\nexport interface HookLifecycleStepMetadata {\n readonly index: number;\n readonly keyword?: string;\n readonly text?: string;\n readonly status?: StepStatus;\n}\n\nexport interface HookLifecycleMetadata {\n readonly targetScope: HookLifecycleTargetScopeMetadata;\n readonly scenario?: HookLifecycleScenarioMetadata;\n readonly step?: HookLifecycleStepMetadata;\n readonly hook?: unknown;\n readonly [key: string]: unknown;\n}\n\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] };\n\nexport interface StepHookDetails<World> {\n readonly index: number;\n readonly definition?: StepDefinition<World>;\n readonly gherkin?: SimpleStep;\n readonly status?: StepStatus;\n}\n\nexport interface StepHookInvocationOptions<World> {\n readonly direction?: HookDirection;\n readonly step?: StepHookDetails<World>;\n readonly metadata?: Record<string, unknown>;\n}\n\nexport type HookInvoker<World> = (\n hooks: readonly ResolvedHook<World>[],\n options: StepHookInvocationOptions<World>\n) => Promise<void>;\n\nexport interface HookLogPathSegment {\n readonly id: string;\n readonly kind: ScopeKind | \"step\";\n readonly name: string;\n readonly keyword?: string;\n}\n\nexport interface HookLogStepDetails {\n readonly index: number;\n readonly keyword?: string;\n readonly text?: string;\n readonly status?: StepStatus;\n}\n\nexport interface HookLogScenarioDetails {\n readonly id: string;\n readonly name: string;\n readonly fullName: string;\n readonly keyword?: string;\n readonly language?: string;\n}\n\nexport type HookLogPhase = \"before\" | \"after\";\n\nexport interface HookLogEvent {\n readonly message: string;\n readonly hookId: string;\n readonly hookType: HookType;\n readonly hookDescription?: string;\n readonly phase: HookLogPhase;\n readonly path: readonly HookLogPathSegment[];\n readonly scenario?: HookLogScenarioDetails;\n readonly step?: HookLogStepDetails;\n readonly targetKeyword?: string;\n readonly language?: string;\n}\n\nexport type HookLogListener = (event: HookLogEvent) => void;\n\nexport interface ScopeLifecycleOptions {\n readonly hookLogger?: HookLogListener;\n readonly featureLanguage?: string;\n readonly scopeKeywords?: ReadonlyMap<string, string>;\n}\n\nexport interface ScenarioEventContext {\n readonly pickle: SimplePickle;\n}\n\nexport interface ScenarioRunContext<World> {\n readonly world: World;\n readonly parameterRegistry: ParameterRegistryLike | undefined;\n readonly beforeStepHooks: readonly ResolvedHook<World>[];\n readonly afterStepHooks: readonly ResolvedHook<World>[];\n readonly events?: ScenarioEventContext;\n invokeHooks: HookInvoker<World>;\n}\n\ninterface HookInvocationParams<World> {\n readonly world: World;\n readonly scope: ScopeNode<World>;\n readonly scenario?: ScenarioExecution<World>;\n readonly step?: StepHookDetails<World>;\n readonly direction?: HookDirection;\n readonly metadata?: Record<string, unknown>;\n readonly events?: ScenarioEventContext;\n}\n\ntype HookDirection = \"asc\" | \"desc\";\n\nfunction formatSourceRef(source: { file?: string; line?: number; column?: number } | undefined): string | undefined {\n if (!source?.file) {\n return undefined;\n }\n const line = source.line ? `:${source.line}` : \"\";\n const column = source.column ? `:${source.column}` : \"\";\n return `${source.file}${line}${column}`;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport class ScopeLifecycle<World> {\n private readonly states = new Map<string, ScopeState<World>>();\n private readonly depthMap = new Map<string, number>();\n private readonly root: ScopeNode<World>;\n private readonly hookLogger?: HookLogListener;\n private readonly featureLanguage: string | undefined;\n private readonly scopeKeywords: ReadonlyMap<string, string>;\n\n constructor(\n private readonly adapter: ScopeExecutionAdapter<World>,\n options: ScopeLifecycleOptions = {}\n ) {\n this.root = adapter.plan.root;\n this.buildDepthMap(this.root, 0);\n if (options.hookLogger) {\n this.hookLogger = options.hookLogger;\n }\n this.featureLanguage = options.featureLanguage;\n this.scopeKeywords = options.scopeKeywords ?? new Map<string, string>();\n }\n\n configurePersistentScope(scope: ScopeNode<World>, runtime: ExecutorRuntime): void {\n if (!this.isPersistentScope(scope)) {\n return;\n }\n\n // Avoid creating feature/rule/outline worlds unless they are actually needed.\n // This preserves the common \"one world per scenario\" model and prevents\n // surprising extra world instantiations when no hooks exist for the scope.\n if (!this.shouldMaterializePersistentScope(scope)) {\n return;\n }\n\n runtime.beforeAll(async () => {\n await this.ensureState(scope);\n });\n\n runtime.afterAll(async () => {\n await this.teardownState(scope);\n });\n }\n\n collectScenarioHooks(execution: ScenarioExecution<World>): HookCollection<World> {\n return collectScenarioHooks(this.adapter, execution);\n }\n\n async runScenario(\n execution: ScenarioExecution<World>,\n hooks: HookCollection<World>,\n runner: (world: World, context: ScenarioRunContext<World>) => Promise<void>,\n options: { readonly events?: ScenarioEventContext } = {}\n ): Promise<void> {\n const parentWorld = await this.resolveParentWorldForScenario(execution);\n const world = await this.adapter.createWorld(execution.scope, parentWorld);\n const disposeWorld = createWorldDisposer(world);\n const invokeHooks = this.createHookInvoker(execution, world, options.events);\n\n const scenarioContext: ScenarioRunContext<World> = {\n world,\n parameterRegistry: this.adapter.getParameterRegistry(),\n beforeStepHooks: hooks.beforeStep,\n afterStepHooks: hooks.afterStep,\n ...(options.events ? { events: options.events } : {}),\n invokeHooks,\n };\n\n const errors: unknown[] = [];\n try {\n await WorldContext.run(world, async () => {\n await this.invokeHooks(hooks.beforeScenario, {\n world,\n scope: execution.scope,\n scenario: execution,\n ...(options.events ? { events: options.events } : {}),\n direction: \"asc\",\n });\n\n await runner(world, scenarioContext);\n });\n } catch (error) {\n errors.push(error);\n } finally {\n try {\n await this.invokeHooks(hooks.afterScenario, {\n world,\n scope: execution.scope,\n scenario: execution,\n ...(options.events ? { events: options.events } : {}),\n direction: \"desc\",\n metadata: { result: execution.result },\n });\n } catch (error) {\n errors.push(error);\n }\n\n try {\n await disposeWorld();\n } catch (error) {\n errors.push(error);\n }\n }\n\n if (errors.length === 1) {\n throw toError(errors[0], \"Scenario execution failed\");\n }\n\n if (errors.length > 1) {\n throw combineErrors(errors, \"Multiple errors occurred during scenario execution\");\n }\n }\n\n private async ensureState(scope: ScopeNode<World>): Promise<ScopeState<World>> {\n let state = this.states.get(scope.id);\n if (state) {\n if (!state.beforeExecuted) {\n await this.runScopeHooks(scope, \"before\", state.world);\n state.beforeExecuted = true;\n }\n return state;\n }\n\n await this.ensureAncestorStates(scope);\n\n const parentWorld = await this.resolveParentWorld(scope);\n const world = await this.adapter.createWorld(scope, parentWorld);\n const dispose = createWorldDisposer(world);\n\n state = {\n scope,\n world,\n dispose,\n beforeExecuted: false,\n afterExecuted: false,\n } satisfies ScopeState<World>;\n\n this.states.set(scope.id, state);\n\n await this.runScopeHooks(scope, \"before\", world);\n state.beforeExecuted = true;\n\n return state;\n }\n\n private async teardownState(scope: ScopeNode<World>): Promise<void> {\n const state = this.states.get(scope.id);\n if (!state) {\n return;\n }\n\n if (!state.afterExecuted) {\n await this.runScopeHooks(scope, \"after\", state.world);\n state.afterExecuted = true;\n }\n\n await state.dispose();\n this.states.delete(scope.id);\n }\n\n private async ensureAncestorStates(scope: ScopeNode<World>): Promise<void> {\n const parent = this.getParentScope(scope);\n if (!parent) {\n return;\n }\n\n if (!this.isPersistentScope(parent)) {\n return;\n }\n\n if (!this.shouldMaterializePersistentScope(parent)) {\n return;\n }\n\n await this.ensureState(parent);\n }\n\n private async resolveParentWorld(scope: ScopeNode<World>): Promise<World | undefined> {\n const parent = this.getParentScope(scope);\n if (!parent || !this.isPersistentScope(parent)) {\n return undefined;\n }\n\n if (!this.shouldMaterializePersistentScope(parent)) {\n return undefined;\n }\n\n const parentState = this.states.get(parent.id) ?? (await this.ensureState(parent));\n return parentState.world;\n }\n\n private async resolveParentWorldForScenario(\n execution: ScenarioExecution<World>\n ): Promise<World | undefined> {\n const scope = execution.scope;\n const ownState = this.states.get(scope.id);\n if (ownState) {\n return ownState.world;\n }\n\n const ancestors = this.adapter.getAncestors(scope.id);\n for (let index = ancestors.length - 1; index >= 0; index -= 1) {\n const candidate = ancestors[index];\n if (!candidate || !this.isPersistentScope(candidate)) {\n continue;\n }\n\n if (!this.shouldMaterializePersistentScope(candidate)) {\n continue;\n }\n const state = this.states.get(candidate.id) ?? (await this.ensureState(candidate));\n if (state) {\n return state.world;\n }\n }\n return undefined;\n }\n\n private getParentScope(scope: ScopeNode<World>): ScopeNode<World> | undefined {\n const ancestors = this.adapter.getAncestors(scope.id);\n if (ancestors.length === 0) {\n return undefined;\n }\n return ancestors[ancestors.length - 1];\n }\n\n private isPersistentScope(scope: ScopeNode<World>): boolean {\n return PERSISTENT_SCOPE_KINDS.has(scope.kind);\n }\n\n private shouldMaterializePersistentScope(scope: ScopeNode<World>): boolean {\n const beforeType = BEFORE_HOOK_TYPES[scope.kind];\n const afterType = AFTER_HOOK_TYPES[scope.kind];\n\n if (beforeType) {\n const hooks = this.collectHooksForScope(scope, beforeType);\n if (hooks.length > 0) {\n return true;\n }\n }\n\n if (afterType) {\n const hooks = this.collectHooksForScope(scope, afterType);\n if (hooks.length > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n private async runScopeHooks(\n scope: ScopeNode<World>,\n phase: \"before\" | \"after\",\n world: World\n ): Promise<void> {\n const hookType = phase === \"before\" ? BEFORE_HOOK_TYPES[scope.kind] : AFTER_HOOK_TYPES[scope.kind];\n if (!hookType) {\n return;\n }\n\n const hooks = this.collectHooksForScope(scope, hookType);\n if (!hooks.length) {\n return;\n }\n\n await this.invokeHooks(hooks, {\n world,\n scope,\n direction: phase === \"before\" ? \"asc\" : \"desc\",\n });\n }\n\n private createHookInvoker(\n execution: ScenarioExecution<World>,\n world: World,\n events?: ScenarioEventContext\n ): HookInvoker<World> {\n return async (hooks, options) => {\n const params: HookInvocationParams<World> = {\n world,\n scope: execution.scope,\n scenario: execution,\n ...(events ? { events } : {}),\n ...(options.direction ? { direction: options.direction } : {}),\n ...(options.step ? { step: options.step } : {}),\n ...(options.metadata ? { metadata: options.metadata } : {}),\n };\n\n await this.invokeHooks(hooks, params);\n };\n }\n\n private async invokeHooks(\n hooks: readonly ResolvedHook<World>[],\n params: HookInvocationParams<World>\n ): Promise<void> {\n if (hooks.length === 0) {\n return;\n }\n\n const sorted = this.sortHooks(hooks, params.direction ?? \"asc\");\n const eventEmitter = getEventEmitter();\n const pickle = params.events?.pickle;\n\n for (const entry of sorted) {\n const source = formatSourceRef(entry.hook.source ?? entry.scope.source);\n const hookMetadata = isRecord(entry.hook.options.data)\n ? entry.hook.options.data\n : undefined;\n const pickleStep = pickle && params.step?.gherkin?.id\n ? findPickleStep(pickle, params.step.gherkin.id)\n : undefined;\n const hookDescriptor: HookDescriptor = {\n kind: entry.hook.type as HookKind,\n ...(entry.hook.description ? { name: entry.hook.description } : {}),\n ...(source ? { source } : {}),\n ...(pickle ? { feature: pickle.feature } : {}),\n ...(pickle?.rule ? { rule: pickle.rule } : {}),\n ...(pickle ? { scenario: pickle.scenario } : {}),\n ...(pickleStep ? { step: pickleStep } : {}),\n ...(pickle ? { pickle } : {}),\n ...(hookMetadata ? { metadata: hookMetadata } : {}),\n };\n\n await eventEmitter.hookStarted({\n hook: hookDescriptor,\n metadata: { hookId: entry.hook.id },\n });\n\n const metadata = this.buildHookMetadata(entry, params);\n const log = this.createContextLogger(entry, params);\n const context = {\n world: params.world,\n scope: entry.scope,\n ...(metadata ? { metadata } : {}),\n ...(log ? { log } : {}),\n } as const;\n\n try {\n // eslint-disable-next-line no-await-in-loop\n await entry.hook.handler(context);\n } catch (error) {\n await eventEmitter.errorRaised({\n error,\n phase: \"hook\",\n ...(pickle ? { feature: pickle.feature } : {}),\n ...(pickle?.rule ? { rule: pickle.rule } : {}),\n ...(pickle ? { scenario: pickle.scenario } : {}),\n ...(pickle ? { pickle } : {}),\n metadata: { hook: hookDescriptor, hookId: entry.hook.id },\n });\n throw error;\n } finally {\n await eventEmitter.hookCompleted({\n hook: hookDescriptor,\n metadata: { hookId: entry.hook.id },\n });\n }\n }\n }\n\n private buildHookMetadata(\n entry: ResolvedHook<World>,\n params: HookInvocationParams<World>\n ): HookLifecycleMetadata | undefined {\n const metadata: Partial<Mutable<HookLifecycleMetadata>> & Record<string, unknown> = {};\n\n if (params.metadata) {\n Object.assign(metadata, params.metadata);\n }\n\n if (entry.hook.options.data !== undefined) {\n metadata.hook = entry.hook.options.data;\n }\n\n metadata.targetScope = {\n id: params.scope.id,\n kind: params.scope.kind,\n name: params.scope.name,\n } as HookLifecycleTargetScopeMetadata;\n\n if (params.scenario) {\n metadata.scenario = {\n id: params.scenario.id,\n name: params.scenario.name,\n type: params.scenario.type,\n tags: params.scenario.tags,\n qualifiedName: params.scenario.qualifiedName,\n } as HookLifecycleScenarioMetadata;\n }\n\n if (params.step) {\n const { step } = params;\n metadata.step = {\n index: step.index,\n status: step.status,\n keyword: step.gherkin?.keyword ?? step.definition?.keyword,\n text: step.gherkin?.text,\n } as HookLifecycleStepMetadata;\n }\n\n return Object.keys(metadata).length > 0 ? (metadata as HookLifecycleMetadata) : undefined;\n }\n\n private collectHooksForScope(\n scope: ScopeNode<World>,\n type: HookType\n ): ResolvedHook<World>[] {\n const chain = this.buildChain(scope);\n const collected: ResolvedHook<World>[] = [];\n\n for (const candidate of chain) {\n for (const hook of candidate.hooks) {\n if (hook.type === type) {\n collected.push({ hook, scope: candidate });\n }\n }\n }\n\n return collected;\n }\n\n private buildChain(scope: ScopeNode<World>): ScopeNode<World>[] {\n const ancestors = this.adapter.getAncestors(scope.id);\n return [this.root, ...ancestors, scope];\n }\n\n private createContextLogger(\n entry: ResolvedHook<World>,\n params: HookInvocationParams<World>\n ): ((message: string) => void) | undefined {\n if (!this.hookLogger) {\n return undefined;\n }\n\n const emit = this.hookLogger;\n return (rawMessage: string) => {\n if (rawMessage === undefined || rawMessage === null) {\n return;\n }\n const message = String(rawMessage);\n if (message.length === 0) {\n return;\n }\n try {\n emit(this.buildHookLogEvent(entry, params, message));\n } catch (error) {\n if (typeof console !== \"undefined\" && typeof console.error === \"function\") {\n console.error(error);\n }\n }\n };\n }\n\n private buildHookLogEvent(\n entry: ResolvedHook<World>,\n params: HookInvocationParams<World>,\n message: string\n ): HookLogEvent {\n const ancestors = this.adapter.getAncestors(params.scope.id);\n const path: HookLogPathSegment[] = ancestors.map((node) => this.toPathSegment(node));\n const targetSegment = this.toPathSegment(params.scope);\n path.push(targetSegment);\n\n const direction = params.direction ?? \"asc\";\n const phase: HookLogPhase = direction === \"desc\" ? \"after\" : \"before\";\n\n const scenarioIndex = this.findScenarioSegmentIndex(path);\n const scenarioDetails = this.buildScenarioDetails(path, scenarioIndex, params);\n\n const language = this.resolveLanguage(params, scenarioDetails);\n const targetKeyword = this.scopeKeywords.get(params.scope.id);\n\n if (params.step) {\n path.push(this.toStepSegment(params.scope, params.step));\n }\n\n return {\n message,\n hookId: entry.hook.id,\n hookType: entry.hook.type,\n ...(entry.hook.description ? { hookDescription: entry.hook.description } : {}),\n phase,\n path,\n ...(scenarioDetails ? { scenario: scenarioDetails } : {}),\n ...(params.step ? { step: this.toStepDetails(params.step) } : {}),\n ...(targetKeyword ? { targetKeyword } : {}),\n ...(language ? { language } : {}),\n };\n }\n\n private toPathSegment(scope: ScopeNode<World>): HookLogPathSegment {\n const keyword = this.scopeKeywords.get(scope.id);\n return {\n id: scope.id,\n kind: scope.kind,\n name: scope.name,\n ...(keyword ? { keyword } : {}),\n };\n }\n\n private toStepSegment(\n scope: ScopeNode<World>,\n step: StepHookDetails<World>\n ): HookLogPathSegment {\n const keyword = step.gherkin?.keyword ?? step.definition?.keyword;\n return {\n id: `${scope.id}:step:${step.index}`,\n kind: \"step\",\n name: this.describeStep(step),\n ...(keyword ? { keyword: keyword.trim() } : {}),\n };\n }\n\n private toStepDetails(step: StepHookDetails<World>): HookLogStepDetails {\n return {\n index: step.index,\n ...(step.gherkin?.keyword ? { keyword: step.gherkin.keyword } : {}),\n ...(step.gherkin?.text ? { text: step.gherkin.text } : {}),\n ...(step.status ? { status: step.status } : {}),\n };\n }\n\n private describeStep(step: StepHookDetails<World>): string {\n const keyword = step.gherkin?.keyword ?? step.definition?.keyword;\n const text = step.gherkin?.text ?? this.describeStepExpression(step.definition);\n\n if (keyword) {\n const trimmedKeyword = keyword.trim();\n if (text && text.length > 0) {\n const needsSpace = text.startsWith(\" \");\n return `${trimmedKeyword}${needsSpace ? \"\" : \" \"}${text}`;\n }\n return trimmedKeyword;\n }\n\n if (text && text.length > 0) {\n return text;\n }\n\n return `Step #${step.index + 1}`;\n }\n\n private describeStepExpression(\n definition: StepDefinition<World> | undefined\n ): string | undefined {\n if (!definition) {\n return undefined;\n }\n\n const expression = definition.expression;\n if (typeof expression === \"string\") {\n return expression;\n }\n return expression.toString();\n }\n\n private findScenarioSegmentIndex(path: readonly HookLogPathSegment[]): number {\n for (let index = path.length - 1; index >= 0; index -= 1) {\n const segment = path[index];\n if (!segment) {\n continue;\n }\n if (segment.kind === \"scenario\") {\n return index;\n }\n if (segment.kind === \"scenarioOutline\") {\n return index;\n }\n }\n return -1;\n }\n\n private buildScenarioDetails(\n path: readonly HookLogPathSegment[],\n scenarioIndex: number,\n params: HookInvocationParams<World>\n ): HookLogScenarioDetails | undefined {\n if (scenarioIndex < 0) {\n return undefined;\n }\n\n const scenarioSegment = path[scenarioIndex];\n if (!scenarioSegment) {\n return undefined;\n }\n\n const segments = path.slice(0, scenarioIndex + 1).map((segment) => segment.name);\n const fullName = segments.join(\" › \");\n\n const scenario = params.scenario;\n const keyword = scenario?.keyword ?? scenarioSegment.keyword;\n const language = scenario?.feature.feature.language ?? this.featureLanguage;\n if (scenario) {\n return {\n id: scenario.id,\n name: scenario.name,\n fullName,\n ...(keyword ? { keyword } : {}),\n ...(language ? { language } : {}),\n };\n }\n\n return {\n id: scenarioSegment.id,\n name: scenarioSegment.name,\n fullName,\n ...(keyword ? { keyword } : {}),\n ...(language ? { language } : {}),\n };\n }\n\n private resolveLanguage(\n params: HookInvocationParams<World>,\n scenarioDetails: HookLogScenarioDetails | undefined\n ): string | undefined {\n if (params.scenario) {\n const scenarioLanguage = params.scenario.feature.feature.language;\n if (scenarioLanguage) {\n return scenarioLanguage;\n }\n }\n\n if (scenarioDetails?.language) {\n return scenarioDetails.language;\n }\n\n return this.featureLanguage;\n }\n\n private sortHooks(\n hooks: readonly ResolvedHook<World>[],\n direction: HookDirection\n ): ResolvedHook<World>[] {\n return hooks\n .slice()\n .sort((a, b) => this.compareHooks(a, b, direction));\n }\n\n private compareHooks(\n a: ResolvedHook<World>,\n b: ResolvedHook<World>,\n direction: HookDirection\n ): number {\n const orderA = a.hook.options.order ?? 5;\n const orderB = b.hook.options.order ?? 5;\n if (orderA !== orderB) {\n return direction === \"asc\" ? orderA - orderB : orderB - orderA;\n }\n\n const depthA = this.depthMap.get(a.scope.id) ?? 0;\n const depthB = this.depthMap.get(b.scope.id) ?? 0;\n if (depthA !== depthB) {\n // Default ordering prefers the most nested hook:\n // - \"before\" hooks run deepest → shallowest\n // - \"after\" hooks run shallowest → deepest\n return direction === \"asc\" ? depthB - depthA : depthA - depthB;\n }\n\n return a.hook.id.localeCompare(b.hook.id);\n }\n\n private buildDepthMap(node: ScopeNode<World>, depth: number): void {\n this.depthMap.set(node.id, depth);\n for (const child of node.children) {\n this.buildDepthMap(child, depth + 1);\n }\n }\n}\n\ninterface DisposableLike {\n dispose(): void | Promise<void>;\n}\n\nfunction normalizeError(value: unknown, fallbackMessage: string): Error {\n if (value instanceof Error) {\n return value;\n }\n const error = new Error(fallbackMessage);\n Object.defineProperty(error, \"cause\", {\n configurable: true,\n enumerable: false,\n writable: true,\n value,\n });\n return error;\n}\n\nfunction toError(value: unknown, fallbackMessage: string): Error {\n return normalizeError(value, fallbackMessage);\n}\n\nfunction combineErrors(values: readonly unknown[], message: string): Error {\n const normalized = values.map((value, index) =>\n normalizeError(value, `${message} (${index + 1})`)\n );\n const aggregate = new Error(message);\n Object.defineProperty(aggregate, \"cause\", {\n configurable: true,\n enumerable: false,\n writable: true,\n value: normalized,\n });\n return aggregate;\n}\n\nfunction createWorldDisposer(world: unknown): () => Promise<void> {\n const disposers: Array<() => Promise<void>> = [];\n\n if (world && typeof world === \"object\") {\n const record = world as Record<string, unknown>;\n\n const app = record.app;\n if (isDisposable(app)) {\n disposers.push(async () => {\n await app.dispose();\n });\n }\n\n const container = (record.di ?? record.container) as unknown;\n if (isDisposable(container)) {\n disposers.push(async () => {\n await container.dispose();\n });\n }\n }\n\n return async () => {\n if (disposers.length === 0) {\n return;\n }\n\n const errors: unknown[] = [];\n for (const dispose of disposers) {\n try {\n await dispose();\n } catch (error) {\n errors.push(error);\n }\n }\n\n if (errors.length === 1) {\n throw toError(errors[0], \"World disposal failed\");\n }\n\n if (errors.length > 1) {\n throw combineErrors(errors, \"Multiple errors occurred while disposing world resources\");\n }\n };\n}\n\nfunction isDisposable(value: unknown): value is DisposableLike {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n const candidate = value as Record<string, unknown>;\n const dispose = candidate.dispose;\n return typeof dispose === \"function\";\n}\n","import { AsyncLocalStorage } from \"node:async_hooks\";\n\nconst WORLD_CONTEXT_KEY = \"__AUTOMETA_EXECUTOR_WORLD_CONTEXT__\";\n\ntype GlobalWithWorldContext = typeof globalThis & {\n [WORLD_CONTEXT_KEY]?: AsyncLocalStorage<unknown>;\n};\n\nconst globalTarget = globalThis as GlobalWithWorldContext;\n\nconst getOrCreateWorldContext = (): AsyncLocalStorage<unknown> => {\n const existing = globalTarget[WORLD_CONTEXT_KEY];\n if (existing) {\n return existing;\n }\n const created = new AsyncLocalStorage<unknown>();\n globalTarget[WORLD_CONTEXT_KEY] = created;\n return created;\n};\n\nexport const WorldContext = getOrCreateWorldContext();\n\nexport function getWorld<T = unknown>(): T {\n const store = WorldContext.getStore();\n if (store === undefined) {\n throw new Error(\n \"World context is not available. Are you running inside a scenario?\"\n );\n }\n return store as T;\n}\n\nexport function tryGetWorld<T = unknown>(): T | undefined {\n return WorldContext.getStore() as T | undefined;\n}\n","export { resolveTimeout, chooseTimeout, TimeoutResolution, TimeoutSource } from \"./timeouts\";\nexport { collectScenarioHooks, HookCollection, ResolvedHook } from \"./hooks\";\nexport { runScenarioExecution, ScenarioRunContext } from \"./scenario-runner\";\nexport { registerFeaturePlan, ExecuteFeatureOptions } from \"./execute-plan\";\nexport {\n\tScopeLifecycle,\n\ttype HookLogEvent,\n\ttype HookLogListener,\n\ttype HookLogPathSegment,\n\ttype HookLogScenarioDetails,\n\ttype HookLogStepDetails,\n\ttype HookLogPhase,\n\ttype HookLifecycleMetadata,\n\ttype HookLifecycleScenarioMetadata,\n\ttype HookLifecycleStepMetadata,\n\ttype HookLifecycleTargetScopeMetadata,\n} from \"./scope-lifecycle\";\nexport { selectSuiteByMode, selectTestByMode, resolveModeFromTags } from \"./modes\";\nexport { createTagFilter, type TagFilter } from \"./tag-filter\";\nexport {\n\tScenarioPendingError,\n\tisScenarioPendingError,\n\tPending,\n\tToDo,\n\tmarkScenarioPending,\n} from \"./pending\";\nexport {\n\tconfigureStepTables,\n\tresetStepTableConfig,\n\tconfigureStepDocstrings,\n\tresetStepDocstringConfig,\n\tsetStepTable,\n\tclearStepTable,\n\tgetTable,\n\tconsumeTable,\n\tgetRawTable,\n\tsetStepDocstring,\n\tsetStepDocstringInfo,\n\tclearStepDocstring,\n\tgetDocstring,\n\tgetDocstringMediaType,\n\tgetDocstringInfo,\n\tconsumeDocstring,\n\tsetStepMetadata,\n\tclearStepMetadata,\n\tgetStepMetadata,\n\tcreateStepRuntime,\n\ttype RawTable,\n\ttype DocstringInfo,\n\ttype DocstringTransformer,\n\ttype DocstringTransformConfig,\n\ttype StepRuntimeHelpers,\n\ttype StepRuntimeMetadata,\n} from \"./runtime/step-data\";\nexport { tryGetWorld, getWorld } from \"./async-context\";\nexport * from \"./types\";\n\nexport default {};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/timeouts.ts","../src/hooks.ts","../src/scenario-runner.ts","../src/runtime/step-data.ts","../src/pending.ts","../src/events.ts","../src/execute-plan.ts","../src/tag-filter.ts","../src/modes.ts","../src/scope-lifecycle.ts","../src/async-context.ts","../src/index.ts"],"names":["value","unit","multiplier","getTable","require","evaluator","getEventEmitter","isGherkinStepError","path","isScenarioOutlineExample"],"mappings":";AAGA,IAAM,uBAAoD;AAAA,EACxD,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAWA,IAAM,gBAAgB,CAAC,SAA2C;AAChE,MAAI,SAAS,UAAa,SAAS,MAAM;AACvC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,QAAQ,IAAI,SAAY;AAAA,EACjC;AAEA,MAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,UAAM,CAACA,QAAOC,KAAI,IAAI;AACtB,QAAI,OAAOD,WAAU,YAAYA,UAAS,GAAG;AAC3C,aAAO;AAAA,IACT;AACA,UAAME,cAAa,qBAAqBD,KAAmB,KAAK;AAChE,WAAOD,SAAQE;AAAA,EACjB;AAEA,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,cAAc,OAAO,KAAK,WAAY,KAA4B;AAChF,MAAI,OAAO,UAAU,YAAY,SAAS,GAAG;AAC3C,WAAO;AAAA,EACT;AACA,QAAM,OAAO,cAAc,OAAO,KAAK,OAAQ,KAAgC;AAC/E,MAAI,CAAC,MAAM;AACT,WAAO;AAA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AAS,GAAG;AACxC,WAAO,UAAU;AAAA,EACnB;AACA,QAAM,aAAa,wBAAwB,SAAS;AACpD,MAAI,CAAC,YAAY;AACf,WAAO,GAAG,UAAU,IAAI,aAAa,UAAU,eAAe,CAAC;AAAA,EACjE;AACA,SAAO,GAAG,UAAU,IAAI,KAAK,UAAU;AACzC;AAEA,SAAS,wBACP,SACoB;AACpB,QAAM,WAAqB,CAAC;AAC5B,WAAS,KAAK,WAAW,QAAQ,eAAe,CAAC,EAAE;AACnD,QAAM,YAAY,QAAQ,aAAa,MAAM,KAAK;AAClD,MAAI,WAAW;AACb,aAAS,KAAK,SAAS;AAAA,EACzB;AACA,QAAM,eAAe,oBAAoB,QAAQ,cAAc,QAAQ,YAAY;AACnF,MAAI,cAAc;AAChB,aAAS,KAAK,YAAY;AAAA,EAC5B;AACA,SAAO,SAAS,SAAS,IAAI,SAAS,KAAK,QAAK,IAAI;AACtD;AAEA,SAAS,oBACP,OACA,OACoB;AACpB,QAAM,UAAU,MAAM,eAAe,CAAC;AACtC,QAAM,OAAO,MAAM,aAAa,CAAC;AACjC,QAAM,MAAM,KAAK,KAAK;AACtB,MAAI,CAAC,OAAO,QAAQ,WAAW,GAAG;AAChC,WAAO;AAAA,EACT;AACA,QAAM,QAAkB,CAAC;AACzB,UAAQ,QAAQ,CAAC,QAAQ,gBAAgB;AACvC,UAAM,MAAM,QAAQ,KAAK;AACzB,QAAI,CAAC,KAAK;AACR;AAAA,IACF;AACA,UAAM,QAAQ,IAAI,WAAW,KAAK;AAClC,UAAM,KAAK,GAAG,GAAG,IAAI,OAAO,KAAK,EAAE,KAAK,CAAC,EAAE;AAAA,EAC7C,CAAC;AACD,SAAO,MAAM,SAAS,IAAI,MAAM,KAAK,IAAI,IAAI;AAC/C;;;AKndA,IAAO,cAAQ,CAAC","sourcesContent":["import type { ExecutorConfig, TimeoutSetting } from \"@autometa/config\";\nimport type { TimeoutSpec, TimeoutUnit } from \"@autometa/scopes\";\n\nconst UNIT_TO_MILLISECONDS: Record<TimeoutUnit, number> = {\n ms: 1,\n s: 1000,\n m: 60_000,\n h: 3_600_000,\n};\n\ntype TimeoutInput = TimeoutSpec | TimeoutSetting | undefined;\n\nexport type TimeoutSource = \"scenario\" | \"hook\" | \"config\" | \"default\";\n\nexport interface TimeoutResolution {\n milliseconds: number | undefined;\n source: TimeoutSource;\n}\n\nconst normalizeSpec = (spec: TimeoutInput): number | undefined => {\n if (spec === undefined || spec === null) {\n return undefined;\n }\n\n if (typeof spec === \"number\") {\n return spec <= 0 ? undefined : spec;\n }\n\n if (Array.isArray(spec)) {\n const [value, unit] = spec;\n if (typeof value !== \"number\" || value <= 0) {\n return undefined;\n }\n const multiplier = UNIT_TO_MILLISECONDS[unit as TimeoutUnit] ?? 1;\n return value * multiplier;\n }\n\n if (typeof spec !== \"object\") {\n return undefined;\n }\n\n const value = \"duration\" in spec ? spec.duration : (spec as { value?: number }).value;\n if (typeof value !== \"number\" || value <= 0) {\n return undefined;\n }\n const unit = \"duration\" in spec ? spec.unit : (spec as { unit?: TimeoutUnit }).unit;\n if (!unit) {\n return value;\n }\n const multiplier = UNIT_TO_MILLISECONDS[unit as TimeoutUnit] ?? 1;\n return value * multiplier;\n};\n\nexport const resolveTimeout = (\n explicit: TimeoutSpec | undefined,\n config: ExecutorConfig,\n explicitSource: TimeoutSource = \"scenario\"\n): TimeoutResolution => {\n const explicitMs = normalizeSpec(explicit);\n if (explicitMs !== undefined) {\n return { milliseconds: explicitMs, source: explicitSource };\n }\n\n const configMs = normalizeSpec(config.test?.timeout as TimeoutSetting | undefined);\n if (configMs !== undefined) {\n return { milliseconds: configMs, source: \"config\" };\n }\n\n return { milliseconds: undefined, source: \"default\" };\n};\n\nexport const chooseTimeout = (\n primary: TimeoutSpec | undefined,\n secondary: TimeoutSpec | undefined,\n config: ExecutorConfig\n): TimeoutResolution => {\n const secondaryResolution = resolveTimeout(secondary, config, \"hook\");\n if (secondaryResolution.milliseconds !== undefined) {\n return secondaryResolution;\n }\n\n return resolveTimeout(primary, config, \"scenario\");\n};\n","import type {\n HookDefinition,\n HookType,\n ScopeExecutionAdapter,\n ScopeNode,\n} from \"@autometa/scopes\";\nimport type { ScenarioExecution } from \"@autometa/test-builder\";\n\nexport interface ResolvedHook<World> {\n readonly hook: HookDefinition<World>;\n readonly scope: ScopeNode<World>;\n}\n\nexport interface HookCollection<World> {\n readonly beforeFeature: ResolvedHook<World>[];\n readonly afterFeature: ResolvedHook<World>[];\n readonly beforeRule: ResolvedHook<World>[];\n readonly afterRule: ResolvedHook<World>[];\n readonly beforeScenario: ResolvedHook<World>[];\n readonly afterScenario: ResolvedHook<World>[];\n readonly beforeScenarioOutline: ResolvedHook<World>[];\n readonly afterScenarioOutline: ResolvedHook<World>[];\n readonly beforeStep: ResolvedHook<World>[];\n readonly afterStep: ResolvedHook<World>[];\n}\n\nconst EMPTY_COLLECTION: HookCollection<unknown> = {\n beforeFeature: [],\n afterFeature: [],\n beforeRule: [],\n afterRule: [],\n beforeScenario: [],\n afterScenario: [],\n beforeScenarioOutline: [],\n afterScenarioOutline: [],\n beforeStep: [],\n afterStep: [],\n};\n\nexport function collectScenarioHooks<World>(\n adapter: ScopeExecutionAdapter<World>,\n execution: ScenarioExecution<World>\n): HookCollection<World> {\n const scopes = buildScopeChain(adapter, execution);\n if (scopes.length === 0) {\n return EMPTY_COLLECTION as HookCollection<World>;\n }\n\n const buckets: HookCollection<World> = {\n beforeFeature: [],\n afterFeature: [],\n beforeRule: [],\n afterRule: [],\n beforeScenario: [],\n afterScenario: [],\n beforeScenarioOutline: [],\n afterScenarioOutline: [],\n beforeStep: [],\n afterStep: [],\n };\n\n for (const scope of scopes) {\n for (const hook of scope.hooks) {\n addHookToBuckets(buckets, hook, scope);\n }\n }\n\n return buckets;\n}\n\nfunction buildScopeChain<World>(\n adapter: ScopeExecutionAdapter<World>,\n execution: ScenarioExecution<World>\n): ScopeNode<World>[] {\n const chain: ScopeNode<World>[] = [adapter.plan.root];\n chain.push(...execution.ancestors);\n chain.push(execution.scope);\n return chain;\n}\n\nfunction addHookToBuckets<World>(\n buckets: HookCollection<World>,\n hook: HookDefinition<World>,\n scope: ScopeNode<World>\n): void {\n const entry: ResolvedHook<World> = { hook, scope };\n switch (hook.type as HookType) {\n case \"beforeFeature\":\n buckets.beforeFeature.push(entry);\n break;\n case \"afterFeature\":\n buckets.afterFeature.push(entry);\n break;\n case \"beforeRule\":\n buckets.beforeRule.push(entry);\n break;\n case \"afterRule\":\n buckets.afterRule.push(entry);\n break;\n case \"beforeScenario\":\n buckets.beforeScenario.push(entry);\n break;\n case \"afterScenario\":\n buckets.afterScenario.push(entry);\n break;\n case \"beforeScenarioOutline\":\n buckets.beforeScenarioOutline.push(entry);\n break;\n case \"afterScenarioOutline\":\n buckets.afterScenarioOutline.push(entry);\n break;\n case \"beforeStep\":\n buckets.beforeStep.push(entry);\n break;\n case \"afterStep\":\n buckets.afterStep.push(entry);\n break;\n default:\n break;\n }\n}\n","import path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport {\n CucumberExpression,\n ParameterTypeRegistry,\n RegularExpression,\n} from \"@cucumber/cucumber-expressions\";\nimport { getEventEmitter } from \"@autometa/events\";\nimport type {\n ParameterRegistryLike,\n SourceRef,\n StepDefinition,\n StepExpression,\n} from \"@autometa/scopes\";\nimport type { ScenarioExecution, ScenarioOutlineExample } from \"@autometa/test-builder\";\nimport type {\n SimpleExampleGroup,\n SimpleLocation,\n SimpleScenario,\n SimpleStep,\n} from \"@autometa/gherkin\";\nimport {\n GherkinStepError,\n isGherkinStepError,\n type GherkinContextPathSegment,\n type GherkinErrorContext,\n type GherkinStepSummary,\n type SourceLocation,\n} from \"@autometa/errors\";\nimport {\n clearStepDocstring,\n clearStepTable,\n clearStepMetadata,\n setStepDocstringInfo,\n setStepMetadata,\n setStepTable,\n type StepRuntimeMetadata,\n} from \"./runtime/step-data\";\nimport { isScenarioPendingError } from \"./pending\";\nimport type {\n ScenarioRunContext,\n StepHookDetails,\n StepHookInvocationOptions,\n StepStatus,\n} from \"./scope-lifecycle\";\nimport { findPickleStep } from \"./events\";\n\nexport type { ScenarioRunContext } from \"./scope-lifecycle\";\n\ntype StepArgumentMatcher<World> = (text: string, world: World) => unknown[];\n\ninterface ParameterRegistryCarrier {\n readonly registry?: ParameterTypeRegistry;\n}\n\nconst matcherCache = new WeakMap<\n StepDefinition<unknown>,\n StepArgumentMatcher<unknown>\n>();\n\nexport async function runScenarioExecution<World>(\n execution: ScenarioExecution<World>,\n context: ScenarioRunContext<World>\n): Promise<void> {\n execution.reset();\n const eventEmitter = context.events ? getEventEmitter() : undefined;\n const pickle = context.events?.pickle;\n const { world, beforeStepHooks, afterStepHooks, invokeHooks } = context;\n const parameterRegistry = resolveParameterRegistry(context.parameterRegistry);\n const stepSummaries: GherkinStepSummary[] = [];\n\n try {\n const { steps, gherkinSteps } = execution;\n for (let index = 0; index < steps.length; index++) {\n const step = steps[index];\n if (!step) {\n continue;\n }\n const gherkinStep = gherkinSteps[index];\n const metadata = buildStepMetadata(execution, index);\n const stepDetails: StepHookDetails<World> = {\n index,\n definition: step,\n ...(gherkinStep ? { gherkin: gherkinStep } : {}),\n };\n const beforeOptions: StepHookInvocationOptions<World> = {\n direction: \"asc\",\n step: stepDetails,\n };\n await invokeHooks(beforeStepHooks, beforeOptions);\n\n const pickleStep = pickle && gherkinStep?.id\n ? findPickleStep(pickle, gherkinStep.id)\n : undefined;\n if (eventEmitter && pickle && pickleStep) {\n await eventEmitter.stepStarted({\n feature: pickle.feature,\n scenario: pickle.scenario,\n step: pickleStep,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n metadata: { index },\n });\n }\n\n setStepMetadata(world, metadata);\n setStepTable(world, gherkinStep?.dataTable);\n if (!gherkinStep?.docString) {\n setStepDocstringInfo(world, undefined);\n } else if (gherkinStep.docString.mediaType === undefined) {\n setStepDocstringInfo(world, { content: gherkinStep.docString.content });\n } else {\n setStepDocstringInfo(world, {\n content: gherkinStep.docString.content,\n mediaType: gherkinStep.docString.mediaType,\n });\n }\n let status: StepStatus = \"passed\";\n try {\n const args = resolveStepArguments(\n step,\n gherkinStep,\n parameterRegistry,\n world\n );\n await step.handler(world, ...args);\n stepSummaries.push(createStepSummary(metadata, gherkinStep, \"passed\"));\n } catch (error) {\n if (isScenarioPendingError(error)) {\n status = \"skipped\";\n throw error;\n }\n status = \"failed\";\n if (eventEmitter && pickle && pickleStep) {\n await eventEmitter.errorRaised({\n error,\n phase: \"step\",\n feature: pickle.feature,\n scenario: pickle.scenario,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n pickle,\n metadata: { index, stepId: pickleStep.id },\n });\n }\n stepSummaries.push(createStepSummary(metadata, gherkinStep, \"failed\"));\n for (let remaining = index + 1; remaining < gherkinSteps.length; remaining++) {\n const remainingMetadata = buildStepMetadata(execution, remaining);\n const remainingStep = gherkinSteps[remaining];\n stepSummaries.push(\n createStepSummary(remainingMetadata, remainingStep, \"skipped\")\n );\n }\n throw enrichStepError(error, metadata, stepSummaries);\n } finally {\n const afterStepDetails: StepHookDetails<World> = {\n ...stepDetails,\n status,\n };\n const afterOptions: StepHookInvocationOptions<World> = {\n direction: \"desc\",\n step: afterStepDetails,\n };\n await invokeHooks(afterStepHooks, afterOptions);\n\n if (eventEmitter && pickle && pickleStep) {\n await eventEmitter.stepCompleted({\n feature: pickle.feature,\n scenario: pickle.scenario,\n step: pickleStep,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n metadata: { index, status },\n });\n }\n\n clearStepTable(world);\n clearStepDocstring(world);\n clearStepMetadata(world);\n }\n }\n execution.markPassed();\n } catch (error) {\n if (isScenarioPendingError(error)) {\n execution.markPending(error.reason);\n return;\n }\n execution.markFailed(error);\n throw error;\n }\n}\n\nfunction resolveStepArguments<World>(\n definition: StepDefinition<World>,\n gherkinStep: SimpleStep | undefined,\n registry: ParameterTypeRegistry,\n world: World\n): unknown[] {\n if (!gherkinStep) {\n return [];\n }\n const matcher = getStepArgumentMatcher(definition, registry);\n return matcher(gherkinStep.text, world);\n}\n\nfunction getStepArgumentMatcher<World>(\n definition: StepDefinition<World>,\n registry: ParameterTypeRegistry\n): StepArgumentMatcher<World> {\n const cached = matcherCache.get(definition as StepDefinition<unknown>);\n if (cached) {\n return cached as StepArgumentMatcher<World>;\n }\n const matcher = createStepArgumentMatcher<World>(\n definition.expression,\n registry\n );\n matcherCache.set(\n definition as StepDefinition<unknown>,\n matcher as StepArgumentMatcher<unknown>\n );\n return matcher;\n}\n\nfunction createStepArgumentMatcher<World>(\n expression: StepExpression,\n registry: ParameterTypeRegistry\n): StepArgumentMatcher<World> {\n if (expression instanceof RegExp) {\n const evaluator = new RegularExpression(expression, registry);\n return (text, world) =>\n collectArguments(evaluator.match(text), world, text, expression);\n }\n const evaluator = new CucumberExpression(expression, registry);\n return (text, world) =>\n collectArguments(evaluator.match(text), world, text, expression);\n}\n\nfunction collectArguments<World>(\n match:\n | readonly { getValue(context?: unknown): unknown }[]\n | null,\n world: World,\n text: string,\n expression: StepExpression\n): unknown[] {\n if (!match) {\n throw new Error(\n `Step '${text}' did not match expression ${String(expression)}`\n );\n }\n return match.map((argument) => argument.getValue(world));\n}\n\nfunction resolveParameterRegistry(\n source: ParameterRegistryLike | undefined\n): ParameterTypeRegistry {\n if (isParameterTypeRegistry(source)) {\n return source;\n }\n\n const carrier = source as ParameterRegistryCarrier | undefined;\n const registry = carrier?.registry;\n if (isParameterTypeRegistry(registry)) {\n return registry;\n }\n\n return new ParameterTypeRegistry();\n}\n\nfunction isParameterTypeRegistry(\n value: unknown\n): value is ParameterTypeRegistry {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n\n if (value instanceof ParameterTypeRegistry) {\n return true;\n }\n\n const registry = value as ParameterTypeRegistry & {\n lookupByRegexp?: unknown;\n };\n\n return (\n typeof registry.lookupByTypeName === \"function\" &&\n typeof registry.defineParameterType === \"function\" &&\n typeof registry.lookupByRegexp === \"function\"\n );\n}\n\nfunction buildStepMetadata<World>(\n execution: ScenarioExecution<World>,\n index: number\n): StepRuntimeMetadata | undefined {\n const stepDefinition = execution.steps[index];\n const gherkinStep = execution.gherkinSteps[index];\n const featureNode = execution.feature;\n const feature = featureNode.feature;\n\n const featureSource = combineSourceRef(\n featureNode.scope.source,\n feature.uri,\n feature.location\n );\n const featureMeta = {\n name: featureNode.name,\n keyword: featureNode.keyword,\n uri: feature.uri,\n ...(featureSource ? { source: featureSource } : {}),\n } as StepRuntimeMetadata[\"feature\"];\n\n const scenarioSource = combineSourceRef(\n execution.scope.source,\n feature.uri,\n extractScenarioLocation(execution)\n );\n const scenarioMeta = {\n name: execution.name,\n keyword: execution.keyword,\n ...(scenarioSource ? { source: scenarioSource } : {}),\n } as StepRuntimeMetadata[\"scenario\"];\n\n const outlineMeta = execution.outline\n ? (() => {\n const outlineSource = combineSourceRef(\n execution.outline?.scope.source,\n feature.uri,\n execution.outline.outline.location\n );\n return {\n name: execution.outline.name,\n keyword: execution.outline.keyword,\n ...(outlineSource ? { source: outlineSource } : {}),\n } as StepRuntimeMetadata[\"outline\"];\n })()\n : undefined;\n\n const exampleMeta = isScenarioOutlineExample(execution)\n ? (() => {\n const group = execution.exampleGroup;\n const exampleSource = combineSourceRef(\n undefined,\n feature.uri,\n group.location\n );\n return {\n name: group.name,\n index: execution.exampleIndex,\n values: buildExampleValues(group, execution.exampleIndex),\n ...(exampleSource ? { source: exampleSource } : {}),\n } as StepRuntimeMetadata[\"example\"];\n })()\n : undefined;\n\n const stepMeta = gherkinStep\n ? (() => {\n const stepSource = combineSourceRef(\n undefined,\n feature.uri,\n gherkinStep.location\n );\n return {\n keyword: gherkinStep.keyword,\n text: gherkinStep.text,\n ...(stepSource ? { source: stepSource } : {}),\n } as StepRuntimeMetadata[\"step\"];\n })()\n : undefined;\n\n const definitionMeta = stepDefinition\n ? (() => {\n const definitionSource = normalizeDefinitionSource(stepDefinition.source);\n return {\n keyword: stepDefinition.keyword,\n expression: stepDefinition.expression,\n ...(definitionSource ? { source: definitionSource } : {}),\n } as StepRuntimeMetadata[\"definition\"];\n })()\n : undefined;\n\n const metadata: StepRuntimeMetadata = {\n ...(featureMeta ? { feature: featureMeta } : {}),\n ...(scenarioMeta ? { scenario: scenarioMeta } : {}),\n ...(outlineMeta ? { outline: outlineMeta } : {}),\n ...(exampleMeta ? { example: exampleMeta } : {}),\n ...(stepMeta ? { step: stepMeta } : {}),\n ...(definitionMeta ? { definition: definitionMeta } : {}),\n };\n\n return hasMetadata(metadata) ? metadata : undefined;\n}\n\nfunction combineSourceRef(\n source: SourceRef | undefined,\n uri?: string,\n location?: SimpleLocation\n): SourceRef | undefined {\n const file = source?.file ?? uri;\n const line = source?.line ?? location?.line;\n const column = source?.column ?? location?.column;\n\n if (file === undefined && line === undefined && column === undefined) {\n return undefined;\n }\n\n return {\n ...(file !== undefined ? { file } : {}),\n ...(line !== undefined ? { line } : {}),\n ...(column !== undefined ? { column } : {}),\n } satisfies SourceRef;\n}\n\nfunction normalizeDefinitionSource(source: SourceRef | undefined): SourceRef | undefined {\n if (!source) {\n return undefined;\n }\n\n return {\n ...(source.file !== undefined ? { file: source.file } : {}),\n ...(source.line !== undefined ? { line: source.line } : {}),\n ...(source.column !== undefined ? { column: source.column } : {}),\n } satisfies SourceRef;\n}\n\nfunction extractScenarioLocation<World>(\n execution: ScenarioExecution<World>\n): SimpleLocation | undefined {\n if (execution.type === \"example\") {\n return execution.outline?.outline.location;\n }\n const scenario = execution.gherkin as SimpleScenario;\n return scenario.location;\n}\n\nfunction isScenarioOutlineExample<World>(\n execution: ScenarioExecution<World>\n): execution is ScenarioOutlineExample<World> {\n return execution.type === \"example\";\n}\n\nfunction buildExampleValues(\n group: SimpleExampleGroup,\n index: number\n): Readonly<Record<string, string>> {\n const values: Record<string, string> = {};\n const headers = group.tableHeader;\n const row = group.tableBody[index] ?? [];\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i];\n if (header === undefined || header.length === 0) {\n continue;\n }\n values[header] = row[i] ?? \"\";\n }\n return Object.freeze(values);\n}\n\nfunction hasMetadata(metadata: StepRuntimeMetadata): boolean {\n return Boolean(\n metadata.feature ||\n metadata.scenario ||\n metadata.outline ||\n metadata.example ||\n metadata.step ||\n metadata.definition\n );\n}\n\nfunction enrichStepError(\n error: unknown,\n metadata: StepRuntimeMetadata | undefined,\n steps?: readonly GherkinStepSummary[]\n): Error {\n const base = error instanceof Error ? error : new Error(String(error));\n\n if (isGherkinStepError(base)) {\n return base;\n }\n\n const wrapped = new GherkinStepError(base.message, {\n cause: base,\n context: buildGherkinErrorContext(metadata, base, steps) ?? {},\n });\n\n if (base.stack) {\n Object.defineProperty(wrapped, \"stack\", {\n configurable: true,\n enumerable: false,\n writable: true,\n value: base.stack,\n });\n }\n\n return wrapped;\n}\n\nfunction buildGherkinErrorContext(\n metadata: StepRuntimeMetadata | undefined,\n error?: Error,\n steps?: readonly GherkinStepSummary[]\n): GherkinErrorContext | undefined {\n if (!metadata) {\n return undefined;\n }\n\n const gherkinLocation = toSourceLocation(metadata.step?.source);\n const definitionLocation = toSourceLocation(metadata.definition?.source);\n const errorLocation = extractErrorLocation(error);\n const pathSegments = buildGherkinPath(metadata);\n\n const gherkinSegment = gherkinLocation\n ? {\n location: gherkinLocation,\n ...(metadata.feature?.name !== undefined\n ? { featureName: metadata.feature.name }\n : {}),\n ...(metadata.step?.keyword !== undefined\n ? { stepKeyword: metadata.step.keyword }\n : {}),\n ...(metadata.step?.text !== undefined ? { stepText: metadata.step.text } : {}),\n }\n : undefined;\n\n const expression = metadata.definition?.expression;\n const functionName =\n typeof expression === \"string\"\n ? expression\n : expression !== undefined\n ? String(expression)\n : undefined;\n\n const codeLocation = errorLocation ?? definitionLocation;\n\n const codeSegment = codeLocation\n ? {\n location: codeLocation,\n ...(functionName !== undefined ? { functionName } : {}),\n }\n : undefined;\n\n const hasSteps = Boolean(steps && steps.length > 0);\n\n if (!gherkinSegment && !codeSegment && !pathSegments && !hasSteps) {\n return undefined;\n }\n\n return {\n ...(gherkinSegment ? { gherkin: gherkinSegment } : {}),\n ...(codeSegment ? { code: codeSegment } : {}),\n ...(pathSegments ? { path: pathSegments } : {}),\n ...(hasSteps && steps ? { steps } : {}),\n };\n}\n\nfunction createStepSummary(\n metadata: StepRuntimeMetadata | undefined,\n gherkinStep: SimpleStep | undefined,\n status: GherkinStepSummary[\"status\"]\n): GherkinStepSummary {\n const keyword = metadata?.step?.keyword ?? gherkinStep?.keyword;\n const text = metadata?.step?.text ?? gherkinStep?.text;\n const location = metadata?.step?.source\n ? toSourceLocation(metadata.step.source)\n : undefined;\n\n return {\n status,\n ...(keyword !== undefined ? { keyword } : {}),\n ...(text !== undefined ? { text } : {}),\n ...(location ? { location } : {}),\n } satisfies GherkinStepSummary;\n}\n\nfunction buildGherkinPath(\n metadata: StepRuntimeMetadata | undefined\n): GherkinContextPathSegment[] | undefined {\n if (!metadata) {\n return undefined;\n }\n\n const segments: GherkinContextPathSegment[] = [];\n\n const featureLocation = toSourceLocation(metadata.feature?.source);\n if (featureLocation) {\n segments.push({\n role: \"feature\",\n location: featureLocation,\n ...(metadata.feature?.keyword !== undefined\n ? { keyword: metadata.feature.keyword }\n : {}),\n ...(metadata.feature?.name !== undefined ? { name: metadata.feature.name } : {}),\n });\n }\n\n const outlineLocation = toSourceLocation(metadata.outline?.source);\n if (outlineLocation) {\n segments.push({\n role: \"outline\",\n location: outlineLocation,\n ...(metadata.outline?.keyword !== undefined\n ? { keyword: metadata.outline.keyword }\n : {}),\n ...(metadata.outline?.name !== undefined ? { name: metadata.outline.name } : {}),\n });\n }\n\n const scenarioLocation = toSourceLocation(metadata.scenario?.source);\n if (scenarioLocation) {\n segments.push({\n role: \"scenario\",\n location: scenarioLocation,\n ...(metadata.scenario?.keyword !== undefined\n ? { keyword: metadata.scenario.keyword }\n : {}),\n ...(metadata.scenario?.name !== undefined ? { name: metadata.scenario.name } : {}),\n });\n }\n\n const exampleLocation = toSourceLocation(metadata.example?.source);\n if (exampleLocation) {\n segments.push({\n role: \"example\",\n keyword: \"Example\",\n location: exampleLocation,\n ...(metadata.example?.name !== undefined ? { name: metadata.example.name } : {}),\n ...(metadata.example?.index !== undefined ? { index: metadata.example.index } : {}),\n });\n }\n\n const stepLocation = toSourceLocation(metadata.step?.source);\n if (stepLocation) {\n segments.push({\n role: \"step\",\n location: stepLocation,\n ...(metadata.step?.keyword !== undefined ? { keyword: metadata.step.keyword } : {}),\n ...(metadata.step?.text !== undefined ? { text: metadata.step.text } : {}),\n });\n }\n\n return segments.length ? segments : undefined;\n}\n\ninterface ParsedStackFrame {\n readonly file: string;\n readonly line: number;\n readonly column: number;\n}\n\nconst STACK_FRAME_IGNORE_PATTERNS: readonly RegExp[] = [\n /^node:/,\n /node:internal\\//,\n /internal\\/(?:modules|process)/,\n /node_modules\\/@autometa\\//,\n /packages\\/(?:runner|executor|errors|cli|assertions)\\//,\n /\\/\\.autometa-cli\\/cache\\//,\n /\\/\\.autometa\\/cache\\//,\n /\\/node_modules\\/\\.cache\\/autometa\\//,\n];\n\nfunction extractErrorLocation(error: Error | undefined): SourceLocation | undefined {\n if (!error?.stack) {\n return undefined;\n }\n\n const lines = error.stack.split(\"\\n\").slice(1);\n for (const raw of lines) {\n const trimmed = raw.trim();\n if (!trimmed.startsWith(\"at \")) {\n continue;\n }\n const parsed = parseStackFrame(trimmed);\n if (!parsed) {\n continue;\n }\n if (isFrameworkStackFile(parsed.file)) {\n continue;\n }\n const filePath = normalizeFilePath(parsed.file);\n return {\n filePath,\n start: {\n line: parsed.line,\n column: parsed.column,\n },\n } satisfies SourceLocation;\n }\n\n return undefined;\n}\n\nfunction parseStackFrame(line: string): ParsedStackFrame | undefined {\n const match = line.match(/at (?:.+?\\()?((?:[a-zA-Z]:)?[^():]+):(\\d+):(\\d+)\\)?$/);\n if (!match) {\n return undefined;\n }\n\n const [, file = \"\", lineText = \"\", columnText = \"\"] = match;\n if (!file || !lineText) {\n return undefined;\n }\n\n const lineNumber = Number.parseInt(lineText, 10);\n if (Number.isNaN(lineNumber)) {\n return undefined;\n }\n\n const columnNumber = Number.parseInt(columnText, 10);\n\n return {\n file,\n line: lineNumber,\n column: Number.isNaN(columnNumber) ? 1 : columnNumber,\n };\n}\n\nfunction isFrameworkStackFile(file: string): boolean {\n const normalized = file.replace(/\\\\/g, \"/\");\n return STACK_FRAME_IGNORE_PATTERNS.some((pattern) => pattern.test(normalized));\n}\n\nfunction toSourceLocation(source: SourceRef | undefined): SourceLocation | undefined {\n if (!source?.file) {\n return undefined;\n }\n\n const filePath = normalizeFilePath(source.file);\n const line = source.line ?? 1;\n const column = source.column ?? 1;\n\n return {\n filePath,\n start: {\n line,\n column,\n },\n };\n}\n\nfunction normalizeFilePath(file: string): string {\n if (file.startsWith(\"file://\")) {\n try {\n return fileURLToPath(file);\n } catch {\n // fall back to treating the URI as a plain path\n return file;\n }\n }\n return path.isAbsolute(file) ? file : path.resolve(file);\n}\n","import {\n createTable,\n DEFAULT_COERCE_BY_SHAPE,\n type HeaderlessTable,\n type HeaderlessTableOptions,\n type HorizontalTable,\n type HorizontalTableOptions,\n type MatrixKeys,\n type MatrixTable,\n type MatrixTableOptions,\n type TableKeysMap,\n type TableShape,\n type VerticalTable,\n type VerticalTableOptions,\n} from \"@autometa/gherkin\";\nimport type { SourceRef, StepExpression, StepKeyword } from \"@autometa/scopes\";\n\nexport type RawTable = readonly (readonly string[])[];\n\ndeclare const DATA_TABLE_SYMBOL_KEY: unique symbol;\ndeclare const DOCSTRING_SYMBOL_KEY: unique symbol;\ndeclare const DOCSTRING_MEDIA_TYPE_SYMBOL_KEY: unique symbol;\ndeclare const STEP_RUNTIME_SYMBOL_KEY: unique symbol;\ndeclare const STEP_METADATA_SYMBOL_KEY: unique symbol;\n\nconst DATA_TABLE_SYMBOL: typeof DATA_TABLE_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:data-table\"\n) as typeof DATA_TABLE_SYMBOL_KEY;\nconst DOCSTRING_SYMBOL: typeof DOCSTRING_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:docstring\"\n) as typeof DOCSTRING_SYMBOL_KEY;\nconst DOCSTRING_MEDIA_TYPE_SYMBOL: typeof DOCSTRING_MEDIA_TYPE_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:docstring:media-type\"\n) as typeof DOCSTRING_MEDIA_TYPE_SYMBOL_KEY;\nconst STEP_RUNTIME_SYMBOL: typeof STEP_RUNTIME_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:runtime\"\n) as typeof STEP_RUNTIME_SYMBOL_KEY;\nconst STEP_METADATA_SYMBOL: typeof STEP_METADATA_SYMBOL_KEY = Symbol.for(\n \"autometa:runner:step:metadata\"\n) as typeof STEP_METADATA_SYMBOL_KEY;\n\ntype TableCarrier = Record<never, never> & {\n [DATA_TABLE_SYMBOL]?: RawTable;\n [DOCSTRING_SYMBOL]?: string | undefined;\n [DOCSTRING_MEDIA_TYPE_SYMBOL]?: string | undefined;\n [STEP_RUNTIME_SYMBOL]?: StepRuntimeHelpers;\n [STEP_METADATA_SYMBOL]?: StepRuntimeMetadata;\n runtime?: StepRuntimeHelpers;\n};\n\ntype TableConfig = Record<TableShape, boolean>;\n\ntype TableOptionsProvider<T> = T | (new () => T);\n\nconst DEFAULT_CONFIG: TableConfig = { ...DEFAULT_COERCE_BY_SHAPE };\nlet activeConfig: TableConfig = { ...DEFAULT_CONFIG };\n\nexport interface DocstringInfo {\n readonly content: string;\n readonly mediaType?: string;\n}\n\nexport type DocstringTransformer<T = unknown> = (\n content: string,\n context: { readonly mediaType?: string }\n) => T;\n\nexport interface DocstringTransformConfig {\n readonly transformers: Readonly<Record<string, DocstringTransformer>>;\n}\n\nconst DEFAULT_DOCSTRING_CONFIG: DocstringTransformConfig = { transformers: {} };\nlet activeDocstringConfig: DocstringTransformConfig = { ...DEFAULT_DOCSTRING_CONFIG };\n\nfunction isObjectLike(value: unknown): value is TableCarrier {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction cloneTable(source: string[][] | readonly (readonly string[])[]): RawTable {\n return source.map((row) => [...row]) as readonly (readonly string[])[];\n}\n\nfunction withCarrier(world: unknown): TableCarrier | undefined {\n if (!isObjectLike(world)) {\n return undefined;\n }\n return world as TableCarrier;\n}\n\nexport interface TableAccessConfig {\n readonly coercePrimitives?: Partial<Record<TableShape, boolean>>;\n}\n\nexport function configureStepTables(config: TableAccessConfig): void {\n if (config.coercePrimitives) {\n activeConfig = {\n ...activeConfig,\n ...config.coercePrimitives,\n } as TableConfig;\n }\n}\n\nexport function resetStepTableConfig(): void {\n activeConfig = { ...DEFAULT_CONFIG };\n}\n\nexport function setStepTable(\n world: unknown,\n table: string[][] | readonly (readonly string[])[] | undefined\n): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n if (!table) {\n Reflect.deleteProperty(carrier, DATA_TABLE_SYMBOL);\n return;\n }\n const cloned = cloneTable(table);\n if (Object.prototype.hasOwnProperty.call(carrier, DATA_TABLE_SYMBOL)) {\n carrier[DATA_TABLE_SYMBOL] = cloned;\n } else {\n Object.defineProperty(carrier, DATA_TABLE_SYMBOL, {\n value: cloned,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n}\n\nexport function clearStepTable(world: unknown): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n Reflect.deleteProperty(carrier, DATA_TABLE_SYMBOL);\n}\n\nexport function setStepDocstring(world: unknown, docstring?: string): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n if (docstring === undefined) {\n Reflect.deleteProperty(carrier, DOCSTRING_SYMBOL);\n Reflect.deleteProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL);\n return;\n }\n if (Object.prototype.hasOwnProperty.call(carrier, DOCSTRING_SYMBOL)) {\n carrier[DOCSTRING_SYMBOL] = docstring;\n } else {\n Object.defineProperty(carrier, DOCSTRING_SYMBOL, {\n value: docstring,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n Reflect.deleteProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL);\n}\n\nexport function setStepDocstringInfo(world: unknown, docstring?: DocstringInfo): void {\n if (docstring === undefined) {\n setStepDocstring(world, undefined);\n return;\n }\n\n setStepDocstring(world, docstring.content);\n\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n\n const mediaType = docstring.mediaType;\n if (mediaType === undefined) {\n Reflect.deleteProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL);\n return;\n }\n\n if (Object.prototype.hasOwnProperty.call(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL)) {\n carrier[DOCSTRING_MEDIA_TYPE_SYMBOL] = mediaType;\n } else {\n Object.defineProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL, {\n value: mediaType,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n}\n\nexport function clearStepDocstring(world: unknown): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n Reflect.deleteProperty(carrier, DOCSTRING_SYMBOL);\n Reflect.deleteProperty(carrier, DOCSTRING_MEDIA_TYPE_SYMBOL);\n}\n\nexport interface StepRuntimeStepMetadata {\n readonly keyword?: string;\n readonly text?: string;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeFeatureMetadata {\n readonly name: string;\n readonly keyword: string;\n readonly uri?: string;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeScenarioMetadata {\n readonly name: string;\n readonly keyword: string;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeOutlineMetadata {\n readonly name: string;\n readonly keyword: string;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeExampleMetadata {\n readonly name?: string;\n readonly index: number;\n readonly values: Readonly<Record<string, string>>;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeDefinitionMetadata {\n readonly keyword: StepKeyword;\n readonly expression: StepExpression;\n readonly source?: SourceRef;\n}\n\nexport interface StepRuntimeMetadata {\n readonly feature?: StepRuntimeFeatureMetadata;\n readonly scenario?: StepRuntimeScenarioMetadata;\n readonly outline?: StepRuntimeOutlineMetadata;\n readonly example?: StepRuntimeExampleMetadata;\n readonly step?: StepRuntimeStepMetadata;\n readonly definition?: StepRuntimeDefinitionMetadata;\n}\n\nexport function setStepMetadata(world: unknown, metadata?: StepRuntimeMetadata): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n if (!metadata) {\n Reflect.deleteProperty(carrier, STEP_METADATA_SYMBOL);\n return;\n }\n if (Object.prototype.hasOwnProperty.call(carrier, STEP_METADATA_SYMBOL)) {\n carrier[STEP_METADATA_SYMBOL] = metadata;\n } else {\n Object.defineProperty(carrier, STEP_METADATA_SYMBOL, {\n value: metadata,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n }\n}\n\nexport function clearStepMetadata(world: unknown): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n Reflect.deleteProperty(carrier, STEP_METADATA_SYMBOL);\n}\n\nexport function getStepMetadata(world: unknown): StepRuntimeMetadata | undefined {\n const carrier = withCarrier(world);\n return carrier?.[STEP_METADATA_SYMBOL];\n}\n\nexport function getDocstring(world: unknown): string | undefined {\n const carrier = withCarrier(world);\n return carrier?.[DOCSTRING_SYMBOL];\n}\n\nexport function getDocstringMediaType(world: unknown): string | undefined {\n const carrier = withCarrier(world);\n return carrier?.[DOCSTRING_MEDIA_TYPE_SYMBOL];\n}\n\nexport function getDocstringInfo(world: unknown): DocstringInfo | undefined {\n const content = getDocstring(world);\n if (content === undefined) {\n return undefined;\n }\n const mediaType = getDocstringMediaType(world);\n if (mediaType === undefined) {\n return { content };\n }\n return { content, mediaType };\n}\n\nexport function getRawTable(world: unknown): RawTable | undefined {\n const carrier = withCarrier(world);\n return carrier?.[DATA_TABLE_SYMBOL];\n}\n\nexport function getStepRuntimeFromWorld(world: unknown): StepRuntimeHelpers | undefined {\n const carrier = withCarrier(world);\n return carrier?.[STEP_RUNTIME_SYMBOL];\n}\n\nfunction resolveCoerceOverride(\n shape: TableShape,\n coerceOverride: boolean | undefined\n): boolean {\n if (typeof coerceOverride === \"boolean\") {\n return coerceOverride;\n }\n return activeConfig[shape];\n}\n\nfunction resolveTableOptions<T>(\n optionsOrProvider: TableOptionsProvider<T> | undefined\n): T | undefined {\n if (!optionsOrProvider) {\n return undefined;\n }\n if (typeof optionsOrProvider === \"function\") {\n return new (optionsOrProvider as new () => T)();\n }\n return optionsOrProvider;\n}\n\nexport function getTable(\n world: unknown,\n shape: \"headerless\",\n options?: TableOptionsProvider<HeaderlessTableOptions>\n): HeaderlessTable | undefined;\nexport function getTable(\n world: unknown,\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions>\n): HorizontalTable | undefined;\nexport function getTable(\n world: unknown,\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions>\n): VerticalTable | undefined;\nexport function getTable(\n world: unknown,\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions>\n): MatrixTable | undefined;\nexport function getTable<TKeys extends TableKeysMap>(\n world: unknown,\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions<TKeys>>\n): HorizontalTable | undefined;\nexport function getTable<TKeys extends TableKeysMap>(\n world: unknown,\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions<TKeys>>\n): VerticalTable | undefined;\nexport function getTable<TKeys extends MatrixKeys>(\n world: unknown,\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions<TKeys>>\n): MatrixTable | undefined;\nexport function getTable(\n world: unknown,\n shape: TableShape,\n options?:\n | TableOptionsProvider<HeaderlessTableOptions>\n | TableOptionsProvider<HorizontalTableOptions>\n | TableOptionsProvider<VerticalTableOptions>\n | TableOptionsProvider<MatrixTableOptions>\n): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n const table = getRawTable(world);\n if (!table) {\n return undefined;\n }\n const resolvedOptions = resolveTableOptions(options);\n const coerce = resolveCoerceOverride(shape, resolvedOptions?.coerce);\n switch (shape) {\n case \"headerless\":\n return createTable(table, \"headerless\", {\n ...(resolvedOptions as HeaderlessTableOptions | undefined),\n coerce,\n });\n case \"horizontal\":\n return createTable(table, \"horizontal\", {\n ...(resolvedOptions as HorizontalTableOptions | undefined),\n coerce,\n });\n case \"vertical\":\n return createTable(table, \"vertical\", {\n ...(resolvedOptions as VerticalTableOptions | undefined),\n coerce,\n });\n case \"matrix\":\n return createTable(table, \"matrix\", {\n ...(resolvedOptions as MatrixTableOptions | undefined),\n coerce,\n });\n default:\n return undefined;\n }\n}\n\nexport function consumeTable(\n world: unknown,\n shape: TableShape,\n options?:\n | TableOptionsProvider<HeaderlessTableOptions>\n | TableOptionsProvider<HorizontalTableOptions>\n | TableOptionsProvider<VerticalTableOptions>\n | TableOptionsProvider<MatrixTableOptions>\n): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n let instance:\n | HeaderlessTable\n | HorizontalTable\n | VerticalTable\n | MatrixTable\n | undefined;\n switch (shape) {\n case \"headerless\":\n instance = getTable(world, \"headerless\", options as HeaderlessTableOptions | undefined);\n break;\n case \"horizontal\":\n instance = getTable(world, \"horizontal\", options as HorizontalTableOptions | undefined);\n break;\n case \"vertical\":\n instance = getTable(world, \"vertical\", options as VerticalTableOptions | undefined);\n break;\n case \"matrix\":\n instance = getTable(world, \"matrix\", options as MatrixTableOptions | undefined);\n break;\n default:\n instance = undefined;\n }\n clearStepTable(world);\n return instance;\n}\n\nexport function consumeDocstring(world: unknown): string | undefined {\n const value = getDocstring(world);\n clearStepDocstring(world);\n return value;\n}\n\nfunction normalizeDocstringMediaType(mediaType: string | undefined): string | undefined {\n if (!mediaType) {\n return undefined;\n }\n const normalized = mediaType.trim();\n if (!normalized) {\n return undefined;\n }\n const [primary] = normalized.split(\";\", 1);\n return primary?.trim().toLowerCase() || undefined;\n}\n\nfunction resolveDocstringTransformer(\n transformers: Readonly<Record<string, DocstringTransformer>>,\n mediaType: string | undefined\n): DocstringTransformer | undefined {\n const normalized = normalizeDocstringMediaType(mediaType);\n if (!normalized) {\n return undefined;\n }\n\n if (transformers[normalized]) {\n return transformers[normalized];\n }\n\n const slashIndex = normalized.indexOf(\"/\");\n if (slashIndex !== -1) {\n const subtype = normalized.slice(slashIndex + 1);\n if (transformers[subtype]) {\n return transformers[subtype];\n }\n const plusIndex = subtype.lastIndexOf(\"+\");\n if (plusIndex !== -1) {\n const suffix = subtype.slice(plusIndex + 1);\n if (transformers[`+${suffix}`]) {\n return transformers[`+${suffix}`];\n }\n if (transformers[suffix]) {\n return transformers[suffix];\n }\n }\n }\n\n return undefined;\n}\n\nexport function configureStepDocstrings(\n config: Partial<DocstringTransformConfig>\n): void {\n if (config.transformers) {\n activeDocstringConfig = {\n ...activeDocstringConfig,\n transformers: {\n ...activeDocstringConfig.transformers,\n ...config.transformers,\n },\n };\n }\n}\n\nexport function resetStepDocstringConfig(): void {\n activeDocstringConfig = { ...DEFAULT_DOCSTRING_CONFIG };\n}\n\nexport interface StepRuntimeHelpers {\n readonly hasTable: boolean;\n readonly hasDocstring: boolean;\n readonly currentStep: StepRuntimeMetadata | undefined;\n getTable(\n shape: \"headerless\",\n options?: TableOptionsProvider<HeaderlessTableOptions>\n ): HeaderlessTable | undefined;\n getTable(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions>\n ): HorizontalTable | undefined;\n getTable<TKeys extends TableKeysMap>(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions<TKeys>>\n ): HorizontalTable | undefined;\n getTable(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions>\n ): VerticalTable | undefined;\n getTable<TKeys extends TableKeysMap>(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions<TKeys>>\n ): VerticalTable | undefined;\n getTable(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions>\n ): MatrixTable | undefined;\n getTable<TKeys extends MatrixKeys>(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions<TKeys>>\n ): MatrixTable | undefined;\n getTable(\n shape: TableShape,\n options?:\n | TableOptionsProvider<HeaderlessTableOptions>\n | TableOptionsProvider<HorizontalTableOptions>\n | TableOptionsProvider<VerticalTableOptions>\n | TableOptionsProvider<MatrixTableOptions>\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined;\n consumeTable(\n shape: \"headerless\",\n options?: TableOptionsProvider<HeaderlessTableOptions>\n ): HeaderlessTable | undefined;\n consumeTable(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions>\n ): HorizontalTable | undefined;\n consumeTable<TKeys extends TableKeysMap>(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions<TKeys>>\n ): HorizontalTable | undefined;\n consumeTable(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions>\n ): VerticalTable | undefined;\n consumeTable<TKeys extends TableKeysMap>(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions<TKeys>>\n ): VerticalTable | undefined;\n consumeTable(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions>\n ): MatrixTable | undefined;\n consumeTable<TKeys extends MatrixKeys>(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions<TKeys>>\n ): MatrixTable | undefined;\n consumeTable(\n shape: TableShape,\n options?:\n | TableOptionsProvider<HeaderlessTableOptions>\n | TableOptionsProvider<HorizontalTableOptions>\n | TableOptionsProvider<VerticalTableOptions>\n | TableOptionsProvider<MatrixTableOptions>\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined;\n requireTable(\n shape: \"headerless\",\n options?: TableOptionsProvider<HeaderlessTableOptions>\n ): HeaderlessTable;\n requireTable(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions>\n ): HorizontalTable;\n requireTable<TKeys extends TableKeysMap>(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions<TKeys>>\n ): HorizontalTable;\n requireTable(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions>\n ): VerticalTable;\n requireTable<TKeys extends TableKeysMap>(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions<TKeys>>\n ): VerticalTable;\n requireTable(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions>\n ): MatrixTable;\n requireTable<TKeys extends MatrixKeys>(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions<TKeys>>\n ): MatrixTable;\n requireTable(\n shape: TableShape,\n options?:\n | TableOptionsProvider<HeaderlessTableOptions>\n | TableOptionsProvider<HorizontalTableOptions>\n | TableOptionsProvider<VerticalTableOptions>\n | TableOptionsProvider<MatrixTableOptions>\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable;\n getRawTable(): RawTable | undefined;\n getDocstring(): string | undefined;\n getDocstringMediaType(): string | undefined;\n getDocstringInfo(): DocstringInfo | undefined;\n consumeDocstring(): string | undefined;\n getDocstringTransformed(options?: { readonly fallback?: \"raw\" | \"throw\" }): unknown | undefined;\n consumeDocstringTransformed(options?: { readonly fallback?: \"raw\" | \"throw\" }): unknown | undefined;\n getStepMetadata(): StepRuntimeMetadata | undefined;\n}\n\nfunction bindGetTable(world: unknown) {\n function getTable(\n shape: \"headerless\",\n options?: TableOptionsProvider<HeaderlessTableOptions>\n ): HeaderlessTable | undefined;\n function getTable(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions>\n ): HorizontalTable | undefined;\n function getTable<TKeys extends TableKeysMap>(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions<TKeys>>\n ): HorizontalTable | undefined;\n function getTable(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions>\n ): VerticalTable | undefined;\n function getTable<TKeys extends TableKeysMap>(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions<TKeys>>\n ): VerticalTable | undefined;\n function getTable(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions>\n ): MatrixTable | undefined;\n function getTable<TKeys extends MatrixKeys>(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions<TKeys>>\n ): MatrixTable | undefined;\n function getTable(\n shape: TableShape,\n options?:\n | TableOptionsProvider<HeaderlessTableOptions>\n | TableOptionsProvider<HorizontalTableOptions>\n | TableOptionsProvider<VerticalTableOptions>\n | TableOptionsProvider<MatrixTableOptions>\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n switch (shape) {\n case \"headerless\":\n return getTableForShape(world, \"headerless\", options as HeaderlessTableOptions | undefined);\n case \"horizontal\":\n return getTableForShape(world, \"horizontal\", options as HorizontalTableOptions | undefined);\n case \"vertical\":\n return getTableForShape(world, \"vertical\", options as VerticalTableOptions | undefined);\n case \"matrix\":\n return getTableForShape(world, \"matrix\", options as MatrixTableOptions | undefined);\n default:\n return undefined;\n }\n }\n return getTable;\n}\n\nfunction getTableForShape(\n world: unknown,\n shape: \"headerless\",\n options?: HeaderlessTableOptions\n): HeaderlessTable | undefined;\nfunction getTableForShape(\n world: unknown,\n shape: \"horizontal\",\n options?: HorizontalTableOptions\n): HorizontalTable | undefined;\nfunction getTableForShape(\n world: unknown,\n shape: \"vertical\",\n options?: VerticalTableOptions\n): VerticalTable | undefined;\nfunction getTableForShape(\n world: unknown,\n shape: \"matrix\",\n options?: MatrixTableOptions\n): MatrixTable | undefined;\nfunction getTableForShape(\n world: unknown,\n shape: TableShape,\n options?:\n | HeaderlessTableOptions\n | HorizontalTableOptions\n | VerticalTableOptions\n | MatrixTableOptions\n): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n switch (shape) {\n case \"headerless\":\n return getTable(world, \"headerless\", options as HeaderlessTableOptions | undefined);\n case \"horizontal\":\n return getTable(world, \"horizontal\", options as HorizontalTableOptions | undefined);\n case \"vertical\":\n return getTable(world, \"vertical\", options as VerticalTableOptions | undefined);\n case \"matrix\":\n return getTable(world, \"matrix\", options as MatrixTableOptions | undefined);\n default:\n return undefined;\n }\n}\n\nfunction bindConsumeTable(world: unknown) {\n function consume(\n shape: \"headerless\",\n options?: TableOptionsProvider<HeaderlessTableOptions>\n ): HeaderlessTable | undefined;\n function consume(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions>\n ): HorizontalTable | undefined;\n function consume<TKeys extends TableKeysMap>(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions<TKeys>>\n ): HorizontalTable | undefined;\n function consume(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions>\n ): VerticalTable | undefined;\n function consume<TKeys extends TableKeysMap>(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions<TKeys>>\n ): VerticalTable | undefined;\n function consume(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions>\n ): MatrixTable | undefined;\n function consume<TKeys extends MatrixKeys>(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions<TKeys>>\n ): MatrixTable | undefined;\n function consume(\n shape: TableShape,\n options?:\n | TableOptionsProvider<HeaderlessTableOptions>\n | TableOptionsProvider<HorizontalTableOptions>\n | TableOptionsProvider<VerticalTableOptions>\n | TableOptionsProvider<MatrixTableOptions>\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable | undefined {\n switch (shape) {\n case \"headerless\":\n return consumeTable(world, \"headerless\", options as HeaderlessTableOptions | undefined);\n case \"horizontal\":\n return consumeTable(world, \"horizontal\", options as HorizontalTableOptions | undefined);\n case \"vertical\":\n return consumeTable(world, \"vertical\", options as VerticalTableOptions | undefined);\n case \"matrix\":\n return consumeTable(world, \"matrix\", options as MatrixTableOptions | undefined);\n default:\n return undefined;\n }\n }\n return consume;\n}\n\nfunction bindRequireTable(world: unknown) {\n function require(\n shape: \"headerless\",\n options?: TableOptionsProvider<HeaderlessTableOptions>\n ): HeaderlessTable;\n function require(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions>\n ): HorizontalTable;\n function require<TKeys extends TableKeysMap>(\n shape: \"horizontal\",\n options?: TableOptionsProvider<HorizontalTableOptions<TKeys>>\n ): HorizontalTable;\n function require(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions>\n ): VerticalTable;\n function require<TKeys extends TableKeysMap>(\n shape: \"vertical\",\n options?: TableOptionsProvider<VerticalTableOptions<TKeys>>\n ): VerticalTable;\n function require(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions>\n ): MatrixTable;\n function require<TKeys extends MatrixKeys>(\n shape: \"matrix\",\n options?: TableOptionsProvider<MatrixTableOptions<TKeys>>\n ): MatrixTable;\n function require(\n shape: TableShape,\n options?:\n | TableOptionsProvider<HeaderlessTableOptions>\n | TableOptionsProvider<HorizontalTableOptions>\n | TableOptionsProvider<VerticalTableOptions>\n | TableOptionsProvider<MatrixTableOptions>\n ): HeaderlessTable | HorizontalTable | VerticalTable | MatrixTable {\n switch (shape) {\n case \"headerless\": {\n const table = consumeTable(\n world,\n \"headerless\",\n options as HeaderlessTableOptions | undefined\n );\n if (!table) {\n throw new RangeError(\"No headerless data table is attached to the current step.\");\n }\n return table;\n }\n case \"horizontal\": {\n const table = consumeTable(\n world,\n \"horizontal\",\n options as HorizontalTableOptions | undefined\n );\n if (!table) {\n throw new RangeError(\"No horizontal data table is attached to the current step.\");\n }\n return table;\n }\n case \"vertical\": {\n const table = consumeTable(\n world,\n \"vertical\",\n options as VerticalTableOptions | undefined\n );\n if (!table) {\n throw new RangeError(\"No vertical data table is attached to the current step.\");\n }\n return table;\n }\n case \"matrix\": {\n const table = consumeTable(\n world,\n \"matrix\",\n options as MatrixTableOptions | undefined\n );\n if (!table) {\n throw new RangeError(\"No matrix data table is attached to the current step.\");\n }\n return table;\n }\n default:\n throw new RangeError(`Unsupported table shape: ${String(shape)}`);\n }\n }\n return require;\n}\n\nfunction cacheRuntime(world: unknown, runtime: StepRuntimeHelpers): void {\n const carrier = withCarrier(world);\n if (!carrier) {\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(carrier, STEP_RUNTIME_SYMBOL)) {\n Object.defineProperty(carrier, STEP_RUNTIME_SYMBOL, {\n value: runtime,\n writable: true,\n configurable: true,\n enumerable: false,\n });\n } else {\n carrier[STEP_RUNTIME_SYMBOL] = runtime;\n }\n\n if (!Object.prototype.hasOwnProperty.call(carrier, \"runtime\")) {\n Object.defineProperty(carrier, \"runtime\", {\n get() {\n return carrier[STEP_RUNTIME_SYMBOL];\n },\n enumerable: false,\n configurable: true,\n });\n }\n}\n\nexport function createStepRuntime(world: unknown): StepRuntimeHelpers {\n const existing = getStepRuntimeFromWorld(world);\n if (existing) {\n return existing;\n }\n\n const getDocstringTransformed = (\n options?: { readonly fallback?: \"raw\" | \"throw\" }\n ): unknown | undefined => {\n const info = getDocstringInfo(world);\n if (!info) {\n return undefined;\n }\n const transformer = resolveDocstringTransformer(\n activeDocstringConfig.transformers,\n info.mediaType\n );\n if (!transformer) {\n if (options?.fallback === \"throw\") {\n const type = normalizeDocstringMediaType(info.mediaType) ?? \"<unknown>\";\n throw new RangeError(\n `No docstring transformer is configured for media type '${type}'.`\n );\n }\n return info.content;\n }\n return transformer(\n info.content,\n info.mediaType === undefined ? {} : { mediaType: info.mediaType }\n );\n };\n\n const runtime: StepRuntimeHelpers = {\n get hasTable() {\n return getRawTable(world) !== undefined;\n },\n get hasDocstring() {\n return getDocstring(world) !== undefined;\n },\n get currentStep() {\n return getStepMetadata(world);\n },\n getTable: bindGetTable(world),\n consumeTable: bindConsumeTable(world),\n getRawTable() {\n return getRawTable(world);\n },\n getDocstring() {\n return getDocstring(world);\n },\n getDocstringMediaType() {\n return getDocstringMediaType(world);\n },\n getDocstringInfo() {\n return getDocstringInfo(world);\n },\n consumeDocstring() {\n return consumeDocstring(world);\n },\n getDocstringTransformed,\n consumeDocstringTransformed(options) {\n const result = getDocstringTransformed(options);\n clearStepDocstring(world);\n return result;\n },\n getStepMetadata() {\n return getStepMetadata(world);\n },\n requireTable: bindRequireTable(world),\n };\n cacheRuntime(world, runtime);\n return runtime;\n}\n","import type { StepHandler } from \"@autometa/scopes\";\n\nconst PENDING_SCENARIO_SYMBOL: unique symbol = Symbol(\"autometa:scenario:pending\");\n\nexport class ScenarioPendingError extends Error {\n readonly reason?: string;\n readonly [PENDING_SCENARIO_SYMBOL] = true;\n\n constructor(reason?: string) {\n super(reason ? `Scenario pending: ${reason}` : \"Scenario pending\");\n this.name = \"ScenarioPendingError\";\n if (reason !== undefined && reason !== null) {\n const trimmed = String(reason).trim();\n if (trimmed.length > 0) {\n this.reason = trimmed;\n }\n }\n }\n}\n\nexport function isScenarioPendingError(error: unknown): error is ScenarioPendingError {\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as { [PENDING_SCENARIO_SYMBOL]?: unknown })[PENDING_SCENARIO_SYMBOL] === true\n );\n}\n\nfunction createPendingError(reason?: string): ScenarioPendingError {\n return new ScenarioPendingError(reason);\n}\n\n/**\n * Returns a step handler that marks the parent scenario as pending when executed.\n */\nexport function Pending<World = unknown>(reason?: string): StepHandler<World> {\n return function pendingStepHandler(world: World, ..._args: unknown[]): never {\n void world;\n throw createPendingError(reason);\n };\n}\n\n/**\n * Alias of {@link Pending} for teams that prefer the terminology used by some runners.\n */\nexport const ToDo = Pending;\n\n/**\n * Imperatively mark the current scenario as pending from within a step definition.\n *\n * @throws ScenarioPendingError to signal the executor that the scenario should be treated as pending.\n */\nexport function markScenarioPending(reason?: string): never {\n throw createPendingError(reason);\n}\n","import { generatePickleById } from \"@autometa/gherkin\";\nimport type {\n SimpleFeature,\n SimplePickle,\n SimplePickleFeatureRef,\n SimplePickleRuleRef,\n SimplePickleStep,\n SimpleRule,\n} from \"@autometa/gherkin\";\n\nexport function createFeatureRef(feature: SimpleFeature): SimplePickleFeatureRef {\n return {\n id: feature.id,\n name: feature.name,\n location: feature.location ?? { line: 1, column: 1 },\n tags: feature.tags,\n comments: feature.comments?.map((comment) => comment.text),\n };\n}\n\nexport function createRuleRef(rule: SimpleRule): SimplePickleRuleRef {\n return {\n id: rule.id,\n name: rule.name,\n location: rule.location ?? { line: 1, column: 1 },\n tags: rule.tags,\n };\n}\n\nexport function requirePickle(feature: SimpleFeature, scenarioId: string): SimplePickle {\n const pickle = generatePickleById(feature, scenarioId);\n if (!pickle) {\n throw new Error(\n `Unable to generate pickle for scenario \"${scenarioId}\". Ensure the feature contains compiled scenarios and stable ids.`\n );\n }\n return pickle;\n}\n\nexport function findPickleStep(\n pickle: SimplePickle,\n stepId: string\n): SimplePickleStep | undefined {\n return pickle.steps.find((step) => step.id === stepId || step.astNodeIds?.includes(stepId));\n}\n\n","import type { ExecutorConfig } from \"@autometa/config\";\nimport type { ScopeExecutionAdapter } from \"@autometa/scopes\";\nimport type {\n RuleNode,\n ScenarioExecution,\n ScenarioNode,\n ScenarioOutlineNode,\n ScenarioOutlineExample,\n TestPlan,\n} from \"@autometa/test-builder\";\nimport { getEventEmitter, TestStatus } from \"@autometa/events\";\nimport type { TestStatus as TestStatusValue } from \"@autometa/events\";\nimport { isGherkinStepError } from \"@autometa/errors\";\n\nimport { createTagFilter } from \"./tag-filter\";\nimport { resolveModeFromTags, selectSuiteByMode, selectTestByMode } from \"./modes\";\nimport { resolveTimeout } from \"./timeouts\";\nimport { runScenarioExecution } from \"./scenario-runner\";\nimport { ScopeLifecycle, type HookLogListener } from \"./scope-lifecycle\";\nimport type { ExecutorRuntime, SuiteFn } from \"./types\";\nimport { createFeatureRef, createRuleRef, requirePickle } from \"./events\";\n\nexport interface ExecuteFeatureOptions<World> {\n readonly plan: TestPlan<World>;\n readonly adapter: ScopeExecutionAdapter<World>;\n readonly runtime: ExecutorRuntime;\n readonly config: ExecutorConfig;\n readonly hookLogger?: HookLogListener;\n}\n\ntype SuiteMetadata = {\n readonly kind?: \"feature\" | \"rule\" | \"scenarioOutline\" | \"examples\";\n readonly keyword?: string;\n};\n\ntype SuiteFnWithMetadata = SuiteFn & {\n __withMetadata?: (metadata: SuiteMetadata | undefined, register: () => void) => void;\n};\n\ntype ScenarioOutlineExampleGroup<World> = {\n readonly group: ScenarioOutlineExample<World>[\"exampleGroup\"];\n readonly examples: ScenarioOutlineExample<World>[];\n};\n\ntype OutlineExampleCollection<World> = {\n readonly outline: ScenarioOutlineNode<World>;\n readonly order: string[];\n readonly groups: Map<string, ScenarioOutlineExampleGroup<World>>;\n};\n\nfunction runSuiteWithMetadata(\n suite: SuiteFn,\n metadata: SuiteMetadata,\n title: string,\n handler: () => void,\n timeout?: number\n): void {\n const target = suite as SuiteFnWithMetadata;\n if (typeof target.__withMetadata === \"function\") {\n target.__withMetadata(metadata, () => {\n suite(title, handler, timeout);\n });\n return;\n }\n suite(title, handler, timeout);\n}\n\nfunction isScenarioOutlineExample<World>(\n execution: ScenarioExecution<World>\n): execution is ScenarioOutlineExample<World> {\n return execution.type === \"example\";\n}\n\nfunction shouldDisplayExamplesGroup(group: ScenarioOutlineExample<unknown>[\"exampleGroup\"], totalGroups: number): boolean {\n if (totalGroups > 1) {\n return true;\n }\n\n const name = group.name?.trim();\n return Boolean(name && name.length > 0);\n}\n\nfunction formatExamplesGroupTitle(\n group: ScenarioOutlineExample<unknown>[\"exampleGroup\"],\n index: number\n): string {\n const trimmed = group.name?.trim();\n if (trimmed && trimmed.length > 0) {\n return trimmed;\n }\n return `Table #${index + 1}`;\n}\n\nexport function registerFeaturePlan<World>(options: ExecuteFeatureOptions<World>): void {\n const { plan, runtime, adapter, config, hookLogger } = options;\n const feature = plan.feature;\n const tagFilter = createTagFilter(config.test?.tagFilter);\n const scopeKeywords = collectScopeKeywords(feature);\n const eventEmitter = getEventEmitter();\n const featureRef = createFeatureRef(feature.feature);\n const lifecycle = new ScopeLifecycle(adapter, {\n ...(hookLogger ? { hookLogger } : {}),\n featureLanguage: feature.feature.language,\n scopeKeywords,\n });\n\n const featureTags = [\n ...(feature.feature.tags ?? []),\n ...(feature.scope.tags ?? []),\n ];\n const featureMode = resolveModeFromTags(feature.scope.mode, featureTags);\n const featureTimeout = resolveTimeout(feature.scope.timeout, config);\n const featureSuite = selectSuiteByMode(runtime.suite, featureMode);\n\n runSuiteWithMetadata(\n featureSuite,\n { kind: \"feature\", keyword: feature.keyword },\n feature.name,\n () => {\n runtime.beforeAll(async () => {\n await eventEmitter.featureStarted({ feature: featureRef });\n });\n runtime.afterAll(async () => {\n await eventEmitter.featureCompleted({ feature: featureRef });\n });\n lifecycle.configurePersistentScope(feature.scope, runtime);\n registerScenarios(feature.scenarios, runtime, config, tagFilter, lifecycle, feature.feature);\n registerScenarioOutlines(feature.scenarioOutlines, runtime, config, tagFilter, lifecycle, feature.feature, featureRef);\n registerRules(feature.rules, runtime, config, tagFilter, lifecycle, feature.feature, featureRef);\n },\n featureTimeout.milliseconds\n );\n}\n\nfunction collectScopeKeywords<World>(feature: TestPlan<World>[\"feature\"]): ReadonlyMap<string, string> {\n const entries: Array<[string, string]> = [];\n\n entries.push([feature.scope.id, feature.keyword]);\n\n for (const scenario of feature.scenarios) {\n entries.push([scenario.scope.id, scenario.keyword]);\n }\n\n for (const outline of feature.scenarioOutlines) {\n entries.push([outline.scope.id, outline.keyword]);\n for (const example of outline.examples) {\n entries.push([example.scope.id, example.keyword]);\n }\n }\n\n for (const rule of feature.rules) {\n entries.push([rule.scope.id, rule.keyword]);\n for (const scenario of rule.scenarios) {\n entries.push([scenario.scope.id, scenario.keyword]);\n }\n for (const outline of rule.scenarioOutlines) {\n entries.push([outline.scope.id, outline.keyword]);\n for (const example of outline.examples) {\n entries.push([example.scope.id, example.keyword]);\n }\n }\n }\n\n return new Map(entries);\n}\n\nfunction registerRules<World>(\n rules: readonly RuleNode<World>[],\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"],\n featureRef: ReturnType<typeof createFeatureRef>\n): void {\n const eventEmitter = getEventEmitter();\n for (const rule of rules) {\n const ruleRef = createRuleRef(rule.rule);\n const ruleTags = [\n ...(rule.rule.tags ?? []),\n ...(rule.scope.tags ?? []),\n ];\n const ruleMode = resolveModeFromTags(rule.scope.mode, ruleTags);\n const suite = selectSuiteByMode(runtime.suite, ruleMode);\n const timeout = resolveTimeout(rule.scope.timeout, config);\n runSuiteWithMetadata(\n suite,\n { kind: \"rule\", keyword: rule.keyword },\n rule.name,\n () => {\n runtime.beforeAll(async () => {\n await eventEmitter.ruleStarted({ feature: featureRef, rule: ruleRef });\n });\n runtime.afterAll(async () => {\n await eventEmitter.ruleCompleted({ feature: featureRef, rule: ruleRef });\n });\n lifecycle.configurePersistentScope(rule.scope, runtime);\n registerScenarios(rule.scenarios, runtime, config, tagFilter, lifecycle, feature);\n registerScenarioOutlines(rule.scenarioOutlines, runtime, config, tagFilter, lifecycle, feature, featureRef);\n },\n timeout.milliseconds\n );\n }\n}\n\nfunction registerScenarioOutlines<World>(\n outlines: readonly ScenarioOutlineNode<World>[],\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"],\n featureRef: ReturnType<typeof createFeatureRef>\n): void {\n const eventEmitter = getEventEmitter();\n for (const outline of outlines) {\n const outlineMode = resolveModeFromTags(outline.mode, outline.tags);\n const suite = selectSuiteByMode(runtime.suite, outlineMode);\n const timeout = resolveTimeout(outline.timeout, config);\n runSuiteWithMetadata(\n suite,\n { kind: \"scenarioOutline\", keyword: outline.keyword },\n outline.name,\n () => {\n const firstRule = outline.examples[0]?.rule?.rule;\n runtime.beforeAll(async () => {\n await eventEmitter.scenarioOutlineStarted({\n feature: featureRef,\n scenarioOutline: outline.outline,\n ...(firstRule ? { rule: createRuleRef(firstRule) } : {}),\n });\n });\n runtime.afterAll(async () => {\n await eventEmitter.scenarioOutlineCompleted({\n feature: featureRef,\n scenarioOutline: outline.outline,\n ...(firstRule ? { rule: createRuleRef(firstRule) } : {}),\n });\n });\n lifecycle.configurePersistentScope(outline.scope, runtime);\n registerScenarioExecutions(outline.examples, runtime, config, tagFilter, lifecycle, feature);\n },\n timeout.milliseconds\n );\n }\n}\n\nfunction registerScenarios<World>(\n scenarios: readonly ScenarioNode<World>[],\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"]\n): void {\n registerScenarioExecutions(scenarios, runtime, config, tagFilter, lifecycle, feature);\n}\n\nfunction registerScenarioExecutions<World>(\n executions: readonly ScenarioExecution<World>[],\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"]\n): void {\n const standaloneExecutions: ScenarioExecution<World>[] = [];\n const outlineExamples = new Map<string, OutlineExampleCollection<World>>();\n\n for (const execution of executions) {\n if (isScenarioOutlineExample(execution)) {\n const outlineId = execution.outline.scope.id;\n let collection = outlineExamples.get(outlineId);\n if (!collection) {\n collection = {\n outline: execution.outline,\n order: [],\n groups: new Map(),\n } satisfies OutlineExampleCollection<World>;\n outlineExamples.set(outlineId, collection);\n }\n\n const groupId = execution.exampleGroup.id;\n let groupInfo = collection.groups.get(groupId);\n if (!groupInfo) {\n groupInfo = {\n group: execution.exampleGroup,\n examples: [],\n } satisfies ScenarioOutlineExampleGroup<World>;\n collection.groups.set(groupId, groupInfo);\n collection.order.push(groupId);\n }\n\n groupInfo.examples.push(execution);\n continue;\n }\n\n standaloneExecutions.push(execution);\n }\n\n for (const execution of standaloneExecutions) {\n scheduleScenario(execution, runtime, config, tagFilter, lifecycle, feature);\n }\n\n for (const collection of outlineExamples.values()) {\n const orderedGroups = collection.order\n .map((id) => collection.groups.get(id))\n .filter((info): info is ScenarioOutlineExampleGroup<World> => Boolean(info));\n\n if (orderedGroups.length === 0) {\n continue;\n }\n\n if (orderedGroups.length === 1) {\n const [singleGroup] = orderedGroups;\n if (singleGroup && !shouldDisplayExamplesGroup(singleGroup.group, orderedGroups.length)) {\n for (const example of singleGroup.examples) {\n scheduleScenario(example, runtime, config, tagFilter, lifecycle, feature);\n }\n continue;\n }\n }\n\n orderedGroups.forEach((info, index) => {\n const title = formatExamplesGroupTitle(info.group, index);\n const keyword = (info.group.keyword ?? \"Examples\").trim() || \"Examples\";\n runSuiteWithMetadata(\n runtime.suite,\n { kind: \"examples\", keyword },\n title,\n () => {\n for (const example of info.examples) {\n scheduleScenario(example, runtime, config, tagFilter, lifecycle, feature);\n }\n }\n );\n });\n }\n}\n\nfunction scheduleScenario<World>(\n execution: ScenarioExecution<World>,\n runtime: ExecutorRuntime,\n config: ExecutorConfig,\n tagFilter: ReturnType<typeof createTagFilter>,\n lifecycle: ScopeLifecycle<World>,\n feature: TestPlan<World>[\"feature\"][\"feature\"]\n): void {\n const title = buildScenarioTitle(execution);\n const eventEmitter = getEventEmitter();\n\n if (!tagFilter.evaluate(execution.tags)) {\n runtime.test.skip(title, () => undefined);\n return;\n }\n\n if (execution.pending) {\n execution.markPending(execution.pendingReason);\n registerPendingScenarioTest(execution, runtime, title);\n return;\n }\n\n const effectiveMode = resolveModeFromTags(execution.mode, execution.tags);\n const testFn = selectTestByMode(runtime.test, effectiveMode);\n const scenarioTimeout = resolveTimeout(execution.timeout, config);\n\n testFn(title, async () => {\n const hooks = lifecycle.collectScenarioHooks(execution);\n const pickle = requirePickle(feature, execution.gherkin.id);\n const scenarioScope = pickle.scenario;\n const isExample = isScenarioOutlineExample(execution);\n\n if (isExample) {\n await eventEmitter.exampleStarted({\n feature: pickle.feature,\n scenarioOutline: execution.outline.outline,\n example: execution.exampleGroup,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n });\n }\n\n await eventEmitter.scenarioStarted({\n feature: pickle.feature,\n scenario: scenarioScope,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n });\n\n let status: TestStatusValue | undefined;\n try {\n await lifecycle.runScenario(\n execution,\n hooks,\n async (_world, context) => {\n await runScenarioExecution(execution, context);\n },\n { events: { pickle } }\n );\n status = execution.result.status === \"passed\"\n ? TestStatus.PASSED\n : execution.result.status === \"failed\"\n ? TestStatus.FAILED\n : execution.result.status === \"skipped\"\n ? TestStatus.SKIPPED\n : execution.result.status === \"pending\"\n ? TestStatus.SKIPPED\n : undefined;\n } catch (error) {\n status = TestStatus.FAILED;\n if (!isGherkinStepError(error)) {\n await eventEmitter.errorRaised({\n error,\n phase: \"scenario\",\n feature: pickle.feature,\n scenario: pickle.scenario,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n pickle,\n });\n }\n throw error;\n } finally {\n if (status) {\n await eventEmitter.statusChanged({\n status,\n feature: pickle.feature,\n scenario: pickle.scenario,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n pickle,\n metadata: { result: execution.result },\n });\n }\n\n await eventEmitter.scenarioCompleted({\n feature: pickle.feature,\n scenario: scenarioScope,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n metadata: { result: execution.result },\n });\n\n if (isExample) {\n await eventEmitter.exampleCompleted({\n feature: pickle.feature,\n scenarioOutline: execution.outline.outline,\n example: execution.exampleGroup,\n pickle,\n ...(pickle.rule ? { rule: pickle.rule } : {}),\n metadata: { result: execution.result },\n });\n }\n }\n }, scenarioTimeout.milliseconds);\n}\n\nfunction registerPendingScenarioTest<World>(\n execution: ScenarioExecution<World>,\n runtime: ExecutorRuntime,\n title: string\n): void {\n const reason = execution.pendingReason;\n const { test } = runtime;\n\n if (typeof test.todo === \"function\") {\n test.todo(title, reason);\n return;\n }\n\n if (typeof test.pending === \"function\") {\n test.pending(title, reason);\n return;\n }\n\n if (typeof test.skip === \"function\") {\n test.skip(title, () => undefined);\n return;\n }\n\n test(title, () => undefined);\n}\n\nfunction buildScenarioTitle<World>(execution: ScenarioExecution<World>): string {\n if (!isScenarioOutlineExample(execution)) {\n return execution.name;\n }\n const descriptor = formatExampleDescriptor(execution);\n if (!descriptor) {\n return `${execution.name} [Example ${execution.exampleIndex + 1}]`;\n }\n return `${execution.name} [${descriptor}]`;\n}\n\nfunction formatExampleDescriptor<World>(\n example: ScenarioOutlineExample<World>\n): string | undefined {\n const segments: string[] = [];\n segments.push(`Example ${example.exampleIndex + 1}`);\n const groupName = example.exampleGroup.name?.trim();\n if (groupName) {\n segments.push(groupName);\n }\n const valueSummary = formatExampleValues(example.exampleGroup, example.exampleIndex);\n if (valueSummary) {\n segments.push(valueSummary);\n }\n return segments.length > 0 ? segments.join(\" · \") : undefined;\n}\n\nfunction formatExampleValues(\n group: ScenarioOutlineExample<unknown>[\"exampleGroup\"],\n index: number\n): string | undefined {\n const headers = group.tableHeader ?? [];\n const rows = group.tableBody ?? [];\n const row = rows[index];\n if (!row || headers.length === 0) {\n return undefined;\n }\n const pairs: string[] = [];\n headers.forEach((header, headerIndex) => {\n const key = header?.trim();\n if (!key) {\n return;\n }\n const value = row[headerIndex] ?? \"\";\n pairs.push(`${key}=${String(value).trim()}`);\n });\n return pairs.length > 0 ? pairs.join(\", \") : undefined;\n}\n","import * as TagExpressions from \"@cucumber/tag-expressions\";\n\nexport interface TagFilter {\n evaluate(tags: readonly string[]): boolean;\n}\n\nconst ALWAYS_TRUE: TagFilter = {\n evaluate: () => true,\n};\n\ntype TagExpressionParser = (expression: string) => { evaluate(tags: readonly string[]): boolean };\n\nconst resolveParser = (): TagExpressionParser => {\n const namespace = TagExpressions as {\n readonly parse?: unknown;\n readonly default?: unknown;\n };\n\n if (typeof namespace.parse === \"function\") {\n return namespace.parse as TagExpressionParser;\n }\n\n if (typeof namespace.default === \"function\") {\n return namespace.default as TagExpressionParser;\n }\n\n throw new Error(\"Unable to resolve @cucumber/tag-expressions parser export\");\n};\n\nconst parseExpression = resolveParser();\n\nexport const createTagFilter = (expression: string | undefined): TagFilter => {\n if (!expression || expression.trim().length === 0) {\n return ALWAYS_TRUE;\n }\n\n const parsed = parseExpression(expression);\n return {\n evaluate(tags: readonly string[]) {\n return parsed.evaluate(tags.map((tag) => tag.trim()));\n },\n };\n};\n","import type { ExecutionMode } from \"@autometa/scopes\";\nimport type { SuiteFn, TestFn } from \"./types\";\n\nconst MODE_TAG_ALIASES: Record<string, ExecutionMode> = {\n concurrent: \"concurrent\",\n sequential: \"sequential\",\n failing: \"failing\",\n fails: \"failing\",\n};\n\nfunction normalizeTagValue(tag: string): string {\n return tag.replace(/^@/, \"\").trim().toLowerCase();\n}\n\nfunction wrapFailingTest(test: TestFn): TestFn {\n const failing = ((title: string, handler: () => void | Promise<void>, timeout?: number) => {\n const wrapped = async () => {\n let threw = false;\n try {\n await handler();\n } catch (_error) {\n threw = true;\n return;\n }\n\n if (!threw) {\n throw new Error(\"Expected scenario to fail, but it passed\");\n }\n };\n\n test(title, wrapped, timeout);\n }) as TestFn;\n\n failing.skip = test.skip;\n failing.only = test.only;\n if (typeof test.concurrent === \"function\") {\n failing.concurrent = test.concurrent;\n }\n failing.failing = failing;\n failing.fails = failing;\n\n return failing;\n}\n\nfunction selectFailingTest(test: TestFn): TestFn {\n if (typeof test.failing === \"function\") {\n return test.failing;\n }\n if (typeof test.fails === \"function\") {\n return test.fails;\n }\n return wrapFailingTest(test);\n}\n\nexport const selectSuiteByMode = (suite: SuiteFn, mode: ExecutionMode): SuiteFn => {\n switch (mode) {\n case \"skip\":\n return suite.skip;\n case \"only\":\n return suite.only;\n case \"concurrent\":\n return typeof suite.concurrent === \"function\" ? suite.concurrent : suite;\n case \"sequential\":\n return typeof suite.sequential === \"function\" ? suite.sequential : suite;\n default:\n return suite;\n }\n};\n\nexport const selectTestByMode = (test: TestFn, mode: ExecutionMode): TestFn => {\n switch (mode) {\n case \"skip\":\n return test.skip;\n case \"only\":\n return test.only;\n case \"concurrent\":\n return typeof test.concurrent === \"function\" ? test.concurrent : test;\n case \"sequential\":\n return typeof test.sequential === \"function\" ? test.sequential : test;\n case \"failing\":\n return selectFailingTest(test);\n default:\n return test;\n }\n};\n\nexport const resolveModeFromTags = (\n currentMode: ExecutionMode,\n tags: readonly string[] | undefined\n): ExecutionMode => {\n if (currentMode !== \"default\") {\n return currentMode;\n }\n\n if (!tags || tags.length === 0) {\n return currentMode;\n }\n\n for (const tag of tags) {\n const normalized = normalizeTagValue(tag);\n const derived = MODE_TAG_ALIASES[normalized];\n if (derived) {\n return derived;\n }\n }\n\n return currentMode;\n};\n","import type {\n HookType,\n ParameterRegistryLike,\n ScopeExecutionAdapter,\n ScopeKind,\n ScopeNode,\n StepDefinition,\n} from \"@autometa/scopes\";\nimport { getEventEmitter } from \"@autometa/events\";\nimport type { HookDescriptor, HookKind } from \"@autometa/events\";\nimport type { SimpleStep } from \"@autometa/gherkin\";\nimport type { SimplePickle } from \"@autometa/gherkin\";\nimport type { ScenarioExecution } from \"@autometa/test-builder\";\n\nimport { collectScenarioHooks, type HookCollection, type ResolvedHook } from \"./hooks\";\nimport type { ExecutorRuntime } from \"./types\";\nimport { WorldContext } from \"./async-context\";\nimport { findPickleStep } from \"./events\";\n\nconst PERSISTENT_SCOPE_KINDS: ReadonlySet<ScopeKind> = new Set([\n \"feature\",\n \"rule\",\n \"scenarioOutline\",\n]);\n\nconst BEFORE_HOOK_TYPES: Record<ScopeKind, HookType | undefined> = {\n root: undefined,\n feature: \"beforeFeature\",\n rule: \"beforeRule\",\n scenario: \"beforeScenario\",\n scenarioOutline: \"beforeScenarioOutline\",\n};\n\nconst AFTER_HOOK_TYPES: Record<ScopeKind, HookType | undefined> = {\n root: undefined,\n feature: \"afterFeature\",\n rule: \"afterRule\",\n scenario: \"afterScenario\",\n scenarioOutline: \"afterScenarioOutline\",\n};\n\ninterface ScopeState<World> {\n readonly scope: ScopeNode<World>;\n readonly world: World;\n readonly dispose: () => Promise<void>;\n beforeExecuted: boolean;\n afterExecuted: boolean;\n}\n\nexport type StepStatus = \"passed\" | \"failed\" | \"skipped\";\n\nexport interface HookLifecycleTargetScopeMetadata {\n readonly id: string;\n readonly kind: ScopeKind;\n readonly name?: string;\n}\n\ntype ScenarioLifecycleType = ScenarioExecution<unknown>[\"type\"];\n\nexport interface HookLifecycleScenarioMetadata {\n readonly id: string;\n readonly name: string;\n readonly type: ScenarioLifecycleType;\n readonly tags: readonly string[];\n readonly qualifiedName: string;\n}\n\nexport interface HookLifecycleStepMetadata {\n readonly index: number;\n readonly keyword?: string;\n readonly text?: string;\n readonly status?: StepStatus;\n}\n\nexport interface HookLifecycleMetadata {\n readonly targetScope: HookLifecycleTargetScopeMetadata;\n readonly scenario?: HookLifecycleScenarioMetadata;\n readonly step?: HookLifecycleStepMetadata;\n readonly hook?: unknown;\n readonly [key: string]: unknown;\n}\n\ntype Mutable<T> = { -readonly [K in keyof T]: T[K] };\n\nexport interface StepHookDetails<World> {\n readonly index: number;\n readonly definition?: StepDefinition<World>;\n readonly gherkin?: SimpleStep;\n readonly status?: StepStatus;\n}\n\nexport interface StepHookInvocationOptions<World> {\n readonly direction?: HookDirection;\n readonly step?: StepHookDetails<World>;\n readonly metadata?: Record<string, unknown>;\n}\n\nexport type HookInvoker<World> = (\n hooks: readonly ResolvedHook<World>[],\n options: StepHookInvocationOptions<World>\n) => Promise<void>;\n\nexport interface HookLogPathSegment {\n readonly id: string;\n readonly kind: ScopeKind | \"step\";\n readonly name: string;\n readonly keyword?: string;\n}\n\nexport interface HookLogStepDetails {\n readonly index: number;\n readonly keyword?: string;\n readonly text?: string;\n readonly status?: StepStatus;\n}\n\nexport interface HookLogScenarioDetails {\n readonly id: string;\n readonly name: string;\n readonly fullName: string;\n readonly keyword?: string;\n readonly language?: string;\n}\n\nexport type HookLogPhase = \"before\" | \"after\";\n\nexport interface HookLogEvent {\n readonly message: string;\n readonly hookId: string;\n readonly hookType: HookType;\n readonly hookDescription?: string;\n readonly phase: HookLogPhase;\n readonly path: readonly HookLogPathSegment[];\n readonly scenario?: HookLogScenarioDetails;\n readonly step?: HookLogStepDetails;\n readonly targetKeyword?: string;\n readonly language?: string;\n}\n\nexport type HookLogListener = (event: HookLogEvent) => void;\n\nexport interface ScopeLifecycleOptions {\n readonly hookLogger?: HookLogListener;\n readonly featureLanguage?: string;\n readonly scopeKeywords?: ReadonlyMap<string, string>;\n}\n\nexport interface ScenarioEventContext {\n readonly pickle: SimplePickle;\n}\n\nexport interface ScenarioRunContext<World> {\n readonly world: World;\n readonly parameterRegistry: ParameterRegistryLike | undefined;\n readonly beforeStepHooks: readonly ResolvedHook<World>[];\n readonly afterStepHooks: readonly ResolvedHook<World>[];\n readonly events?: ScenarioEventContext;\n invokeHooks: HookInvoker<World>;\n}\n\ninterface HookInvocationParams<World> {\n readonly world: World;\n readonly scope: ScopeNode<World>;\n readonly scenario?: ScenarioExecution<World>;\n readonly step?: StepHookDetails<World>;\n readonly direction?: HookDirection;\n readonly metadata?: Record<string, unknown>;\n readonly events?: ScenarioEventContext;\n}\n\ntype HookDirection = \"asc\" | \"desc\";\n\nfunction formatSourceRef(source: { file?: string; line?: number; column?: number } | undefined): string | undefined {\n if (!source?.file) {\n return undefined;\n }\n const line = source.line ? `:${source.line}` : \"\";\n const column = source.column ? `:${source.column}` : \"\";\n return `${source.file}${line}${column}`;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport class ScopeLifecycle<World> {\n private readonly states = new Map<string, ScopeState<World>>();\n private readonly depthMap = new Map<string, number>();\n private readonly root: ScopeNode<World>;\n private readonly hookLogger?: HookLogListener;\n private readonly featureLanguage: string | undefined;\n private readonly scopeKeywords: ReadonlyMap<string, string>;\n\n constructor(\n private readonly adapter: ScopeExecutionAdapter<World>,\n options: ScopeLifecycleOptions = {}\n ) {\n this.root = adapter.plan.root;\n this.buildDepthMap(this.root, 0);\n if (options.hookLogger) {\n this.hookLogger = options.hookLogger;\n }\n this.featureLanguage = options.featureLanguage;\n this.scopeKeywords = options.scopeKeywords ?? new Map<string, string>();\n }\n\n configurePersistentScope(scope: ScopeNode<World>, runtime: ExecutorRuntime): void {\n if (!this.isPersistentScope(scope)) {\n return;\n }\n\n // Avoid creating feature/rule/outline worlds unless they are actually needed.\n // This preserves the common \"one world per scenario\" model and prevents\n // surprising extra world instantiations when no hooks exist for the scope.\n if (!this.shouldMaterializePersistentScope(scope)) {\n return;\n }\n\n runtime.beforeAll(async () => {\n await this.ensureState(scope);\n });\n\n runtime.afterAll(async () => {\n await this.teardownState(scope);\n });\n }\n\n collectScenarioHooks(execution: ScenarioExecution<World>): HookCollection<World> {\n return collectScenarioHooks(this.adapter, execution);\n }\n\n async runScenario(\n execution: ScenarioExecution<World>,\n hooks: HookCollection<World>,\n runner: (world: World, context: ScenarioRunContext<World>) => Promise<void>,\n options: { readonly events?: ScenarioEventContext } = {}\n ): Promise<void> {\n const parentWorld = await this.resolveParentWorldForScenario(execution);\n const world = await this.adapter.createWorld(execution.scope, parentWorld);\n const disposeWorld = createWorldDisposer(world);\n const invokeHooks = this.createHookInvoker(execution, world, options.events);\n\n const scenarioContext: ScenarioRunContext<World> = {\n world,\n parameterRegistry: this.adapter.getParameterRegistry(),\n beforeStepHooks: hooks.beforeStep,\n afterStepHooks: hooks.afterStep,\n ...(options.events ? { events: options.events } : {}),\n invokeHooks,\n };\n\n const errors: unknown[] = [];\n try {\n await WorldContext.run(world, async () => {\n await this.invokeHooks(hooks.beforeScenario, {\n world,\n scope: execution.scope,\n scenario: execution,\n ...(options.events ? { events: options.events } : {}),\n direction: \"asc\",\n });\n\n await runner(world, scenarioContext);\n });\n } catch (error) {\n errors.push(error);\n } finally {\n try {\n await this.invokeHooks(hooks.afterScenario, {\n world,\n scope: execution.scope,\n scenario: execution,\n ...(options.events ? { events: options.events } : {}),\n direction: \"desc\",\n metadata: { result: execution.result },\n });\n } catch (error) {\n errors.push(error);\n }\n\n try {\n await disposeWorld();\n } catch (error) {\n errors.push(error);\n }\n }\n\n if (errors.length === 1) {\n throw toError(errors[0], \"Scenario execution failed\");\n }\n\n if (errors.length > 1) {\n throw combineErrors(errors, \"Multiple errors occurred during scenario execution\");\n }\n }\n\n private async ensureState(scope: ScopeNode<World>): Promise<ScopeState<World>> {\n let state = this.states.get(scope.id);\n if (state) {\n if (!state.beforeExecuted) {\n await this.runScopeHooks(scope, \"before\", state.world);\n state.beforeExecuted = true;\n }\n return state;\n }\n\n await this.ensureAncestorStates(scope);\n\n const parentWorld = await this.resolveParentWorld(scope);\n const world = await this.adapter.createWorld(scope, parentWorld);\n const dispose = createWorldDisposer(world);\n\n state = {\n scope,\n world,\n dispose,\n beforeExecuted: false,\n afterExecuted: false,\n } satisfies ScopeState<World>;\n\n this.states.set(scope.id, state);\n\n await this.runScopeHooks(scope, \"before\", world);\n state.beforeExecuted = true;\n\n return state;\n }\n\n private async teardownState(scope: ScopeNode<World>): Promise<void> {\n const state = this.states.get(scope.id);\n if (!state) {\n return;\n }\n\n if (!state.afterExecuted) {\n await this.runScopeHooks(scope, \"after\", state.world);\n state.afterExecuted = true;\n }\n\n await state.dispose();\n this.states.delete(scope.id);\n }\n\n private async ensureAncestorStates(scope: ScopeNode<World>): Promise<void> {\n const parent = this.getParentScope(scope);\n if (!parent) {\n return;\n }\n\n if (!this.isPersistentScope(parent)) {\n return;\n }\n\n if (!this.shouldMaterializePersistentScope(parent)) {\n return;\n }\n\n await this.ensureState(parent);\n }\n\n private async resolveParentWorld(scope: ScopeNode<World>): Promise<World | undefined> {\n const parent = this.getParentScope(scope);\n if (!parent || !this.isPersistentScope(parent)) {\n return undefined;\n }\n\n if (!this.shouldMaterializePersistentScope(parent)) {\n return undefined;\n }\n\n const parentState = this.states.get(parent.id) ?? (await this.ensureState(parent));\n return parentState.world;\n }\n\n private async resolveParentWorldForScenario(\n execution: ScenarioExecution<World>\n ): Promise<World | undefined> {\n const scope = execution.scope;\n const ownState = this.states.get(scope.id);\n if (ownState) {\n return ownState.world;\n }\n\n const ancestors = this.adapter.getAncestors(scope.id);\n for (let index = ancestors.length - 1; index >= 0; index -= 1) {\n const candidate = ancestors[index];\n if (!candidate || !this.isPersistentScope(candidate)) {\n continue;\n }\n\n if (!this.shouldMaterializePersistentScope(candidate)) {\n continue;\n }\n const state = this.states.get(candidate.id) ?? (await this.ensureState(candidate));\n if (state) {\n return state.world;\n }\n }\n return undefined;\n }\n\n private getParentScope(scope: ScopeNode<World>): ScopeNode<World> | undefined {\n const ancestors = this.adapter.getAncestors(scope.id);\n if (ancestors.length === 0) {\n return undefined;\n }\n return ancestors[ancestors.length - 1];\n }\n\n private isPersistentScope(scope: ScopeNode<World>): boolean {\n return PERSISTENT_SCOPE_KINDS.has(scope.kind);\n }\n\n private shouldMaterializePersistentScope(scope: ScopeNode<World>): boolean {\n const beforeType = BEFORE_HOOK_TYPES[scope.kind];\n const afterType = AFTER_HOOK_TYPES[scope.kind];\n\n if (beforeType) {\n const hooks = this.collectHooksForScope(scope, beforeType);\n if (hooks.length > 0) {\n return true;\n }\n }\n\n if (afterType) {\n const hooks = this.collectHooksForScope(scope, afterType);\n if (hooks.length > 0) {\n return true;\n }\n }\n\n return false;\n }\n\n private async runScopeHooks(\n scope: ScopeNode<World>,\n phase: \"before\" | \"after\",\n world: World\n ): Promise<void> {\n const hookType = phase === \"before\" ? BEFORE_HOOK_TYPES[scope.kind] : AFTER_HOOK_TYPES[scope.kind];\n if (!hookType) {\n return;\n }\n\n const hooks = this.collectHooksForScope(scope, hookType);\n if (!hooks.length) {\n return;\n }\n\n await this.invokeHooks(hooks, {\n world,\n scope,\n direction: phase === \"before\" ? \"asc\" : \"desc\",\n });\n }\n\n private createHookInvoker(\n execution: ScenarioExecution<World>,\n world: World,\n events?: ScenarioEventContext\n ): HookInvoker<World> {\n return async (hooks, options) => {\n const params: HookInvocationParams<World> = {\n world,\n scope: execution.scope,\n scenario: execution,\n ...(events ? { events } : {}),\n ...(options.direction ? { direction: options.direction } : {}),\n ...(options.step ? { step: options.step } : {}),\n ...(options.metadata ? { metadata: options.metadata } : {}),\n };\n\n await this.invokeHooks(hooks, params);\n };\n }\n\n private async invokeHooks(\n hooks: readonly ResolvedHook<World>[],\n params: HookInvocationParams<World>\n ): Promise<void> {\n if (hooks.length === 0) {\n return;\n }\n\n const sorted = this.sortHooks(hooks, params.direction ?? \"asc\");\n const eventEmitter = getEventEmitter();\n const pickle = params.events?.pickle;\n\n for (const entry of sorted) {\n const source = formatSourceRef(entry.hook.source ?? entry.scope.source);\n const hookMetadata = isRecord(entry.hook.options.data)\n ? entry.hook.options.data\n : undefined;\n const pickleStep = pickle && params.step?.gherkin?.id\n ? findPickleStep(pickle, params.step.gherkin.id)\n : undefined;\n const hookDescriptor: HookDescriptor = {\n kind: entry.hook.type as HookKind,\n ...(entry.hook.description ? { name: entry.hook.description } : {}),\n ...(source ? { source } : {}),\n ...(pickle ? { feature: pickle.feature } : {}),\n ...(pickle?.rule ? { rule: pickle.rule } : {}),\n ...(pickle ? { scenario: pickle.scenario } : {}),\n ...(pickleStep ? { step: pickleStep } : {}),\n ...(pickle ? { pickle } : {}),\n ...(hookMetadata ? { metadata: hookMetadata } : {}),\n };\n\n await eventEmitter.hookStarted({\n hook: hookDescriptor,\n metadata: { hookId: entry.hook.id },\n });\n\n const metadata = this.buildHookMetadata(entry, params);\n const log = this.createContextLogger(entry, params);\n const context = {\n world: params.world,\n scope: entry.scope,\n ...(metadata ? { metadata } : {}),\n ...(log ? { log } : {}),\n } as const;\n\n try {\n // eslint-disable-next-line no-await-in-loop\n await entry.hook.handler(context);\n } catch (error) {\n await eventEmitter.errorRaised({\n error,\n phase: \"hook\",\n ...(pickle ? { feature: pickle.feature } : {}),\n ...(pickle?.rule ? { rule: pickle.rule } : {}),\n ...(pickle ? { scenario: pickle.scenario } : {}),\n ...(pickle ? { pickle } : {}),\n metadata: { hook: hookDescriptor, hookId: entry.hook.id },\n });\n throw error;\n } finally {\n await eventEmitter.hookCompleted({\n hook: hookDescriptor,\n metadata: { hookId: entry.hook.id },\n });\n }\n }\n }\n\n private buildHookMetadata(\n entry: ResolvedHook<World>,\n params: HookInvocationParams<World>\n ): HookLifecycleMetadata | undefined {\n const metadata: Partial<Mutable<HookLifecycleMetadata>> & Record<string, unknown> = {};\n\n if (params.metadata) {\n Object.assign(metadata, params.metadata);\n }\n\n if (entry.hook.options.data !== undefined) {\n metadata.hook = entry.hook.options.data;\n }\n\n metadata.targetScope = {\n id: params.scope.id,\n kind: params.scope.kind,\n name: params.scope.name,\n } as HookLifecycleTargetScopeMetadata;\n\n if (params.scenario) {\n metadata.scenario = {\n id: params.scenario.id,\n name: params.scenario.name,\n type: params.scenario.type,\n tags: params.scenario.tags,\n qualifiedName: params.scenario.qualifiedName,\n } as HookLifecycleScenarioMetadata;\n }\n\n if (params.step) {\n const { step } = params;\n metadata.step = {\n index: step.index,\n status: step.status,\n keyword: step.gherkin?.keyword ?? step.definition?.keyword,\n text: step.gherkin?.text,\n } as HookLifecycleStepMetadata;\n }\n\n return Object.keys(metadata).length > 0 ? (metadata as HookLifecycleMetadata) : undefined;\n }\n\n private collectHooksForScope(\n scope: ScopeNode<World>,\n type: HookType\n ): ResolvedHook<World>[] {\n const chain = this.buildChain(scope);\n const collected: ResolvedHook<World>[] = [];\n\n for (const candidate of chain) {\n for (const hook of candidate.hooks) {\n if (hook.type === type) {\n collected.push({ hook, scope: candidate });\n }\n }\n }\n\n return collected;\n }\n\n private buildChain(scope: ScopeNode<World>): ScopeNode<World>[] {\n const ancestors = this.adapter.getAncestors(scope.id);\n return [this.root, ...ancestors, scope];\n }\n\n private createContextLogger(\n entry: ResolvedHook<World>,\n params: HookInvocationParams<World>\n ): ((message: string) => void) | undefined {\n if (!this.hookLogger) {\n return undefined;\n }\n\n const emit = this.hookLogger;\n return (rawMessage: string) => {\n if (rawMessage === undefined || rawMessage === null) {\n return;\n }\n const message = String(rawMessage);\n if (message.length === 0) {\n return;\n }\n try {\n emit(this.buildHookLogEvent(entry, params, message));\n } catch (error) {\n if (typeof console !== \"undefined\" && typeof console.error === \"function\") {\n console.error(error);\n }\n }\n };\n }\n\n private buildHookLogEvent(\n entry: ResolvedHook<World>,\n params: HookInvocationParams<World>,\n message: string\n ): HookLogEvent {\n const ancestors = this.adapter.getAncestors(params.scope.id);\n const path: HookLogPathSegment[] = ancestors.map((node) => this.toPathSegment(node));\n const targetSegment = this.toPathSegment(params.scope);\n path.push(targetSegment);\n\n const direction = params.direction ?? \"asc\";\n const phase: HookLogPhase = direction === \"desc\" ? \"after\" : \"before\";\n\n const scenarioIndex = this.findScenarioSegmentIndex(path);\n const scenarioDetails = this.buildScenarioDetails(path, scenarioIndex, params);\n\n const language = this.resolveLanguage(params, scenarioDetails);\n const targetKeyword = this.scopeKeywords.get(params.scope.id);\n\n if (params.step) {\n path.push(this.toStepSegment(params.scope, params.step));\n }\n\n return {\n message,\n hookId: entry.hook.id,\n hookType: entry.hook.type,\n ...(entry.hook.description ? { hookDescription: entry.hook.description } : {}),\n phase,\n path,\n ...(scenarioDetails ? { scenario: scenarioDetails } : {}),\n ...(params.step ? { step: this.toStepDetails(params.step) } : {}),\n ...(targetKeyword ? { targetKeyword } : {}),\n ...(language ? { language } : {}),\n };\n }\n\n private toPathSegment(scope: ScopeNode<World>): HookLogPathSegment {\n const keyword = this.scopeKeywords.get(scope.id);\n return {\n id: scope.id,\n kind: scope.kind,\n name: scope.name,\n ...(keyword ? { keyword } : {}),\n };\n }\n\n private toStepSegment(\n scope: ScopeNode<World>,\n step: StepHookDetails<World>\n ): HookLogPathSegment {\n const keyword = step.gherkin?.keyword ?? step.definition?.keyword;\n return {\n id: `${scope.id}:step:${step.index}`,\n kind: \"step\",\n name: this.describeStep(step),\n ...(keyword ? { keyword: keyword.trim() } : {}),\n };\n }\n\n private toStepDetails(step: StepHookDetails<World>): HookLogStepDetails {\n return {\n index: step.index,\n ...(step.gherkin?.keyword ? { keyword: step.gherkin.keyword } : {}),\n ...(step.gherkin?.text ? { text: step.gherkin.text } : {}),\n ...(step.status ? { status: step.status } : {}),\n };\n }\n\n private describeStep(step: StepHookDetails<World>): string {\n const keyword = step.gherkin?.keyword ?? step.definition?.keyword;\n const text = step.gherkin?.text ?? this.describeStepExpression(step.definition);\n\n if (keyword) {\n const trimmedKeyword = keyword.trim();\n if (text && text.length > 0) {\n const needsSpace = text.startsWith(\" \");\n return `${trimmedKeyword}${needsSpace ? \"\" : \" \"}${text}`;\n }\n return trimmedKeyword;\n }\n\n if (text && text.length > 0) {\n return text;\n }\n\n return `Step #${step.index + 1}`;\n }\n\n private describeStepExpression(\n definition: StepDefinition<World> | undefined\n ): string | undefined {\n if (!definition) {\n return undefined;\n }\n\n const expression = definition.expression;\n if (typeof expression === \"string\") {\n return expression;\n }\n return expression.toString();\n }\n\n private findScenarioSegmentIndex(path: readonly HookLogPathSegment[]): number {\n for (let index = path.length - 1; index >= 0; index -= 1) {\n const segment = path[index];\n if (!segment) {\n continue;\n }\n if (segment.kind === \"scenario\") {\n return index;\n }\n if (segment.kind === \"scenarioOutline\") {\n return index;\n }\n }\n return -1;\n }\n\n private buildScenarioDetails(\n path: readonly HookLogPathSegment[],\n scenarioIndex: number,\n params: HookInvocationParams<World>\n ): HookLogScenarioDetails | undefined {\n if (scenarioIndex < 0) {\n return undefined;\n }\n\n const scenarioSegment = path[scenarioIndex];\n if (!scenarioSegment) {\n return undefined;\n }\n\n const segments = path.slice(0, scenarioIndex + 1).map((segment) => segment.name);\n const fullName = segments.join(\" › \");\n\n const scenario = params.scenario;\n const keyword = scenario?.keyword ?? scenarioSegment.keyword;\n const language = scenario?.feature.feature.language ?? this.featureLanguage;\n if (scenario) {\n return {\n id: scenario.id,\n name: scenario.name,\n fullName,\n ...(keyword ? { keyword } : {}),\n ...(language ? { language } : {}),\n };\n }\n\n return {\n id: scenarioSegment.id,\n name: scenarioSegment.name,\n fullName,\n ...(keyword ? { keyword } : {}),\n ...(language ? { language } : {}),\n };\n }\n\n private resolveLanguage(\n params: HookInvocationParams<World>,\n scenarioDetails: HookLogScenarioDetails | undefined\n ): string | undefined {\n if (params.scenario) {\n const scenarioLanguage = params.scenario.feature.feature.language;\n if (scenarioLanguage) {\n return scenarioLanguage;\n }\n }\n\n if (scenarioDetails?.language) {\n return scenarioDetails.language;\n }\n\n return this.featureLanguage;\n }\n\n private sortHooks(\n hooks: readonly ResolvedHook<World>[],\n direction: HookDirection\n ): ResolvedHook<World>[] {\n return hooks\n .slice()\n .sort((a, b) => this.compareHooks(a, b, direction));\n }\n\n private compareHooks(\n a: ResolvedHook<World>,\n b: ResolvedHook<World>,\n direction: HookDirection\n ): number {\n const orderA = a.hook.options.order ?? 5;\n const orderB = b.hook.options.order ?? 5;\n if (orderA !== orderB) {\n return direction === \"asc\" ? orderA - orderB : orderB - orderA;\n }\n\n const depthA = this.depthMap.get(a.scope.id) ?? 0;\n const depthB = this.depthMap.get(b.scope.id) ?? 0;\n if (depthA !== depthB) {\n // Default ordering prefers the most nested hook:\n // - \"before\" hooks run deepest → shallowest\n // - \"after\" hooks run shallowest → deepest\n return direction === \"asc\" ? depthB - depthA : depthA - depthB;\n }\n\n return a.hook.id.localeCompare(b.hook.id);\n }\n\n private buildDepthMap(node: ScopeNode<World>, depth: number): void {\n this.depthMap.set(node.id, depth);\n for (const child of node.children) {\n this.buildDepthMap(child, depth + 1);\n }\n }\n}\n\ninterface DisposableLike {\n dispose(): void | Promise<void>;\n}\n\nfunction normalizeError(value: unknown, fallbackMessage: string): Error {\n if (value instanceof Error) {\n return value;\n }\n const error = new Error(fallbackMessage);\n Object.defineProperty(error, \"cause\", {\n configurable: true,\n enumerable: false,\n writable: true,\n value,\n });\n return error;\n}\n\nfunction toError(value: unknown, fallbackMessage: string): Error {\n return normalizeError(value, fallbackMessage);\n}\n\nfunction combineErrors(values: readonly unknown[], message: string): Error {\n const normalized = values.map((value, index) =>\n normalizeError(value, `${message} (${index + 1})`)\n );\n const aggregate = new Error(message);\n Object.defineProperty(aggregate, \"cause\", {\n configurable: true,\n enumerable: false,\n writable: true,\n value: normalized,\n });\n return aggregate;\n}\n\nfunction createWorldDisposer(world: unknown): () => Promise<void> {\n const disposers: Array<() => Promise<void>> = [];\n\n if (world && typeof world === \"object\") {\n const record = world as Record<string, unknown>;\n\n const app = record.app;\n if (isDisposable(app)) {\n disposers.push(async () => {\n await app.dispose();\n });\n }\n\n const container = (record.di ?? record.container) as unknown;\n if (isDisposable(container)) {\n disposers.push(async () => {\n await container.dispose();\n });\n }\n }\n\n return async () => {\n if (disposers.length === 0) {\n return;\n }\n\n const errors: unknown[] = [];\n for (const dispose of disposers) {\n try {\n await dispose();\n } catch (error) {\n errors.push(error);\n }\n }\n\n if (errors.length === 1) {\n throw toError(errors[0], \"World disposal failed\");\n }\n\n if (errors.length > 1) {\n throw combineErrors(errors, \"Multiple errors occurred while disposing world resources\");\n }\n };\n}\n\nfunction isDisposable(value: unknown): value is DisposableLike {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n const candidate = value as Record<string, unknown>;\n const dispose = candidate.dispose;\n return typeof dispose === \"function\";\n}\n","import { AsyncLocalStorage } from \"node:async_hooks\";\n\nconst WORLD_CONTEXT_KEY = \"__AUTOMETA_EXECUTOR_WORLD_CONTEXT__\";\n\ntype GlobalWithWorldContext = typeof globalThis & {\n [WORLD_CONTEXT_KEY]?: AsyncLocalStorage<unknown>;\n};\n\nconst globalTarget = globalThis as GlobalWithWorldContext;\n\nconst getOrCreateWorldContext = (): AsyncLocalStorage<unknown> => {\n const existing = globalTarget[WORLD_CONTEXT_KEY];\n if (existing) {\n return existing;\n }\n const created = new AsyncLocalStorage<unknown>();\n globalTarget[WORLD_CONTEXT_KEY] = created;\n return created;\n};\n\nexport const WorldContext = getOrCreateWorldContext();\n\nexport function getWorld<T = unknown>(): T {\n const store = WorldContext.getStore();\n if (store === undefined) {\n throw new Error(\n \"World context is not available. Are you running inside a scenario?\"\n );\n }\n return store as T;\n}\n\nexport function tryGetWorld<T = unknown>(): T | undefined {\n return WorldContext.getStore() as T | undefined;\n}\n","export { resolveTimeout, chooseTimeout } from \"./timeouts\";\nexport type { TimeoutResolution, TimeoutSource } from \"./timeouts\";\nexport { collectScenarioHooks } from \"./hooks\";\nexport type { HookCollection, ResolvedHook } from \"./hooks\";\nexport { runScenarioExecution } from \"./scenario-runner\";\nexport type { ScenarioRunContext } from \"./scenario-runner\";\nexport { registerFeaturePlan } from \"./execute-plan\";\nexport type { ExecuteFeatureOptions } from \"./execute-plan\";\nexport {\n\tScopeLifecycle,\n\ttype HookLogEvent,\n\ttype HookLogListener,\n\ttype HookLogPathSegment,\n\ttype HookLogScenarioDetails,\n\ttype HookLogStepDetails,\n\ttype HookLogPhase,\n\ttype HookLifecycleMetadata,\n\ttype HookLifecycleScenarioMetadata,\n\ttype HookLifecycleStepMetadata,\n\ttype HookLifecycleTargetScopeMetadata,\n} from \"./scope-lifecycle\";\nexport { selectSuiteByMode, selectTestByMode, resolveModeFromTags } from \"./modes\";\nexport { createTagFilter, type TagFilter } from \"./tag-filter\";\nexport {\n\tScenarioPendingError,\n\tisScenarioPendingError,\n\tPending,\n\tToDo,\n\tmarkScenarioPending,\n} from \"./pending\";\nexport {\n\tconfigureStepTables,\n\tresetStepTableConfig,\n\tconfigureStepDocstrings,\n\tresetStepDocstringConfig,\n\tsetStepTable,\n\tclearStepTable,\n\tgetTable,\n\tconsumeTable,\n\tgetRawTable,\n\tsetStepDocstring,\n\tsetStepDocstringInfo,\n\tclearStepDocstring,\n\tgetDocstring,\n\tgetDocstringMediaType,\n\tgetDocstringInfo,\n\tconsumeDocstring,\n\tsetStepMetadata,\n\tclearStepMetadata,\n\tgetStepMetadata,\n\tcreateStepRuntime,\n\ttype RawTable,\n\ttype DocstringInfo,\n\ttype DocstringTransformer,\n\ttype DocstringTransformConfig,\n\ttype StepRuntimeHelpers,\n\ttype StepRuntimeMetadata,\n} from \"./runtime/step-data\";\nexport { tryGetWorld, getWorld } from \"./async-context\";\nexport * from \"./types\";\n\nexport default {};\n"]}
|