@autometa/test-builder 0.4.1 → 1.0.0-rc.0

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.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/bridges/bridge.ts","../src/bridges/bridge-search.ts","../src/bridges/bridge-query.ts","../src/gherkin-walker.ts","../src/scope-search.ts","../src/test-builder.ts"],"sourcesContent":["export * from \"./bridges\";\nexport * from \"./test-builder\";\nexport * from \"./scope-search\";\nexport * from \"./gherkin-walker\";\n","import { App } from \"@autometa/app\";\nimport {\n Background,\n DataTable,\n Example,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step,\n} from \"@autometa/gherkin\";\nimport { BackgroundScope, GlobalScope } from \"@autometa/scopes\";\nimport {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n ScenarioScope,\n Scope,\n StepScope,\n} from \"@autometa/scopes\";\n\nexport abstract class GherkinCodeBridge {\n abstract data: { gherkin: GherkinNode; scope: Scope };\n}\nexport class GlobalBridge extends GherkinCodeBridge {\n readonly data: { gherkin: GherkinNode; scope: GlobalScope };\n constructor(scope: GlobalScope) {\n super();\n const nullNode = class extends GherkinNode {\n keyword = \"none\";\n };\n this.data = {\n scope,\n gherkin: new nullNode(),\n };\n }\n}\nexport class FeatureBridge extends GherkinCodeBridge {\n data: { gherkin: Feature; scope: FeatureScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n rules: RuleBridge[] = [];\n steps: StepBridge[] = [];\n\n accumulateTags() {\n const scenarioTags = this.scenarios.map((scenario) => scenario.accumulateTags()).flat();\n const ruleTags = this.rules.map((rule) => rule.accumulateTags()).flat();\n const allTags = [...this.data.gherkin.tags, ...scenarioTags, ...ruleTags];\n return [...new Set(allTags)];\n }\n}\nexport class BackgroundBridge extends GherkinCodeBridge {\n data: { gherkin: Background; scope: BackgroundScope };\n steps: StepBridge[] = [];\n}\n\nexport class RuleBridge extends GherkinCodeBridge {\n data: { gherkin: Rule; scope: RuleScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n steps: StepBridge[] = [];\n\n accumulateTags() {\n const scenarioTags = this.scenarios.map((scenario) => scenario.accumulateTags()).flat();\n const allTags = [...this.data.gherkin.tags, ...scenarioTags];\n return [...new Set(allTags)];\n }\n}\n\nexport class ScenarioBridge extends GherkinCodeBridge {\n data: { gherkin: Scenario; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n\n get title() {\n return this.data.scope.title(this.data.gherkin);\n }\n get tags() {\n return [...this.data.gherkin.tags];\n }\n\n accumulateTags() {\n return this.tags;\n }\n}\nexport class ExampleBridge extends GherkinCodeBridge {\n data: { gherkin: Example; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n get title() {\n return this.data.scope.title(this.data.gherkin);\n }\n get tags() {\n return [...this.data.gherkin.tags];\n }\n\n accumulateTags() {\n return this.tags;\n }\n}\nexport class ScenarioOutlineBridge extends GherkinCodeBridge {\n data: { gherkin: ScenarioOutline; scope: ScenarioOutlineScope };\n examples: ExamplesBridge[] = [];\n steps: StepBridge[] = [];\n get title() {\n return this.data.scope.title(this.data.gherkin);\n }\n get tags() {\n return [...this.data.gherkin.tags];\n }\n\n accumulateTags() {\n const exampleTags = this.examples.map((example) => example.tags).flat();\n const allTags = [...this.data.gherkin.tags, ...exampleTags];\n return [...new Set(allTags)];\n }\n}\n\nexport class ExamplesBridge extends GherkinCodeBridge {\n data: { gherkin: Examples; scope: ScenarioOutlineScope };\n scenarios: ScenarioBridge[] = [];\n steps: StepBridge[] = [];\n get title() {\n return this.data.scope.title(this.data.gherkin);\n }\n \n get tags() {\n return [...this.data.gherkin.tags];\n }\n\n accumulateTags() {\n const scenarioTags = this.scenarios.map((scenario) => scenario.accumulateTags()).flat();\n const allTags = [...this.data.gherkin.tags, ...scenarioTags];\n return [...new Set(allTags)];\n }\n}\n\nexport class StepBridge extends GherkinCodeBridge {\n data: {\n gherkin: Step;\n scope: StepScope<string, DataTable | undefined>;\n args: undefined | ((app: App) => unknown[]);\n };\n\n get args() {\n return this.data.args;\n }\n\n get expressionText() {\n return this.data.scope.expression.source;\n }\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport {\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n RuleBridge,\n} from \"./bridge\";\n\nexport function find(\n bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n if (bridge instanceof FeatureBridge) {\n return findByFeature(bridge, testName);\n }\n if (bridge instanceof RuleBridge) {\n return findByRule(bridge, testName);\n }\n if (bridge instanceof ScenarioOutlineBridge) {\n return findScenarioOutlineOrChild(bridge, testName);\n }\n\n throw new AutomationError(`Could not find test matching ${testName}`);\n}\nfunction findByFeature(\n feature: FeatureBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = feature.data.scope.title(feature.data.gherkin);\n const byScenario = findTestTypes(feature.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleTypes(feature.rules, testName, title);\n if (byRule) {\n return byRule;\n }\n}\nfunction findByRule(\n rule: RuleBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = rule.data.scope.title(rule.data.gherkin);\n const byScenario = findTestTypes(rule.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleOrChild(rule, testName, title);\n if (byRule) {\n return byRule;\n }\n}\n\nexport function findTestTypes(\n scenarios: (ScenarioBridge | ScenarioOutlineBridge | ExamplesBridge)[],\n testName: string,\n from?: string\n) {\n for (const scenario of scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n const found = findScenarioOutlineOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ExamplesBridge) {\n const found = findExamplesOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ScenarioBridge) {\n const found = findScenario(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n }\n}\n\nexport function findRuleTypes(\n rules: RuleBridge[],\n testName: string,\n from?: string\n) {\n for (const rule of rules) {\n const found = findRuleOrChild(rule, testName, from);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findRuleOrChild(\n rule: RuleBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin },\n } = rule;\n const title = scope.title(gherkin);\n if (testName === title) {\n return rule;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return rule;\n }\n }\n const newFrom = appendPath(from, title);\n return findTestTypes(rule.scenarios, testName, newFrom);\n}\n\nexport function findScenarioOutlineOrChild(\n outline: ScenarioOutlineBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin },\n } = outline;\n const title = scope.title(gherkin);\n if (testName === title) {\n return outline;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return outline;\n }\n }\n for (const example of outline.examples) {\n const newFrom = appendPath(from, title);\n const found = findExamplesOrChild(example, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nfunction appendPath(from: string | undefined, title: string) {\n return from ? `${from} ${title}` : title;\n}\n\nexport function findExamplesOrChild(\n example: ExamplesBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { gherkin },\n } = example;\n const title = `${gherkin.keyword}: ${gherkin.name}`;\n if (testName === title) {\n return example;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return example;\n }\n }\n for (const scenario of example.scenarios) {\n const newFrom = appendPath(from, title);\n const found = findScenario(scenario, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findScenario(\n scenario: ScenarioBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin },\n } = scenario;\n const title = scope.title(gherkin);\n if (testName === title) {\n return scenario;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return scenario;\n }\n }\n}\n","import { Background, GherkinNode } from \"@autometa/gherkin\";\nimport {\n FeatureBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n} from \".\";\n\nfunction failed(bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n if (bridge instanceof ScenarioOutlineBridge) {\n return failedOutline(bridge);\n }\n for (const scenario of bridge.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (scenario.report.error !== undefined) {\n accumulator.push(scenario);\n }\n }\n if (bridge instanceof FeatureBridge) {\n accumulator.push(...failedRule(bridge));\n }\n return accumulator;\n}\n\nfunction failedOutline(bridge: ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n\n for (const example of bridge.examples) {\n for (const scenario of example.scenarios) {\n if (scenario.report.error) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction failedRule(bridge: FeatureBridge) {\n const accumulator: ScenarioBridge[] = [];\n for (const rule of bridge.rules) {\n for (const scenario of rule.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (scenario.report.error) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction gherkinToTestNames(\n node: GherkinNode,\n path = \"\",\n accumulator: string[] = []\n) {\n if (!(\"name\" in node) || node instanceof Background) {\n return;\n }\n const title = `${node.keyword}: ${node.name}`;\n const fullPath = path ? `${path} ${title}` : title;\n accumulator.push(fullPath);\n if (!node.children) {\n return;\n }\n for (const child of node.children) {\n if (!(\"name\" in child) || child instanceof Background) {\n continue;\n }\n gherkinToTestNames(child, fullPath, accumulator);\n }\n return accumulator;\n}\n\nexport const Query = {\n find: {\n failed,\n },\n testNames: gherkinToTestNames,\n};\n","import {\n Background,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step,\n} from \"@autometa/gherkin\";\nimport { AutomationError } from \"@autometa/errors\";\nimport { Example } from \"@autometa/gherkin\";\n\nexport type WalkFunction<T extends GherkinNode, TAccumulator, TReturn> = (\n node: T,\n accumulator: TAccumulator,\n lastNode?: GherkinNode\n) => TReturn;\n\nexport type WalkFunctionMap<TAccumulator> = {\n onFeature?: WalkFunction<Feature, TAccumulator, TAccumulator>;\n onRule?: WalkFunction<Rule, TAccumulator, TAccumulator>;\n onBackground?: WalkFunction<Background, TAccumulator, TAccumulator>;\n onScenario?: WalkFunction<Scenario, TAccumulator, TAccumulator>;\n onScenarioOutline?: WalkFunction<ScenarioOutline, TAccumulator, TAccumulator>;\n onExamples?: WalkFunction<Examples, TAccumulator, TAccumulator>;\n onExample?: WalkFunction<Example, TAccumulator, TAccumulator>;\n onStep?: WalkFunction<Step, TAccumulator, TAccumulator>;\n};\n\nexport class GherkinWalker {\n static walk<TAccumulator>(\n walkFunction: WalkFunctionMap<TAccumulator>,\n childNode: GherkinNode,\n accumulator: TAccumulator,\n parentNode?: GherkinNode\n ) {\n if (accumulator === undefined) {\n throw new AutomationError(\n `An accumulator must be defined to continue the walker from ${\n childNode.constructor.name\n }${JSON.stringify(childNode)}`\n );\n }\n this.#walkNode(childNode, accumulator, walkFunction, parentNode);\n return accumulator;\n }\n\n static #walkNode<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n walkFunction: WalkFunctionMap<TAccumulator>,\n lastNode?: GherkinNode\n ) {\n if (child instanceof Feature && walkFunction.onFeature) {\n const acc = walkFunction.onFeature(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Rule && walkFunction.onRule) {\n const acc = walkFunction.onRule(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Examples) {\n const acc = walkFunction.onExamples?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Example) {\n const acc = walkFunction.onExample?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Scenario) {\n const acc = walkFunction.onScenario?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof ScenarioOutline) {\n const acc = walkFunction.onScenarioOutline?.(\n child,\n accumulator,\n lastNode\n );\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Background) {\n const acc = walkFunction?.onBackground?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Step) {\n const acc = walkFunction.onStep?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n }\n\n static #walkChildren<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walkFunction: WalkFunctionMap<any>\n ) {\n for (const node of child.children) {\n this.walk(walkFunction, node, accumulator, child);\n }\n }\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport { StepKeyword } from \"@autometa/gherkin\";\nimport { StepType } from \"@autometa/gherkin\";\nimport {\n Scope,\n RuleScope,\n ScenarioScope,\n ScenarioOutlineScope,\n BackgroundScope,\n} from \"@autometa/scopes\";\nimport { Empty_Function } from \"@autometa/scopes\";\n\nexport function scope(value: Scope) {\n return {\n findRule: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return child instanceof RuleScope && child.name === name;\n }) as RuleScope | undefined;\n if (!found) {\n const rule = new RuleScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(rule);\n return rule;\n }\n return found;\n },\n findScenario: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return (\n child instanceof ScenarioScope &&\n child.name === name &&\n !(child instanceof ScenarioOutlineScope)\n );\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findBackground: ({ name }: { name?: string }): BackgroundScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof BackgroundScope;\n }) as BackgroundScope | undefined;\n if (found && found.name !== name) {\n throw new AutomationError(\n `Could not find background matching ${name} but found ${found?.name}`\n );\n }\n if (found) {\n return found;\n }\n\n const bgScope = new BackgroundScope(\n name,\n Empty_Function,\n value.hooks,\n value.steps\n );\n value.attach(bgScope);\n return bgScope;\n },\n findScenarioOutline: (name: string): ScenarioOutlineScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof ScenarioOutlineScope && child.name === name;\n }) as ScenarioOutlineScope | undefined;\n if (!found) {\n const scenarioOutline = new ScenarioOutlineScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenarioOutline);\n return scenarioOutline;\n }\n return found;\n },\n findExample(name: string): ScenarioScope {\n const found = value.closedScopes.find((child) => {\n if (!(child instanceof ScenarioScope)) {\n return false;\n }\n return child.name === name;\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findStep: (keywordType: StepType, keyword: StepKeyword, name: string) => {\n return value.steps.find(keywordType, keyword, name);\n },\n };\n}\n","import {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n StepCache,\n} from \"@autometa/scopes\";\nimport {\n BackgroundBridge,\n ExampleBridge,\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n StepBridge,\n} from \"./bridges\";\nimport { GherkinWalker } from \"./gherkin-walker\";\nimport { scope } from \"./scope-search\";\nimport { Bind } from \"@autometa/bind-decorator\";\nimport { Example, Feature, GherkinNode, Scenario } from \"@autometa/gherkin\";\nimport { raise } from \"@autometa/errors\";\nimport { StepKeyword, StepType } from \"@autometa/types\";\nexport class TestBuilder {\n constructor(readonly feature: Feature) {}\n @Bind\n onFeatureExecuted(featureScope: FeatureScope) {\n const bridge = new FeatureBridge();\n GherkinWalker.walk<GherkinCodeBridge>(\n {\n onFeature: (feature, accumulator) => {\n accumulator.data = { gherkin: feature, scope: featureScope };\n return accumulator;\n },\n onRule: (rule, accumulator) => {\n const ruleScope = scope(featureScope).findRule(\n rule.name\n ) as RuleScope;\n const bridge = new RuleBridge();\n bridge.data = { gherkin: rule, scope: ruleScope };\n (accumulator as FeatureBridge).rules.push(bridge);\n return bridge;\n },\n onScenario: (gherkin, accumulator) => {\n const scenarioScope = scope(accumulator.data.scope).findScenario(\n gherkin.name\n );\n const bridge = new ScenarioBridge();\n bridge.data = { gherkin, scope: scenarioScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n // if accumulator is a outline, push to examples\n\n return bridge;\n },\n onScenarioOutline: (gherkin, accumulator) => {\n const outlineScope = scope(\n accumulator.data.scope\n ).findScenarioOutline(gherkin.name);\n const bridge = new ScenarioOutlineBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n return bridge;\n },\n onExamples: (gherkin, accumulator) => {\n const outlineScope = accumulator.data.scope as ScenarioOutlineScope;\n const bridge = new ExamplesBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as ScenarioOutlineBridge).examples.push(bridge);\n return bridge;\n },\n onExample(gherkin, accumulator) {\n if (gherkin.table === undefined) {\n raise(\n `Example ${gherkin.name} has no Example Table data. A Row of data is required.`\n );\n }\n const title = gherkin.name;\n\n const exampleScope = scope(accumulator.data.scope).findExample(title);\n const bridge = new ExampleBridge();\n bridge.data = { gherkin, scope: exampleScope };\n const acc = accumulator as ExamplesBridge;\n acc.scenarios.push(bridge);\n return bridge;\n },\n onBackground(gherkin, accumulator) {\n const backgroundScope = scope(accumulator.data.scope).findBackground({\n name: gherkin.name,\n });\n const bridge = new BackgroundBridge();\n bridge.data = { gherkin, scope: backgroundScope };\n const acc = accumulator as FeatureBridge | RuleBridge;\n acc.background = bridge;\n return bridge;\n },\n onStep: (step, accumulator) => {\n const {\n data: { scope: parentScope, gherkin },\n } = accumulator;\n const { keyword, keywordType, text } = step;\n const cache = parentScope.steps;\n const existing = getStep(\n accumulator,\n gherkin,\n cache,\n keywordType,\n keyword,\n text\n );\n const bridge = new StepBridge();\n const acc = accumulator as\n | BackgroundBridge\n | ScenarioBridge\n | RuleBridge\n | FeatureBridge;\n\n if (existing) {\n bridge.data = {\n gherkin: step,\n scope: existing.step,\n args: existing.args,\n };\n } else {\n raise(`No step definition matching ${step.keyword} ${step.text}`);\n }\n\n acc.steps.push(bridge);\n return accumulator;\n },\n },\n this.feature,\n bridge\n );\n return bridge;\n }\n}\nfunction getStep(\n accumulator: GherkinCodeBridge,\n gherkin: GherkinNode,\n cache: StepCache,\n keywordType: StepType,\n keyword: StepKeyword,\n text: string\n) {\n try {\n if (accumulator instanceof ExampleBridge) {\n const scenario = gherkin as Example;\n if (scenario.table) {\n return cache.findByExample(keywordType, keyword, text, scenario.table);\n }\n }\n return cache.find(keywordType, keyword, text);\n } catch (e) {\n const cause = e as Error;\n const { title } = gherkin as Scenario;\n raise(`'${title}' could not find a step definition`, { cause });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,qBAWO;AAWA,IAAe,oBAAf,MAAiC;AAExC;AACO,IAAM,eAAN,cAA2B,kBAAkB;AAAA,EAElD,YAAYA,QAAoB;AAC9B,UAAM;AACN,UAAM,WAAW,cAAc,2BAAY;AAAA,MAA1B;AAAA;AACf,uBAAU;A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AI,UAAU;AACZ,YAAAA,QAAO,OAAO;AAAA,cACZ,SAAS;AAAA,cACT,OAAO,SAAS;AAAA,cAChB,MAAM,SAAS;AAAA,YACjB;AAAA,UACF,OAAO;AACL,sCAAM,+BAA+B,KAAK,OAAO,IAAI,KAAK,IAAI,EAAE;AAAA,UAClE;AAEA,cAAI,MAAM,KAAKA,OAAM;AACrB,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA,KAAK;AAAA,MACL;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;AA7GE;AAAA,EADC;AAAA,GAFU,YAGX;AA8GF,SAAS,QACP,aACA,SACA,OACA,aACA,SACA,MACA;AACA,MAAI;AACF,QAAI,uBAAuB,eAAe;AACxC,YAAM,WAAW;AACjB,UAAI,SAAS,OAAO;AAClB,eAAO,MAAM,cAAc,aAAa,SAAS,MAAM,SAAS,KAAK;AAAA,MACvE;AAAA,IACF;AACA,WAAO,MAAM,KAAK,aAAa,SAAS,IAAI;AAAA,EAC9C,SAAS,GAAG;AACV,UAAM,QAAQ;AACd,UAAM,EAAE,MAAM,IAAI;AAClB,8BAAM,IAAI,KAAK,sCAAsC,EAAE,MAAM,CAAC;AAAA,EAChE;AACF;","names":["scope","scope","import_gherkin","import_gherkin","import_errors","import_errors","import_scopes","import_errors","bridge"]}
1
+ {"version":3,"sources":["../src/internal/test-plan-builder.ts","../src/internal/utils.ts","../src/internal/nodes.ts","../src/internal/summaries.ts","../src/internal/scope-resolution.ts","../src/build-test-plan.ts"],"names":[],"mappings":";AAAA,SAAS,oBAAoB,mBAAmB,6BAA6B;AAC7E,SAAS,mCAAmC;;;ACD5C,OAAO,UAAU;AAYV,SAAS,cAAc,OAAuB;AACnD,SAAO,MAAM,KAAK;AACpB;AAEO,SAAS,iBAAiB,SAAyB;AACxD,SAAO,QAAQ,KAAK;AACtB;AAEO,SAAS,aAAa,KAAqB;AAChD,QAAM,UAAU,IAAI,QAAQ,UAAU,EAAE;AACxC,QAAM,aAAa,KAAK,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AAI,IAAY,CAAC,OAAO,OAAO,GAAG,CAAC;;;AKp8BtD,SAAS,cAAqB,SAAuD;AAC1F,QAAM,EAAE,SAAS,QAAQ,IAAI;AAC7B,gBAAc,OAAO;AACrB,gBAAc,OAAO;AAErB,QAAM,eACJ,QAAQ,gBAAgB,oBAAoB,SAAS,OAAO;AAE9D,SAAO,IAAI,gBAAgB,SAAS,cAAc,OAAO,EAAE,MAAM;AACnE;AAEA,SAAS,cAAc,SAAsE;AAC3F,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACF;AAEA,SAAS,cACP,SACiD;AACjD,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACF","sourcesContent":["import { CucumberExpression, RegularExpression, ParameterTypeRegistry } from \"@cucumber/cucumber-expressions\";\nimport { createDefaultParameterTypes } from \"@autometa/cucumber-expressions\";\nimport type {\n ScopeExecutionAdapter,\n ScopeNode,\n ScenarioSummary,\n StepDefinition,\n StepExpression,\n StepKeyword,\n NormalizedStepOptions,\n ExecutionMode,\n ParameterRegistryLike,\n} from \"@autometa/scopes\";\nimport type {\n SimpleFeature,\n SimpleRule,\n SimpleScenario,\n SimpleScenarioOutline,\n SimpleStep,\n} from \"@autometa/gherkin\";\nimport type {\n FeatureNode,\n QualifiedPathSegment,\n RuleNode,\n ScenarioExecution,\n ScenarioNode,\n ScenarioOutlineExample,\n ScenarioOutlineNode,\n TestPlan,\n} from \"../types\";\nimport {\n createFeatureNode,\n createRuleNode,\n createScenarioNode,\n createScenarioOutlineExample,\n createScenarioOutlineNode,\n} from \"./nodes\";\nimport {\n ScenarioKindKey,\n ScenarioSummaryBuckets,\n bucketScenarioSummaries,\n createSummaryKey,\n describeSummary,\n} from \"./summaries\";\nimport {\n buildExampleSuffix,\n buildQualifiedName,\n buildScopeSuffix,\n cloneData,\n collectTags,\n combineSteps,\n createExampleData,\n groupCompiledScenarios,\n mergeData,\n normalizeKeyword,\n isRule,\n isScenario,\n isScenarioOutline,\n} from \"./utils\";\nimport { findChildScope } from \"./scope-resolution\";\n\nconst FEATURE_SEGMENT_KEY = \"feature\";\nconst RULE_SEGMENT_KEY = \"rule\";\nconst EXAMPLE_SEGMENT_KEY = \"Example\";\n\nexport class TestPlanBuilder<World> {\n private static readonly SUGGESTION_LIMIT_PER_GROUP = 3;\n /**\n * Similarity threshold in [0, 1].\n * 1.0 = identical, 0.0 = completely different.\n */\n private static readonly SUGGESTION_MIN_SIMILARITY_SAME_TYPE = 0.6;\n private static readonly SUGGESTION_MIN_SIMILARITY_DIFFERENT_TYPE = 0.85;\n private readonly executions: ScenarioExecution<World>[] = [];\n private readonly byId = new Map<string, ScenarioExecution<World>>();\n private readonly byQualifiedName = new Map<string, ScenarioExecution<World>>();\n private readonly featureScenarios: ScenarioNode<World>[] = [];\n private readonly featureScenarioOutlines: ScenarioOutlineNode<World>[] = [];\n private readonly featureRules: RuleNode<World>[] = [];\n private readonly ruleScenarioMap = new Map<RuleNode<World>, ScenarioNode<World>[]>();\n private readonly ruleOutlineMap = new Map<RuleNode<World>, ScenarioOutlineNode<World>[]>();\n private readonly outlineExamplesMap = new Map<ScenarioOutlineNode<World>, ScenarioOutlineExample<World>[]>();\n private readonly summaryBuckets: ScenarioSummaryBuckets<World>;\n private readonly featureSegment: QualifiedPathSegment;\n private readonly parameterRegistry: ParameterTypeRegistry;\n private featureNode!: FeatureNode<World>;\n\n constructor(\n private readonly feature: SimpleFeature,\n private readonly featureScope: ScopeNode<World>,\n private readonly adapter: ScopeExecutionAdapter<World>\n ) {\n const summaries = adapter\n .listScenarios()\n .filter((summary) => summary.feature.id === featureScope.id);\n this.summaryBuckets = bucketScenarioSummaries(summaries);\n this.featureSegment = {\n keyword: normalizeKeyword(feature.keyword ?? FEATURE_SEGMENT_KEY),\n name: feature.name,\n suffix: buildScopeSuffix(featureScope.id),\n };\n this.parameterRegistry = resolveParameterRegistry(adapter.getParameterRegistry?.());\n createDefaultParameterTypes<unknown>()(this.parameterRegistry);\n }\n\n build(): TestPlan<World> {\n this.featureNode = createFeatureNode({\n feature: this.feature,\n scope: this.featureScope,\n executions: this.executions,\n scenarios: this.featureScenarios,\n outlines: this.featureScenarioOutlines,\n rules: this.featureRules,\n });\n\n for (const element of this.feature.elements ?? []) {\n if (isRule(element)) {\n this.processRule(element);\n } else if (isScenarioOutline(element)) {\n this.processScenarioOutline(element, undefined);\n } else if (isScenario(element)) {\n this.processScenario(element, undefined);\n }\n }\n\n this.ensureAllSummariesConsumed();\n\n return new TestPlanImpl(\n this.featureNode,\n this.executions,\n this.byId,\n this.byQualifiedName\n );\n }\n\n private processRule(rule: SimpleRule): void {\n const ruleScope = findChildScope(this.featureScope, \"rule\", rule.name);\n const qualifiedName = buildQualifiedName([\n this.featureSegment,\n {\n keyword: normalizeKeyword(rule.keyword ?? RULE_SEGMENT_KEY),\n name: rule.name,\n suffix: buildScopeSuffix(ruleScope.id),\n },\n ]);\n\n const ruleScenarios: ScenarioNode<World>[] = [];\n const ruleOutlines: ScenarioOutlineNode<World>[] = [];\n\n const ruleNode = createRuleNode<World>({\n rule,\n scope: ruleScope,\n qualifiedName,\n scenarios: ruleScenarios,\n outlines: ruleOutlines,\n });\n\n this.ruleScenarioMap.set(ruleNode, ruleScenarios);\n this.ruleOutlineMap.set(ruleNode, ruleOutlines);\n this.featureRules.push(ruleNode);\n\n for (const element of rule.elements ?? []) {\n if (isScenarioOutline(element)) {\n this.processScenarioOutline(element, ruleNode);\n } else if (isScenario(element)) {\n this.processScenario(element, ruleNode);\n }\n }\n }\n\n private processScenario(\n gherkinScenario: SimpleScenario,\n ruleNode: RuleNode<World> | undefined\n ): void {\n const ruleScope = ruleNode?.scope;\n const summary = this.consumeSummary(\n \"scenario\",\n gherkinScenario.name,\n ruleScope\n );\n\n if (summary.scenario.kind !== \"scenario\") {\n throw new Error(\n `Scope mismatch: expected scenario kind 'scenario' but received '${summary.scenario.kind}' for '${gherkinScenario.name}'`\n );\n }\n\n const qualifiedName = buildQualifiedName([\n this.featureSegment,\n ...(ruleNode\n ? [\n {\n keyword: normalizeKeyword(ruleNode.keyword),\n name: ruleNode.name,\n suffix: buildScopeSuffix(ruleNode.scope.id),\n } as const,\n ]\n : []),\n {\n keyword: normalizeKeyword(gherkinScenario.keyword ?? \"Scenario\"),\n name: gherkinScenario.name,\n suffix: buildScopeSuffix(summary.scenario.id),\n },\n ]);\n\n const gherkinSteps = combineSteps(\n this.feature.background?.steps,\n ruleNode?.background?.steps,\n gherkinScenario.steps\n );\n\n const resolvedSteps = this.resolveStepDefinitions(summary, gherkinSteps, {\n scenario: gherkinScenario.name,\n ...(ruleNode ? { rule: ruleNode.name } : {}),\n });\n\n const scenarioData = cloneData(summary.scenario.data);\n const scenarioNode = createScenarioNode<World>({\n id: summary.id,\n feature: this.featureNode,\n name: gherkinScenario.name,\n keyword: gherkinScenario.keyword ?? \"Scenario\",\n qualifiedName,\n tags: collectTags(\n this.feature.tags,\n ruleNode?.rule.tags,\n gherkinScenario.tags,\n summary.feature.tags,\n summary.scenario.tags\n ),\n mode: summary.scenario.mode,\n pending: summary.scenario.pending,\n ...(summary.scenario.pendingReason\n ? { pendingReason: summary.scenario.pendingReason }\n : {}),\n scope: summary.scenario,\n summary,\n gherkin: gherkinScenario,\n gherkinSteps,\n steps: resolvedSteps,\n ancestors: summary.ancestors,\n ...(ruleNode ? { rule: ruleNode } : {}),\n ...(summary.scenario.timeout !== undefined ? { timeout: summary.scenario.timeout } : {}),\n ...(scenarioData ? { data: scenarioData } : {}),\n });\n\n if (ruleNode) {\n this.getRuleScenarios(ruleNode).push(scenarioNode);\n } else {\n this.featureScenarios.push(scenarioNode);\n }\n\n this.registerExecution(scenarioNode);\n }\n\n private processScenarioOutline(\n outline: SimpleScenarioOutline,\n ruleNode: RuleNode<World> | undefined\n ): void {\n const ruleScope = ruleNode?.scope;\n const summary = this.consumeSummary(\n \"scenarioOutline\",\n outline.name,\n ruleScope\n );\n\n if (summary.scenario.kind !== \"scenarioOutline\") {\n throw new Error(\n `Scope mismatch: expected scenario kind 'scenarioOutline' but received '${summary.scenario.kind}' for '${outline.name}'`\n );\n }\n\n const outlineQualifiedName = buildQualifiedName([\n this.featureSegment,\n ...(ruleNode\n ? [\n {\n keyword: normalizeKeyword(ruleNode.keyword),\n name: ruleNode.name,\n suffix: buildScopeSuffix(ruleNode.scope.id),\n } as const,\n ]\n : []),\n {\n keyword: normalizeKeyword(outline.keyword ?? \"Scenario Outline\"),\n name: outline.name,\n suffix: buildScopeSuffix(summary.scenario.id),\n },\n ]);\n\n const outlineData = cloneData(summary.scenario.data);\n const outlineExamples: ScenarioOutlineExample<World>[] = [];\n\n const outlineNode = createScenarioOutlineNode<World>({\n outline,\n summary,\n scope: summary.scenario,\n keyword: outline.keyword ?? \"Scenario Outline\",\n name: outline.name,\n qualifiedName: outlineQualifiedName,\n tags: collectTags(\n this.feature.tags,\n ruleNode?.rule.tags,\n outline.tags,\n summary.feature.tags,\n summary.scenario.tags\n ),\n mode: summary.scenario.mode,\n pending: summary.scenario.pending,\n ...(summary.scenario.pendingReason\n ? { pendingReason: summary.scenario.pendingReason }\n : {}),\n ancestors: summary.ancestors,\n feature: this.featureNode,\n ...(summary.scenario.timeout !== undefined ? { timeout: summary.scenario.timeout } : {}),\n ...(outlineData ? { data: outlineData } : {}),\n ...(ruleNode ? { rule: ruleNode } : {}),\n examples: outlineExamples,\n });\n\n this.outlineExamplesMap.set(outlineNode, outlineExamples);\n\n if (ruleNode) {\n this.getRuleOutlines(ruleNode).push(outlineNode);\n } else {\n this.featureScenarioOutlines.push(outlineNode);\n }\n\n const compiledByGroup = groupCompiledScenarios(outline.compiledScenarios);\n\n for (const group of outline.exampleGroups ?? []) {\n const compiledForGroup = compiledByGroup.get(group.id) ?? [];\n compiledForGroup.sort((a, b) => a.exampleIndex - b.exampleIndex);\n\n for (const compiled of compiledForGroup) {\n const qualifiedName = buildQualifiedName([\n this.featureSegment,\n ...(ruleNode\n ? [\n {\n keyword: normalizeKeyword(ruleNode.keyword),\n name: ruleNode.name,\n suffix: buildScopeSuffix(ruleNode.scope.id),\n } as const,\n ]\n : []),\n {\n keyword: normalizeKeyword(outline.keyword ?? \"Scenario Outline\"),\n name: outline.name,\n suffix: buildScopeSuffix(summary.scenario.id),\n },\n {\n keyword: EXAMPLE_SEGMENT_KEY,\n name: compiled.name,\n suffix: buildExampleSuffix(compiled.id, compiled.exampleIndex),\n },\n ]);\n\n const gherkinSteps = combineSteps(\n this.feature.background?.steps,\n ruleNode?.background?.steps,\n compiled.steps\n );\n\n const resolvedSteps = this.resolveStepDefinitions(summary, gherkinSteps, {\n scenario: compiled.name,\n outline: outline.name,\n ...(ruleNode ? { rule: ruleNode.name } : {}),\n });\n\n const exampleData = mergeData(\n cloneData(summary.scenario.data),\n createExampleData(group, compiled)\n );\n\n const exampleExecution = createScenarioOutlineExample<World>({\n id: compiled.id,\n feature: this.featureNode,\n outline: outlineNode,\n name: compiled.name,\n keyword: compiled.keyword ?? outline.keyword ?? \"Scenario Outline\",\n qualifiedName,\n tags: collectTags(\n this.feature.tags,\n ruleNode?.rule.tags,\n outline.tags,\n group.tags,\n compiled.tags,\n summary.feature.tags,\n summary.scenario.tags\n ),\n mode: summary.scenario.mode,\n pending: summary.scenario.pending,\n ...(summary.scenario.pendingReason\n ? { pendingReason: summary.scenario.pendingReason }\n : {}),\n scope: summary.scenario,\n summary,\n gherkin: compiled,\n gherkinSteps,\n steps: resolvedSteps,\n ancestors: summary.ancestors,\n exampleGroup: group,\n exampleIndex: compiled.exampleIndex,\n ...(ruleNode ? { rule: ruleNode } : {}),\n ...(summary.scenario.timeout !== undefined ? { timeout: summary.scenario.timeout } : {}),\n ...(exampleData ? { data: exampleData } : {}),\n });\n\n this.getOutlineExamples(outlineNode).push(exampleExecution);\n this.registerExecution(exampleExecution);\n }\n }\n }\n\n private consumeSummary(\n kind: ScenarioKindKey,\n scenarioName: string,\n parentScope: ScopeNode<World> | undefined\n ): ScenarioSummary<World> {\n const key = createSummaryKey(kind, scenarioName, parentScope?.id);\n const bucket = this.summaryBuckets.get(key);\n\n if (!bucket || bucket.length === 0) {\n throw new Error(\n `Could not find a registered ${kind} scope for '${scenarioName}'${parentScope ? ` within '${parentScope.name}'` : \"\"}`\n );\n }\n\n const summary = bucket.shift() as ScenarioSummary<World>;\n if (bucket.length === 0) {\n this.summaryBuckets.delete(key);\n }\n return summary;\n }\n\n private registerExecution(execution: ScenarioExecution<World>): void {\n if (this.byId.has(execution.id)) {\n throw new Error(\n `Duplicate scenario identifier detected: '${execution.id}' for '${execution.qualifiedName}'`\n );\n }\n if (this.byQualifiedName.has(execution.qualifiedName)) {\n throw new Error(\n `Duplicate qualified scenario name detected: '${execution.qualifiedName}'`\n );\n }\n this.executions.push(execution);\n this.byId.set(execution.id, execution);\n this.byQualifiedName.set(execution.qualifiedName, execution);\n }\n\n private ensureAllSummariesConsumed(): void {\n const leftovers: string[] = [];\n for (const bucket of this.summaryBuckets.values()) {\n for (const summary of bucket) {\n leftovers.push(describeSummary(summary));\n }\n }\n\n if (leftovers.length > 0) {\n throw new Error(\n `The following scope scenarios were not matched to Gherkin nodes for feature '${this.feature.name}': ${leftovers.join(\", \")}`\n );\n }\n }\n\n private getRuleScenarios(rule: RuleNode<World>): ScenarioNode<World>[] {\n const list = this.ruleScenarioMap.get(rule);\n if (!list) {\n throw new Error(`Rule '${rule.name}' has no associated scenario registry`);\n }\n return list;\n }\n\n private getRuleOutlines(rule: RuleNode<World>): ScenarioOutlineNode<World>[] {\n const list = this.ruleOutlineMap.get(rule);\n if (!list) {\n throw new Error(`Rule '${rule.name}' has no associated scenario outline registry`);\n }\n return list;\n }\n\n private getOutlineExamples(\n outline: ScenarioOutlineNode<World>\n ): ScenarioOutlineExample<World>[] {\n const list = this.outlineExamplesMap.get(outline);\n if (!list) {\n throw new Error(\n `Scenario outline '${outline.name}' has no associated example registry`\n );\n }\n return list;\n }\n\n private resolveStepDefinitions(\n summary: ScenarioSummary<World>,\n gherkinSteps: readonly SimpleStep[],\n context: StepResolutionContext\n ): StepDefinition<World>[] {\n if (summary.steps.length === 0) {\n if (gherkinSteps.length === 0) {\n return [];\n }\n\n return gherkinSteps.map((step, index) =>\n this.createMissingStepDefinition(summary, context, step, index)\n );\n }\n\n const remaining = new Set(summary.steps);\n const ordered: StepDefinition<World>[] = [];\n const matchers = new Map<StepDefinition<World>, StepMatcher>();\n let encounteredMissing = false;\n\n for (const step of gherkinSteps) {\n const matched = this.findMatchingStepDefinition(\n step,\n summary.steps,\n remaining,\n matchers\n );\n\n if (!matched) {\n ordered.push(\n this.createMissingStepDefinition(\n summary,\n context,\n step,\n ordered.length\n )\n );\n encounteredMissing = true;\n continue;\n }\n\n ordered.push(matched);\n remaining.delete(matched);\n }\n\n // Note: It's normal for some step definitions to remain unused in a scenario.\n // Each scenario only uses the steps it needs, so we don't throw an error for unused steps.\n\n if (encounteredMissing) {\n return ordered;\n }\n\n return ordered;\n }\n\n private findMatchingStepDefinition(\n step: SimpleStep,\n definitions: readonly StepDefinition<World>[],\n remaining: Set<StepDefinition<World>>,\n matchers: Map<StepDefinition<World>, StepMatcher>\n ): StepDefinition<World> | undefined {\n const rawKeyword = normalizeKeyword(step.keyword ?? \"\");\n const wildcard = isFlexibleKeyword(rawKeyword);\n const keyword = wildcard ? undefined : normalizeGherkinStepKeyword(rawKeyword);\n\n const candidates = definitions.filter((definition) => {\n if (!remaining.has(definition)) {\n return false;\n }\n if (wildcard) {\n return true;\n }\n return keyword ? definition.keyword === keyword : false;\n });\n\n for (const definition of candidates) {\n if (this.matchesStepExpression(definition, step.text, matchers)) {\n return definition;\n }\n }\n\n return undefined;\n }\n\n private matchesStepExpression(\n definition: StepDefinition<World>,\n text: string,\n matchers: Map<StepDefinition<World>, StepMatcher>\n ): boolean {\n let matcher = matchers.get(definition);\n if (!matcher) {\n matcher = this.createMatcher(definition.expression);\n matchers.set(definition, matcher);\n }\n return matcher(text);\n }\n\n private createMatcher(expression: StepExpression): StepMatcher {\n if (expression instanceof RegExp) {\n const regex = new RegExp(expression.source, expression.flags);\n const evaluator = new RegularExpression(regex, this.parameterRegistry);\n return (text: string) => evaluator.match(text) !== null;\n }\n\n try {\n const cucumberExpression = new CucumberExpression(\n expression,\n this.parameterRegistry\n );\n return (text: string) => cucumberExpression.match(text) !== null;\n } catch {\n const literal = expression;\n return (text: string) => text === literal;\n }\n }\n\n private buildMissingStepDefinitionMessage(\n context: StepResolutionContext,\n step: SimpleStep,\n definitions: readonly StepDefinition<World>[]\n ): string {\n const keyword = (step.keyword ?? \"\").trim();\n const display = keyword.length > 0 ? `${keyword} ${step.text}` : step.text;\n const lines: string[] = [\n \"No step definition matched:\",\n \"\",\n `'${display}'`,\n \"\",\n this.buildMissingStepContextLine(context),\n ];\n\n const suggestions = this.resolveClosestStepDefinitionSuggestions(step, definitions);\n if (suggestions.sameType.length === 0 && suggestions.differentType.length === 0) {\n return lines.join(\"\\n\");\n }\n\n lines.push(\"\", \"Some close matches were found:\");\n\n if (suggestions.sameType.length > 0) {\n lines.push(\" Close matches with the same step type:\");\n for (const suggestion of suggestions.sameType) {\n lines.push(` - ${suggestion}`);\n }\n }\n\n if (suggestions.differentType.length > 0) {\n lines.push(\" Close matches with different step type:\");\n for (const suggestion of suggestions.differentType) {\n lines.push(` - ${suggestion}`);\n }\n }\n\n return lines.join(\"\\n\");\n }\n\n private buildMissingStepContextLine(context: StepResolutionContext): string {\n const parts = [`in scenario '${context.scenario}'`];\n if (context.outline) {\n parts.push(`of outline '${context.outline}'`);\n }\n if (context.rule) {\n parts.push(`within rule '${context.rule}'`);\n }\n parts.push(`for feature '${this.feature.name}'.`);\n return parts.join(\" \");\n }\n\n private buildUnusedStepDefinitionsMessage(\n context: StepResolutionContext,\n extras: readonly string[]\n ): string {\n const segments = [\n `The following step definitions were not matched to Gherkin steps in scenario '${context.scenario}'`,\n ];\n if (context.outline) {\n segments.push(`of outline '${context.outline}'`);\n }\n if (context.rule) {\n segments.push(`within rule '${context.rule}'`);\n }\n segments.push(`for feature '${this.feature.name}': ${extras.join(\", \")}`);\n return segments.join(\" \");\n }\n\n private describeStepDefinition(definition: StepDefinition<World>): string {\n return `${definition.keyword} ${formatExpression(definition.expression)}`;\n }\n\n private createMissingStepDefinition(\n summary: ScenarioSummary<World>,\n context: StepResolutionContext,\n step: SimpleStep,\n index: number\n ): StepDefinition<World> {\n const message = this.buildMissingStepDefinitionMessage(\n context,\n step,\n summary.steps\n );\n\n return {\n id: `${summary.id}:missing-step:${index}`,\n keyword: this.resolveStepKeyword(step),\n expression: step.text,\n handler: () => {\n throw new Error(message);\n },\n options: this.createFallbackStepOptions(summary.scenario.mode),\n } satisfies StepDefinition<World>;\n }\n\n private resolveStepKeyword(step: SimpleStep): StepKeyword {\n const raw = normalizeKeyword(step.keyword ?? \"\");\n if (isFlexibleKeyword(raw)) {\n return \"And\";\n }\n\n try {\n return normalizeGherkinStepKeyword(raw);\n } catch {\n return \"Given\";\n }\n }\n\n private createFallbackStepOptions(mode: ExecutionMode): NormalizedStepOptions {\n return {\n tags: [],\n mode,\n } satisfies NormalizedStepOptions;\n }\n\n private resolveClosestStepDefinitionSuggestions(\n step: SimpleStep,\n definitions: readonly StepDefinition<World>[]\n ): { sameType: string[]; differentType: string[] } {\n if (definitions.length === 0) {\n return { sameType: [], differentType: [] };\n }\n\n const desiredKeyword = this.tryNormalizeKeyword(step.keyword);\n const target = this.normalizeForDistance(step.text);\n\n const candidates = definitions\n .map((definition) => {\n const candidateText = this.normalizeForDistance(\n formatExpression(definition.expression)\n );\n const distance = this.computeEditDistance(target, candidateText);\n const similarity = this.computeSimilarity(target, candidateText, distance);\n return {\n definition,\n description: this.describeStepDefinition(definition),\n distance,\n similarity,\n };\n });\n\n candidates.sort((a, b) => a.distance - b.distance);\n\n const sameType: string[] = [];\n const differentType: string[] = [];\n\n for (const candidate of candidates) {\n const isSameType =\n !desiredKeyword || candidate.definition.keyword === desiredKeyword;\n\n if (isSameType) {\n if (\n candidate.similarity <\n TestPlanBuilder.SUGGESTION_MIN_SIMILARITY_SAME_TYPE\n ) {\n continue;\n }\n if (sameType.length < TestPlanBuilder.SUGGESTION_LIMIT_PER_GROUP) {\n sameType.push(candidate.description);\n }\n continue;\n }\n\n if (\n candidate.similarity <\n TestPlanBuilder.SUGGESTION_MIN_SIMILARITY_DIFFERENT_TYPE\n ) {\n continue;\n }\n if (differentType.length < TestPlanBuilder.SUGGESTION_LIMIT_PER_GROUP) {\n differentType.push(candidate.description);\n }\n\n if (\n sameType.length >= TestPlanBuilder.SUGGESTION_LIMIT_PER_GROUP &&\n differentType.length >= TestPlanBuilder.SUGGESTION_LIMIT_PER_GROUP\n ) {\n break;\n }\n }\n\n return { sameType, differentType };\n }\n\n private normalizeForDistance(value: string): string {\n return value\n .toLowerCase()\n .replace(/\\s+/g, \" \")\n .trim();\n }\n\n private computeSimilarity(a: string, b: string, distance: number): number {\n const maxLen = Math.max(a.length, b.length);\n if (maxLen === 0) {\n return 1;\n }\n const normalized = 1 - distance / maxLen;\n return Math.max(0, Math.min(1, normalized));\n }\n\n private computeEditDistance(a: string, b: string): number {\n if (a === b) {\n return 0;\n }\n\n const rows = a.length + 1;\n const cols = b.length + 1;\n const matrix: number[][] = Array.from({ length: rows }, () => Array<number>(cols).fill(0));\n\n for (let i = 0; i < rows; i++) {\n const row = matrix[i];\n if (!row) {\n throw new Error(\"Internal error: matrix row missing\");\n }\n row[0] = i;\n }\n\n const row0 = matrix[0];\n if (!row0) {\n throw new Error(\"Internal error: matrix[0] missing\");\n }\n for (let j = 0; j < cols; j++) {\n row0[j] = j;\n }\n\n for (let i = 1; i < rows; i++) {\n const row = matrix[i];\n const prevRow = matrix[i - 1];\n if (!row || !prevRow) {\n throw new Error(\"Internal error: matrix row missing\");\n }\n\n for (let j = 1; j < cols; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n const deletion = (prevRow[j] ?? 0) + 1;\n const insertion = (row[j - 1] ?? 0) + 1;\n const substitution = (prevRow[j - 1] ?? 0) + cost;\n row[j] = Math.min(deletion, insertion, substitution);\n }\n }\n\n const lastRow = matrix[rows - 1];\n if (!lastRow) {\n throw new Error(\"Internal error: last matrix row missing\");\n }\n const result = lastRow[cols - 1];\n if (result === undefined) {\n throw new Error(\"Internal error: matrix result missing\");\n }\n return result;\n }\n\n private tryNormalizeKeyword(keyword: string | undefined): StepKeyword | undefined {\n if (!keyword) {\n return undefined;\n }\n\n const raw = normalizeKeyword(keyword);\n if (isFlexibleKeyword(raw)) {\n return undefined;\n }\n\n try {\n return normalizeGherkinStepKeyword(raw);\n } catch {\n return undefined;\n }\n }\n}\n\nclass TestPlanImpl<World> implements TestPlan<World> {\n constructor(\n readonly feature: FeatureNode<World>,\n private readonly executions: readonly ScenarioExecution<World>[],\n private readonly byId: ReadonlyMap<string, ScenarioExecution<World>>,\n private readonly byQualifiedName: ReadonlyMap<string, ScenarioExecution<World>>\n ) {}\n\n listExecutables(): readonly ScenarioExecution<World>[] {\n return this.executions;\n }\n\n listFailed(): readonly ScenarioExecution<World>[] {\n return this.executions.filter((execution) => execution.result.status === \"failed\");\n }\n\n findById(id: string): ScenarioExecution<World> | undefined {\n return this.byId.get(id);\n }\n\n findByQualifiedName(name: string): ScenarioExecution<World> | undefined {\n return this.byQualifiedName.get(name);\n }\n}\n\ntype StepMatcher = (text: string) => boolean;\n\ninterface StepResolutionContext {\n readonly scenario: string;\n readonly outline?: string;\n readonly rule?: string;\n}\n\nfunction resolveParameterRegistry(\n parameterRegistry: ParameterRegistryLike | undefined\n): ParameterTypeRegistry {\n if (!parameterRegistry) {\n return new ParameterTypeRegistry();\n }\n if (isParameterTypeRegistry(parameterRegistry)) {\n return parameterRegistry;\n }\n const candidate = (parameterRegistry as { registry?: ParameterTypeRegistry }).registry;\n if (isParameterTypeRegistry(candidate)) {\n return candidate;\n }\n return new ParameterTypeRegistry();\n}\n\nfunction isParameterTypeRegistry(value: unknown): value is ParameterTypeRegistry {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n if (value instanceof ParameterTypeRegistry) {\n return true;\n }\n const registry = value as ParameterTypeRegistry;\n return (\n typeof registry.lookupByTypeName === \"function\" &&\n typeof registry.defineParameterType === \"function\"\n );\n}\n\nfunction normalizeGherkinStepKeyword(keyword: string): StepKeyword {\n const trimmed = normalizeKeyword(keyword).replace(/:$/, \"\");\n const mapped = STEP_KEYWORD_MAP[trimmed.toLowerCase()];\n if (!mapped) {\n throw new Error(`Unsupported Gherkin step keyword '${keyword}'`);\n }\n return mapped;\n}\n\nfunction isFlexibleKeyword(keyword: string): boolean {\n const normalized = normalizeKeyword(keyword).replace(/:$/, \"\").toLowerCase();\n return FLEXIBLE_KEYWORDS.has(normalized);\n}\n\nfunction formatExpression(expression: StepExpression): string {\n return typeof expression === \"string\" ? expression : expression.toString();\n}\n\nconst STEP_KEYWORD_MAP: Record<string, StepKeyword> = {\n given: \"Given\",\n when: \"When\",\n then: \"Then\",\n and: \"And\",\n but: \"But\",\n};\n\nconst FLEXIBLE_KEYWORDS = new Set<string>([\"and\", \"but\", \"*\"]);\n","import path from \"node:path\";\nimport type {\n SimpleCompiledScenario,\n SimpleExampleGroup,\n SimpleFeatureElement,\n SimpleRule,\n SimpleScenario,\n SimpleScenarioOutline,\n SimpleStep,\n} from \"@autometa/gherkin\";\nimport type { QualifiedPathSegment } from \"../types\";\n\nexport function normalizeName(value: string): string {\n return value.trim();\n}\n\nexport function normalizeKeyword(keyword: string): string {\n return keyword.trim();\n}\n\nexport function normalizeUri(uri: string): string {\n const cleaned = uri.replace(/^file:/, \"\");\n const normalized = path.normalize(cleaned);\n // Ensure consistent posix-style separators regardless of host platform\n return normalized.replace(/[\\\\/]+/g, \"/\");\n}\n\nexport function buildScopeSuffix(id: string): string {\n return ` [${id}]`;\n}\n\nexport function buildExampleSuffix(exampleId: string, index: number): string {\n return ` [${exampleId}#${index + 1}]`;\n}\n\nexport function buildQualifiedName(segments: readonly QualifiedPathSegment[]): string {\n return segments\n .map((segment) => {\n const keyword = segment.keyword.trim();\n const name = segment.name?.trim();\n const suffix = segment.suffix ?? \"\";\n if (!name || name.length === 0) {\n return `${keyword}${suffix}`;\n }\n return `${keyword}: ${name}${suffix}`;\n })\n .join(\" > \");\n}\n\nexport function collectTags(\n ...sources: ReadonlyArray<readonly string[] | undefined>\n): readonly string[] {\n const result: string[] = [];\n const seen = new Set<string>();\n\n for (const source of sources) {\n if (!source) {\n continue;\n }\n for (const tag of source) {\n if (!seen.has(tag)) {\n seen.add(tag);\n result.push(tag);\n }\n }\n }\n\n return result;\n}\n\nexport function combineSteps(\n featureSteps: readonly SimpleStep[] | undefined,\n ruleSteps: readonly SimpleStep[] | undefined,\n scenarioSteps: readonly SimpleStep[] | undefined\n): readonly SimpleStep[] {\n return [\n ...(featureSteps ?? []),\n ...(ruleSteps ?? []),\n ...(scenarioSteps ?? []),\n ];\n}\n\nexport function cloneData(\n data: Record<string, unknown> | undefined\n): Record<string, unknown> | undefined {\n if (!data) {\n return undefined;\n }\n return { ...data };\n}\n\nexport function mergeData(\n base: Record<string, unknown> | undefined,\n extra: Record<string, unknown> | undefined\n): Record<string, unknown> | undefined {\n if (!base && !extra) {\n return undefined;\n }\n return {\n ...(base ?? {}),\n ...(extra ?? {}),\n };\n}\n\nexport function createExampleData(\n group: SimpleExampleGroup,\n compiled: SimpleCompiledScenario\n): Record<string, unknown> | undefined {\n const headers = group.tableHeader ?? [];\n const rows = group.tableBody ?? [];\n const row = rows[compiled.exampleIndex];\n if (!row) {\n return undefined;\n }\n const values: Record<string, string> = {};\n headers.forEach((header, index) => {\n const key = header.trim();\n if (key.length === 0) {\n return;\n }\n values[key] = row[index] ?? \"\";\n });\n return {\n example: {\n group: {\n id: group.id,\n name: group.name,\n tags: [...group.tags],\n },\n index: compiled.exampleIndex,\n values,\n },\n };\n}\n\nexport function normalizeError(error: unknown): Error {\n if (error instanceof Error) {\n return error;\n }\n if (typeof error === \"string\") {\n return new Error(error);\n }\n return new Error(JSON.stringify(error));\n}\n\nexport function groupCompiledScenarios(\n compiled: readonly SimpleCompiledScenario[]\n): Map<string, SimpleCompiledScenario[]> {\n const map = new Map<string, SimpleCompiledScenario[]>();\n for (const scenario of compiled ?? []) {\n const list = map.get(scenario.exampleGroupId) ?? [];\n list.push(scenario);\n map.set(scenario.exampleGroupId, list);\n }\n return map;\n}\n\nexport function isRule(element: SimpleFeatureElement): element is SimpleRule {\n return \"elements\" in element && Array.isArray(element.elements);\n}\n\nexport function isScenarioOutline(\n element: SimpleFeatureElement | SimpleScenario | SimpleScenarioOutline | SimpleRule\n): element is SimpleScenarioOutline {\n return \"exampleGroups\" in element;\n}\n\nexport function isScenario(\n element: SimpleFeatureElement | SimpleScenario\n): element is SimpleScenario {\n return (\n \"steps\" in element &&\n !(\"exampleGroups\" in element) &&\n !(\"elements\" in element)\n );\n}\n","import type {\n ExecutionMode,\n ScopeNode,\n ScenarioSummary,\n StepDefinition,\n TimeoutSpec,\n} from \"@autometa/scopes\";\nimport type {\n SimpleCompiledScenario,\n SimpleExampleGroup,\n SimpleFeature,\n SimpleRule,\n SimpleScenario,\n SimpleScenarioOutline,\n SimpleStep,\n} from \"@autometa/gherkin\";\nimport type {\n FeatureNode,\n RuleNode,\n ScenarioExecution,\n ScenarioNode,\n ScenarioOutlineExample,\n ScenarioOutlineNode,\n ScenarioResult,\n} from \"../types\";\nimport {\n cloneData,\n normalizeError,\n normalizeKeyword,\n} from \"./utils\";\n\nexport interface FeatureNodeInit<World> {\n readonly feature: SimpleFeature;\n readonly scope: ScopeNode<World>;\n readonly executions: ScenarioExecution<World>[];\n readonly scenarios: ScenarioNode<World>[];\n readonly outlines: ScenarioOutlineNode<World>[];\n readonly rules: RuleNode<World>[];\n}\n\nexport interface RuleNodeInit<World> {\n readonly rule: SimpleRule;\n readonly scope: ScopeNode<World>;\n readonly qualifiedName: string;\n readonly scenarios: ScenarioNode<World>[];\n readonly outlines: ScenarioOutlineNode<World>[];\n}\n\nexport interface ScenarioExecutionInit<World, Gherkin extends SimpleScenario | SimpleCompiledScenario> {\n readonly id: string;\n readonly feature: FeatureNode<World>;\n readonly rule?: RuleNode<World>;\n readonly outline?: ScenarioOutlineNode<World>;\n readonly name: string;\n readonly keyword: string;\n readonly qualifiedName: string;\n readonly tags: readonly string[];\n readonly mode: ExecutionMode;\n readonly pending: boolean;\n readonly pendingReason?: string;\n readonly timeout?: TimeoutSpec;\n readonly data?: Record<string, unknown>;\n readonly scope: ScopeNode<World>;\n readonly summary: ScenarioSummary<World>;\n readonly gherkin: Gherkin;\n readonly gherkinSteps: readonly SimpleStep[];\n readonly steps: readonly StepDefinition<World>[];\n readonly ancestors: readonly ScopeNode<World>[];\n readonly exampleGroup?: SimpleExampleGroup;\n readonly exampleIndex?: number;\n}\n\nexport interface ScenarioOutlineExampleInit<World>\n extends ScenarioExecutionInit<World, SimpleCompiledScenario> {\n readonly outline: ScenarioOutlineNode<World>;\n readonly exampleGroup: SimpleExampleGroup;\n readonly exampleIndex: number;\n}\n\nexport interface ScenarioOutlineNodeInit<World> {\n readonly outline: SimpleScenarioOutline;\n readonly summary: ScenarioSummary<World>;\n readonly scope: ScopeNode<World>;\n readonly keyword: string;\n readonly name: string;\n readonly qualifiedName: string;\n readonly tags: readonly string[];\n readonly mode: ExecutionMode;\n readonly pending: boolean;\n readonly pendingReason?: string;\n readonly timeout?: TimeoutSpec;\n readonly data?: Record<string, unknown>;\n readonly ancestors: readonly ScopeNode<World>[];\n readonly rule?: RuleNode<World>;\n readonly feature: FeatureNode<World>;\n readonly examples: ScenarioOutlineExample<World>[];\n}\n\nexport function createFeatureNode<World>(init: FeatureNodeInit<World>): FeatureNode<World> {\n return new FeatureNodeImpl(init);\n}\n\nexport function createRuleNode<World>(init: RuleNodeInit<World>): RuleNode<World> {\n return new RuleNodeImpl(init);\n}\n\nexport function createScenarioNode<World>(\n init: ScenarioExecutionInit<World, SimpleScenario>\n): ScenarioNode<World> {\n return new ScenarioNodeImpl(init);\n}\n\nexport function createScenarioOutlineNode<World>(\n init: ScenarioOutlineNodeInit<World>\n): ScenarioOutlineNode<World> {\n return new ScenarioOutlineNodeImpl(init);\n}\n\nexport function createScenarioOutlineExample<World>(\n init: ScenarioOutlineExampleInit<World>\n): ScenarioOutlineExample<World> {\n return new ScenarioOutlineExampleImpl(init);\n}\n\nclass FeatureNodeImpl<World> implements FeatureNode<World> {\n readonly type = \"feature\" as const;\n readonly scenarios: ScenarioNode<World>[];\n readonly scenarioOutlines: ScenarioOutlineNode<World>[];\n readonly rules: RuleNode<World>[];\n readonly name: string;\n readonly keyword: string;\n readonly background?: SimpleScenario;\n readonly feature: SimpleFeature;\n readonly scope: ScopeNode<World>;\n private readonly executions: ScenarioExecution<World>[];\n\n constructor(init: FeatureNodeInit<World>) {\n this.feature = init.feature;\n this.scope = init.scope;\n this.executions = init.executions;\n this.scenarios = init.scenarios;\n this.scenarioOutlines = init.outlines;\n this.rules = init.rules;\n this.name = init.feature.name;\n this.keyword = normalizeKeyword(init.feature.keyword ?? \"Feature\");\n if (init.feature.background) {\n this.background = init.feature.background;\n }\n }\n\n listExecutables(): readonly ScenarioExecution<World>[] {\n return this.executions;\n }\n}\n\nclass RuleNodeImpl<World> implements RuleNode<World> {\n readonly type = \"rule\" as const;\n readonly scenarios: readonly ScenarioNode<World>[];\n readonly scenarioOutlines: readonly ScenarioOutlineNode<World>[];\n readonly name: string;\n readonly keyword: string;\n readonly background?: SimpleScenario;\n readonly rule: SimpleRule;\n readonly scope: ScopeNode<World>;\n readonly qualifiedName: string;\n\n constructor(init: RuleNodeInit<World>) {\n this.rule = init.rule;\n this.scope = init.scope;\n this.qualifiedName = init.qualifiedName;\n this.name = init.rule.name;\n this.keyword = normalizeKeyword(init.rule.keyword ?? \"Rule\");\n if (init.rule.background) {\n this.background = init.rule.background;\n }\n this.scenarios = init.scenarios;\n this.scenarioOutlines = init.outlines;\n }\n}\n\nabstract class ScenarioExecutionBase<World, Gherkin extends SimpleScenario | SimpleCompiledScenario>\n implements ScenarioExecution<World>\n{\n readonly type: \"scenario\" | \"example\";\n readonly id: string;\n readonly name: string;\n readonly keyword: string;\n readonly qualifiedName: string;\n readonly tags: readonly string[];\n readonly mode: ExecutionMode;\n readonly pending: boolean;\n readonly pendingReason?: string;\n readonly timeout?: TimeoutSpec;\n readonly data?: Record<string, unknown>;\n readonly feature: FeatureNode<World>;\n readonly rule?: RuleNode<World>;\n readonly outline?: ScenarioOutlineNode<World>;\n readonly scope: ScopeNode<World>;\n readonly summary: ScenarioSummary<World>;\n readonly gherkin: Gherkin;\n readonly gherkinSteps: readonly SimpleStep[];\n readonly steps: readonly StepDefinition<World>[];\n readonly ancestors: readonly ScopeNode<World>[];\n\n private resultState: ScenarioResult = { status: \"pending\" };\n\n protected constructor(\n type: \"scenario\" | \"example\",\n init: ScenarioExecutionInit<World, Gherkin>\n ) {\n this.type = type;\n this.id = init.id;\n this.name = init.name;\n this.keyword = normalizeKeyword(init.keyword);\n this.qualifiedName = init.qualifiedName;\n this.tags = [...init.tags];\n this.mode = init.mode;\n this.pending = init.pending;\n if (init.pendingReason !== undefined) {\n this.pendingReason = init.pendingReason;\n }\n if (init.timeout !== undefined) {\n this.timeout = init.timeout;\n }\n const data = cloneData(init.data);\n if (data !== undefined) {\n this.data = data;\n }\n this.feature = init.feature;\n if (init.rule) {\n this.rule = init.rule;\n }\n if (init.outline) {\n this.outline = init.outline;\n }\n this.scope = init.scope;\n this.summary = init.summary;\n this.gherkin = init.gherkin;\n this.gherkinSteps = [...init.gherkinSteps];\n this.steps = [...init.steps];\n this.ancestors = [...init.ancestors];\n }\n\n get result(): ScenarioResult {\n return this.resultState;\n }\n\n markPassed(): void {\n const startedAt = this.resultState.startedAt ?? Date.now();\n this.resultState = {\n status: \"passed\",\n startedAt,\n completedAt: Date.now(),\n };\n }\n\n markFailed(error: unknown): void {\n const startedAt = this.resultState.startedAt ?? Date.now();\n this.resultState = {\n status: \"failed\",\n error: normalizeError(error),\n startedAt,\n completedAt: Date.now(),\n };\n }\n\n markSkipped(reason?: string): void {\n const timestamp = Date.now();\n this.resultState = {\n status: \"skipped\",\n startedAt: this.resultState.startedAt ?? timestamp,\n completedAt: timestamp,\n ...(reason !== undefined ? { reason } : {}),\n };\n }\n\n markPending(reason?: string): void {\n const timestamp = Date.now();\n this.resultState = {\n status: \"pending\",\n startedAt: this.resultState.startedAt ?? timestamp,\n completedAt: timestamp,\n ...(reason !== undefined ? { reason } : {}),\n };\n }\n\n reset(): void {\n this.resultState = { status: \"pending\" };\n }\n}\n\nclass ScenarioNodeImpl<World>\n extends ScenarioExecutionBase<World, SimpleScenario>\n implements ScenarioNode<World>\n{\n constructor(init: ScenarioExecutionInit<World, SimpleScenario>) {\n super(\"scenario\", init);\n }\n}\n\nclass ScenarioOutlineExampleImpl<World>\n extends ScenarioExecutionBase<World, SimpleCompiledScenario>\n implements ScenarioOutlineExample<World>\n{\n readonly outline: ScenarioOutlineNode<World>;\n readonly exampleGroup: SimpleExampleGroup;\n readonly compiled: SimpleCompiledScenario;\n readonly exampleIndex: number;\n\n constructor(init: ScenarioOutlineExampleInit<World>) {\n super(\"example\", init);\n this.outline = init.outline;\n this.exampleGroup = init.exampleGroup;\n this.compiled = init.gherkin;\n this.exampleIndex = init.exampleIndex;\n }\n}\n\nclass ScenarioOutlineNodeImpl<World>\n implements ScenarioOutlineNode<World>\n{\n readonly type = \"scenarioOutline\" as const;\n readonly outline: SimpleScenarioOutline;\n readonly summary: ScenarioSummary<World>;\n readonly scope: ScopeNode<World>;\n readonly keyword: string;\n readonly name: string;\n readonly qualifiedName: string;\n readonly tags: readonly string[];\n readonly mode: ExecutionMode;\n readonly pending: boolean;\n readonly pendingReason?: string;\n readonly timeout?: TimeoutSpec;\n readonly data?: Record<string, unknown>;\n readonly ancestors: readonly ScopeNode<World>[];\n private readonly mutableExamples: ScenarioOutlineExample<World>[];\n readonly rule?: RuleNode<World>;\n readonly feature: FeatureNode<World>;\n\n constructor(init: ScenarioOutlineNodeInit<World>) {\n this.outline = init.outline;\n this.summary = init.summary;\n this.scope = init.scope;\n this.keyword = normalizeKeyword(init.keyword);\n this.name = init.name;\n this.qualifiedName = init.qualifiedName;\n this.tags = [...init.tags];\n this.mode = init.mode;\n this.pending = init.pending;\n if (init.pendingReason !== undefined) {\n this.pendingReason = init.pendingReason;\n }\n if (init.timeout !== undefined) {\n this.timeout = init.timeout;\n }\n const data = cloneData(init.data);\n if (data !== undefined) {\n this.data = data;\n }\n this.ancestors = [...init.ancestors];\n if (init.rule) {\n this.rule = init.rule;\n }\n this.feature = init.feature;\n this.mutableExamples = init.examples;\n }\n\n get examples(): readonly ScenarioOutlineExample<World>[] {\n return this.mutableExamples;\n }\n}\n","import type { ScenarioSummary } from \"@autometa/scopes\";\nimport { normalizeName } from \"./utils\";\n\nexport type ScenarioKindKey = \"scenario\" | \"scenarioOutline\";\n\nexport type ScenarioSummaryBuckets<World> = Map<string, ScenarioSummary<World>[]>;\n\nexport function bucketScenarioSummaries<World>(\n summaries: readonly ScenarioSummary<World>[]\n): ScenarioSummaryBuckets<World> {\n const buckets: ScenarioSummaryBuckets<World> = new Map();\n\n for (const summary of summaries) {\n const key = createSummaryKey(\n summary.scenario.kind as ScenarioKindKey,\n summary.scenario.name,\n summary.rule?.id\n );\n const existing = buckets.get(key) ?? [];\n existing.push(summary);\n buckets.set(key, existing);\n }\n\n return buckets;\n}\n\nexport function createSummaryKey(\n kind: ScenarioKindKey,\n scenarioName: string,\n parentScopeId: string | undefined\n): string {\n return [\n kind,\n normalizeName(scenarioName),\n parentScopeId ?? \"root\",\n ].join(\"::\");\n}\n\nexport function describeSummary<World>(summary: ScenarioSummary<World>): string {\n const parts = [summary.scenario.name];\n if (summary.rule) {\n parts.push(`in rule '${summary.rule.name}'`);\n }\n return `${summary.scenario.kind} '${parts.join(\" \")}'`;\n}\n","import type { ScopeExecutionAdapter, ScopeNode } from \"@autometa/scopes\";\nimport type { SimpleFeature } from \"@autometa/gherkin\";\nimport { normalizeName, normalizeUri } from \"./utils\";\n\nexport function resolveFeatureScope<World>(\n adapter: ScopeExecutionAdapter<World>,\n feature: SimpleFeature\n): ScopeNode<World> {\n const normalizedName = normalizeName(feature.name);\n const featureUri = feature.uri ? normalizeUri(feature.uri) : undefined;\n\n const matches = adapter.features.filter((scope) => {\n if (scope.kind !== \"feature\") {\n return false;\n }\n\n const scopeName = normalizeName(scope.name);\n if (scopeName !== normalizedName) {\n return false;\n }\n\n if (!featureUri) {\n return true;\n }\n\n const scopeFile = typeof scope.data?.file === \"string\" ? normalizeUri(scope.data.file) : undefined;\n return scopeFile ? scopeFile === featureUri : true;\n });\n\n if (matches.length === 1) {\n const [match] = matches;\n if (!match) {\n throw new Error(\"Unexpected empty feature scope match\");\n }\n return match;\n }\n\n if (matches.length === 0) {\n throw new Error(\n `No feature scope registered for feature '${feature.name}'. Provide featureScope explicitly to resolve the association.`\n );\n }\n\n throw new Error(\n `Multiple feature scopes match feature '${feature.name}'. Provide featureScope explicitly to disambiguate.`\n );\n}\n\nexport function findChildScope<World>(\n parent: ScopeNode<World>,\n kind: ScopeNode<World>[\"kind\"],\n name: string\n): ScopeNode<World> {\n const normalizedName = normalizeName(name);\n const matches = parent.children.filter(\n (child) => child.kind === kind && normalizeName(child.name) === normalizedName\n );\n\n if (matches.length === 1) {\n const [match] = matches;\n if (!match) {\n throw new Error(\"Unexpected empty child scope match\");\n }\n return match;\n }\n\n if (matches.length === 0) {\n throw new Error(\n `Could not find ${kind} scope named '${name}' beneath '${parent.name}'`\n );\n }\n\n throw new Error(\n `Multiple ${kind} scopes named '${name}' were found beneath '${parent.name}'. Names must be unique within the same parent scope.`\n );\n}\n","import type { ScopeExecutionAdapter } from \"@autometa/scopes\";\nimport type { SimpleFeature } from \"@autometa/gherkin\";\nimport type { BuildTestPlanOptions, TestPlan } from \"./types\";\nimport { TestPlanBuilder } from \"./internal/test-plan-builder\";\nimport { resolveFeatureScope } from \"./internal/scope-resolution\";\n\nexport function buildTestPlan<World>(options: BuildTestPlanOptions<World>): TestPlan<World> {\n const { feature, adapter } = options;\n assertFeature(feature);\n assertAdapter(adapter);\n\n const featureScope =\n options.featureScope ?? resolveFeatureScope(adapter, feature);\n\n return new TestPlanBuilder(feature, featureScope, adapter).build();\n}\n\nfunction assertFeature(feature: SimpleFeature | undefined): asserts feature is SimpleFeature {\n if (!feature) {\n throw new Error(\"A Gherkin feature is required to build a test plan\");\n }\n}\n\nfunction assertAdapter<World>(\n adapter: ScopeExecutionAdapter<World> | undefined\n): asserts adapter is ScopeExecutionAdapter<World> {\n if (!adapter) {\n throw new Error(\"A scope execution adapter is required to build a test plan\");\n }\n}\n"]}
@@ -0,0 +1,69 @@
1
+ import type { ExecutionMode, ScopeNode, ScenarioSummary, StepDefinition, TimeoutSpec } from "@autometa/scopes";
2
+ import type { SimpleCompiledScenario, SimpleExampleGroup, SimpleFeature, SimpleRule, SimpleScenario, SimpleScenarioOutline, SimpleStep } from "@autometa/gherkin";
3
+ import type { FeatureNode, RuleNode, ScenarioExecution, ScenarioNode, ScenarioOutlineExample, ScenarioOutlineNode } from "../types";
4
+ export interface FeatureNodeInit<World> {
5
+ readonly feature: SimpleFeature;
6
+ readonly scope: ScopeNode<World>;
7
+ readonly executions: ScenarioExecution<World>[];
8
+ readonly scenarios: ScenarioNode<World>[];
9
+ readonly outlines: ScenarioOutlineNode<World>[];
10
+ readonly rules: RuleNode<World>[];
11
+ }
12
+ export interface RuleNodeInit<World> {
13
+ readonly rule: SimpleRule;
14
+ readonly scope: ScopeNode<World>;
15
+ readonly qualifiedName: string;
16
+ readonly scenarios: ScenarioNode<World>[];
17
+ readonly outlines: ScenarioOutlineNode<World>[];
18
+ }
19
+ export interface ScenarioExecutionInit<World, Gherkin extends SimpleScenario | SimpleCompiledScenario> {
20
+ readonly id: string;
21
+ readonly feature: FeatureNode<World>;
22
+ readonly rule?: RuleNode<World>;
23
+ readonly outline?: ScenarioOutlineNode<World>;
24
+ readonly name: string;
25
+ readonly keyword: string;
26
+ readonly qualifiedName: string;
27
+ readonly tags: readonly string[];
28
+ readonly mode: ExecutionMode;
29
+ readonly pending: boolean;
30
+ readonly pendingReason?: string;
31
+ readonly timeout?: TimeoutSpec;
32
+ readonly data?: Record<string, unknown>;
33
+ readonly scope: ScopeNode<World>;
34
+ readonly summary: ScenarioSummary<World>;
35
+ readonly gherkin: Gherkin;
36
+ readonly gherkinSteps: readonly SimpleStep[];
37
+ readonly steps: readonly StepDefinition<World>[];
38
+ readonly ancestors: readonly ScopeNode<World>[];
39
+ readonly exampleGroup?: SimpleExampleGroup;
40
+ readonly exampleIndex?: number;
41
+ }
42
+ export interface ScenarioOutlineExampleInit<World> extends ScenarioExecutionInit<World, SimpleCompiledScenario> {
43
+ readonly outline: ScenarioOutlineNode<World>;
44
+ readonly exampleGroup: SimpleExampleGroup;
45
+ readonly exampleIndex: number;
46
+ }
47
+ export interface ScenarioOutlineNodeInit<World> {
48
+ readonly outline: SimpleScenarioOutline;
49
+ readonly summary: ScenarioSummary<World>;
50
+ readonly scope: ScopeNode<World>;
51
+ readonly keyword: string;
52
+ readonly name: string;
53
+ readonly qualifiedName: string;
54
+ readonly tags: readonly string[];
55
+ readonly mode: ExecutionMode;
56
+ readonly pending: boolean;
57
+ readonly pendingReason?: string;
58
+ readonly timeout?: TimeoutSpec;
59
+ readonly data?: Record<string, unknown>;
60
+ readonly ancestors: readonly ScopeNode<World>[];
61
+ readonly rule?: RuleNode<World>;
62
+ readonly feature: FeatureNode<World>;
63
+ readonly examples: ScenarioOutlineExample<World>[];
64
+ }
65
+ export declare function createFeatureNode<World>(init: FeatureNodeInit<World>): FeatureNode<World>;
66
+ export declare function createRuleNode<World>(init: RuleNodeInit<World>): RuleNode<World>;
67
+ export declare function createScenarioNode<World>(init: ScenarioExecutionInit<World, SimpleScenario>): ScenarioNode<World>;
68
+ export declare function createScenarioOutlineNode<World>(init: ScenarioOutlineNodeInit<World>): ScenarioOutlineNode<World>;
69
+ export declare function createScenarioOutlineExample<World>(init: ScenarioOutlineExampleInit<World>): ScenarioOutlineExample<World>;
@@ -0,0 +1,4 @@
1
+ import type { ScopeExecutionAdapter, ScopeNode } from "@autometa/scopes";
2
+ import type { SimpleFeature } from "@autometa/gherkin";
3
+ export declare function resolveFeatureScope<World>(adapter: ScopeExecutionAdapter<World>, feature: SimpleFeature): ScopeNode<World>;
4
+ export declare function findChildScope<World>(parent: ScopeNode<World>, kind: ScopeNode<World>["kind"], name: string): ScopeNode<World>;
@@ -0,0 +1,6 @@
1
+ import type { ScenarioSummary } from "@autometa/scopes";
2
+ export type ScenarioKindKey = "scenario" | "scenarioOutline";
3
+ export type ScenarioSummaryBuckets<World> = Map<string, ScenarioSummary<World>[]>;
4
+ export declare function bucketScenarioSummaries<World>(summaries: readonly ScenarioSummary<World>[]): ScenarioSummaryBuckets<World>;
5
+ export declare function createSummaryKey(kind: ScenarioKindKey, scenarioName: string, parentScopeId: string | undefined): string;
6
+ export declare function describeSummary<World>(summary: ScenarioSummary<World>): string;
@@ -0,0 +1,55 @@
1
+ import type { ScopeExecutionAdapter, ScopeNode } from "@autometa/scopes";
2
+ import type { SimpleFeature } from "@autometa/gherkin";
3
+ import type { TestPlan } from "../types";
4
+ export declare class TestPlanBuilder<World> {
5
+ private readonly feature;
6
+ private readonly featureScope;
7
+ private readonly adapter;
8
+ private static readonly SUGGESTION_LIMIT_PER_GROUP;
9
+ /**
10
+ * Similarity threshold in [0, 1].
11
+ * 1.0 = identical, 0.0 = completely different.
12
+ */
13
+ private static readonly SUGGESTION_MIN_SIMILARITY_SAME_TYPE;
14
+ private static readonly SUGGESTION_MIN_SIMILARITY_DIFFERENT_TYPE;
15
+ private readonly executions;
16
+ private readonly byId;
17
+ private readonly byQualifiedName;
18
+ private readonly featureScenarios;
19
+ private readonly featureScenarioOutlines;
20
+ private readonly featureRules;
21
+ private readonly ruleScenarioMap;
22
+ private readonly ruleOutlineMap;
23
+ private readonly outlineExamplesMap;
24
+ private readonly summaryBuckets;
25
+ private readonly featureSegment;
26
+ private readonly parameterRegistry;
27
+ private featureNode;
28
+ constructor(feature: SimpleFeature, featureScope: ScopeNode<World>, adapter: ScopeExecutionAdapter<World>);
29
+ build(): TestPlan<World>;
30
+ private processRule;
31
+ private processScenario;
32
+ private processScenarioOutline;
33
+ private consumeSummary;
34
+ private registerExecution;
35
+ private ensureAllSummariesConsumed;
36
+ private getRuleScenarios;
37
+ private getRuleOutlines;
38
+ private getOutlineExamples;
39
+ private resolveStepDefinitions;
40
+ private findMatchingStepDefinition;
41
+ private matchesStepExpression;
42
+ private createMatcher;
43
+ private buildMissingStepDefinitionMessage;
44
+ private buildMissingStepContextLine;
45
+ private buildUnusedStepDefinitionsMessage;
46
+ private describeStepDefinition;
47
+ private createMissingStepDefinition;
48
+ private resolveStepKeyword;
49
+ private createFallbackStepOptions;
50
+ private resolveClosestStepDefinitionSuggestions;
51
+ private normalizeForDistance;
52
+ private computeSimilarity;
53
+ private computeEditDistance;
54
+ private tryNormalizeKeyword;
55
+ }
@@ -0,0 +1,18 @@
1
+ import type { SimpleCompiledScenario, SimpleExampleGroup, SimpleFeatureElement, SimpleRule, SimpleScenario, SimpleScenarioOutline, SimpleStep } from "@autometa/gherkin";
2
+ import type { QualifiedPathSegment } from "../types";
3
+ export declare function normalizeName(value: string): string;
4
+ export declare function normalizeKeyword(keyword: string): string;
5
+ export declare function normalizeUri(uri: string): string;
6
+ export declare function buildScopeSuffix(id: string): string;
7
+ export declare function buildExampleSuffix(exampleId: string, index: number): string;
8
+ export declare function buildQualifiedName(segments: readonly QualifiedPathSegment[]): string;
9
+ export declare function collectTags(...sources: ReadonlyArray<readonly string[] | undefined>): readonly string[];
10
+ export declare function combineSteps(featureSteps: readonly SimpleStep[] | undefined, ruleSteps: readonly SimpleStep[] | undefined, scenarioSteps: readonly SimpleStep[] | undefined): readonly SimpleStep[];
11
+ export declare function cloneData(data: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
12
+ export declare function mergeData(base: Record<string, unknown> | undefined, extra: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
13
+ export declare function createExampleData(group: SimpleExampleGroup, compiled: SimpleCompiledScenario): Record<string, unknown> | undefined;
14
+ export declare function normalizeError(error: unknown): Error;
15
+ export declare function groupCompiledScenarios(compiled: readonly SimpleCompiledScenario[]): Map<string, SimpleCompiledScenario[]>;
16
+ export declare function isRule(element: SimpleFeatureElement): element is SimpleRule;
17
+ export declare function isScenarioOutline(element: SimpleFeatureElement | SimpleScenario | SimpleScenarioOutline | SimpleRule): element is SimpleScenarioOutline;
18
+ export declare function isScenario(element: SimpleFeatureElement | SimpleScenario): element is SimpleScenario;
@@ -0,0 +1,113 @@
1
+ import type { ScopeExecutionAdapter, ScopeNode, ScenarioSummary, StepDefinition, ExecutionMode, TimeoutSpec } from "@autometa/scopes";
2
+ import type { SimpleCompiledScenario, SimpleExampleGroup, SimpleFeature, SimpleRule, SimpleScenario, SimpleScenarioOutline, SimpleStep } from "@autometa/gherkin";
3
+ /**
4
+ * Status values tracked for each executable scenario row within a feature.
5
+ */
6
+ export type ScenarioStatus = "pending" | "passed" | "failed" | "skipped";
7
+ /**
8
+ * Runtime result metadata captured for a scenario or example execution.
9
+ */
10
+ export interface ScenarioResult {
11
+ readonly status: ScenarioStatus;
12
+ readonly error?: Error;
13
+ readonly reason?: string;
14
+ readonly startedAt?: number;
15
+ readonly completedAt?: number;
16
+ }
17
+ /**
18
+ * Shared metadata for the fully qualified Gherkin location of a node.
19
+ */
20
+ export interface QualifiedPathSegment {
21
+ readonly keyword: string;
22
+ readonly name?: string;
23
+ readonly suffix?: string;
24
+ }
25
+ export interface ScenarioExecution<World> {
26
+ readonly id: string;
27
+ readonly type: "scenario" | "example";
28
+ readonly name: string;
29
+ readonly keyword: string;
30
+ readonly qualifiedName: string;
31
+ readonly tags: readonly string[];
32
+ readonly mode: ExecutionMode;
33
+ readonly pending: boolean;
34
+ readonly pendingReason?: string;
35
+ readonly timeout?: TimeoutSpec;
36
+ readonly data?: Record<string, unknown>;
37
+ readonly feature: FeatureNode<World>;
38
+ readonly rule?: RuleNode<World>;
39
+ readonly outline?: ScenarioOutlineNode<World>;
40
+ readonly scope: ScopeNode<World>;
41
+ readonly summary: ScenarioSummary<World>;
42
+ readonly gherkin: SimpleScenario | SimpleCompiledScenario;
43
+ readonly gherkinSteps: readonly SimpleStep[];
44
+ readonly steps: readonly StepDefinition<World>[];
45
+ readonly ancestors: readonly ScopeNode<World>[];
46
+ readonly result: ScenarioResult;
47
+ markPassed(): void;
48
+ markFailed(error: unknown): void;
49
+ markSkipped(reason?: string): void;
50
+ markPending(reason?: string): void;
51
+ reset(): void;
52
+ }
53
+ export interface ScenarioOutlineExample<World> extends ScenarioExecution<World> {
54
+ readonly outline: ScenarioOutlineNode<World>;
55
+ readonly exampleGroup: SimpleExampleGroup;
56
+ readonly compiled: SimpleCompiledScenario;
57
+ readonly exampleIndex: number;
58
+ }
59
+ export interface ScenarioNode<World> extends ScenarioExecution<World> {
60
+ readonly gherkin: SimpleScenario;
61
+ }
62
+ export interface ScenarioOutlineNode<World> {
63
+ readonly type: "scenarioOutline";
64
+ readonly name: string;
65
+ readonly keyword: string;
66
+ readonly qualifiedName: string;
67
+ readonly outline: SimpleScenarioOutline;
68
+ readonly scope: ScopeNode<World>;
69
+ readonly summary: ScenarioSummary<World>;
70
+ readonly tags: readonly string[];
71
+ readonly mode: ExecutionMode;
72
+ readonly pending: boolean;
73
+ readonly pendingReason?: string;
74
+ readonly timeout?: TimeoutSpec;
75
+ readonly data?: Record<string, unknown>;
76
+ readonly ancestors: readonly ScopeNode<World>[];
77
+ readonly examples: readonly ScenarioOutlineExample<World>[];
78
+ }
79
+ export interface RuleNode<World> {
80
+ readonly type: "rule";
81
+ readonly name: string;
82
+ readonly keyword: string;
83
+ readonly qualifiedName: string;
84
+ readonly rule: SimpleRule;
85
+ readonly scope: ScopeNode<World>;
86
+ readonly scenarios: readonly ScenarioNode<World>[];
87
+ readonly scenarioOutlines: readonly ScenarioOutlineNode<World>[];
88
+ readonly background?: SimpleScenario;
89
+ }
90
+ export interface FeatureNode<World> {
91
+ readonly type: "feature";
92
+ readonly name: string;
93
+ readonly keyword: string;
94
+ readonly feature: SimpleFeature;
95
+ readonly scope: ScopeNode<World>;
96
+ readonly scenarios: readonly ScenarioNode<World>[];
97
+ readonly scenarioOutlines: readonly ScenarioOutlineNode<World>[];
98
+ readonly rules: readonly RuleNode<World>[];
99
+ readonly background?: SimpleScenario;
100
+ listExecutables(): readonly ScenarioExecution<World>[];
101
+ }
102
+ export interface TestPlan<World> {
103
+ readonly feature: FeatureNode<World>;
104
+ listExecutables(): readonly ScenarioExecution<World>[];
105
+ listFailed(): readonly ScenarioExecution<World>[];
106
+ findById(id: string): ScenarioExecution<World> | undefined;
107
+ findByQualifiedName(name: string): ScenarioExecution<World> | undefined;
108
+ }
109
+ export interface BuildTestPlanOptions<World> {
110
+ readonly feature: SimpleFeature;
111
+ readonly adapter: ScopeExecutionAdapter<World>;
112
+ readonly featureScope?: ScopeNode<World>;
113
+ }
package/package.json CHANGED
@@ -1,57 +1,55 @@
1
1
  {
2
2
  "name": "@autometa/test-builder",
3
- "version": "0.4.1",
4
- "description": "internal library for autometa",
3
+ "version": "1.0.0-rc.0",
4
+ "description": "",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "module": "dist/esm/index.js",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
9
12
  "exports": {
10
- "import": "./dist/esm/index.js",
11
- "require": "./dist/index.js",
12
- "default": "./dist/esm/index.js",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs",
15
+ "default": "./dist/index.js",
13
16
  "types": "./dist/index.d.ts"
14
17
  },
15
18
  "license": "MIT",
19
+ "dependencies": {
20
+ "@cucumber/cucumber-expressions": "^16.1.2",
21
+ "@autometa/cucumber-expressions": "1.0.0-rc.0",
22
+ "@autometa/gherkin": "1.0.0-rc.0",
23
+ "@autometa/scopes": "1.0.0-rc.0"
24
+ },
16
25
  "devDependencies": {
17
26
  "@types/node": "^18.11.18",
18
- "@types/uuid": "^9.0.5",
19
27
  "@typescript-eslint/eslint-plugin": "^5.54.1",
20
28
  "@typescript-eslint/parser": "^5.54.1",
21
- "@vitest/coverage-istanbul": "^1.4.0",
22
- "@vitest/coverage-v8": "^1.4.0",
23
29
  "eslint": "^8.37.0",
24
30
  "eslint-config-prettier": "^8.3.0",
25
- "istanbul": "^0.4.5",
26
31
  "rimraf": "^4.1.2",
27
32
  "tsup": "^7.2.0",
28
33
  "typescript": "^4.9.5",
29
34
  "vitest": "1.4.0",
30
35
  "tsconfig": "0.7.0",
31
- "eslint-config-custom": "0.6.0"
32
- },
33
- "dependencies": {
34
- "@cucumber/cucumber-expressions": "^16.1.2",
35
- "zod": "^3.21.4",
36
- "@autometa/app": "^0.4.1",
37
- "@autometa/asserters": "^0.1.8",
38
- "@autometa/bind-decorator": "^0.5.1",
39
- "@autometa/errors": "^0.2.2",
40
- "@autometa/gherkin": "^0.7.1",
41
- "@autometa/dto-builder": "^0.13.10",
42
- "@autometa/events": "^0.3.1",
43
- "@autometa/phrases": "^0.1.12",
44
- "@autometa/scopes": "^0.7.1",
45
- "@autometa/types": "^0.4.1"
36
+ "eslint-config-custom": "0.6.0",
37
+ "tsup-config": "0.1.0"
46
38
  },
47
39
  "scripts": {
40
+ "type-check": "tsc --noEmit -p tsconfig.dev.json",
41
+ "type-check:watch": "tsc --noEmit --watch -p tsconfig.dev.json",
42
+ "build": "tsup && pnpm run build:types",
43
+ "build:types": "rimraf tsconfig.types.tsbuildinfo && tsc --build tsconfig.types.json",
44
+ "build:watch": "tsup --watch",
45
+ "dev": "tsup --watch",
48
46
  "test": "vitest run --passWithNoTests",
49
- "coverage": "vitest run --coverage",
50
- "prettify": "prettier --config .prettierrc 'src/**/*.ts' --write",
47
+ "test:watch": "vitest --passWithNoTests",
48
+ "test:ui": "vitest --ui --passWithNoTests",
49
+ "coverage": "vitest run --coverage --passWithNoTests",
51
50
  "lint": "eslint . --max-warnings 0",
52
51
  "lint:fix": "eslint . --fix",
53
- "clean": "rimraf dist",
54
- "build": "tsup",
55
- "build:watch": "tsup --watch"
52
+ "prettify": "prettier --config .prettierrc 'src/**/*.ts' --write",
53
+ "clean": "rimraf dist"
56
54
  }
57
55
  }