@step-forge/step-forge 0.0.22 → 0.0.24
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/RUNTIME.md +32 -0
- package/dist/analyzer-DIZPMxzN.cjs +441 -0
- package/dist/analyzer-DIZPMxzN.cjs.map +1 -0
- package/dist/analyzer-DnfK54Dw.js +417 -0
- package/dist/analyzer-DnfK54Dw.js.map +1 -0
- package/dist/analyzer-cli.js +1 -1
- package/dist/{analyzer-byS8yRrY.js → analyzer-gYyAKIpM.js} +10 -2
- package/dist/analyzer-gYyAKIpM.js.map +1 -0
- package/dist/analyzer.js +1 -1
- package/dist/cli.cjs +633 -16
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +631 -16
- package/dist/cli.js.map +1 -1
- package/dist/{gherkinParser-BT40q_i3.cjs → gherkinParser-_ZgvELdy.cjs} +46 -2
- package/dist/gherkinParser-_ZgvELdy.cjs.map +1 -0
- package/dist/{gherkinParser-NcttZgN4.js → gherkinParser-i-Q7M6mi.js} +26 -3
- package/dist/gherkinParser-i-Q7M6mi.js.map +1 -0
- package/dist/step-forge.cjs +7 -399
- package/dist/step-forge.cjs.map +1 -1
- package/dist/step-forge.js +2 -393
- package/dist/step-forge.js.map +1 -1
- package/package.json +1 -1
- package/dist/analyzer-byS8yRrY.js.map +0 -1
- package/dist/gherkinParser-BT40q_i3.cjs.map +0 -1
- package/dist/gherkinParser-NcttZgN4.js.map +0 -1
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["path","userFrames","relativeFrame","relativeLocation","BasicWorld","path","globFiles","compileRegistry","globalRegistry","parseFeatureFiles","runHooksParallel","globalHookRegistry","runHooks","runScenario","path"],"sources":["../../src/runtime/config.ts","../../src/runtime/filter.ts","../../src/runtime/reporters.ts","../../src/runtime/runner.ts","../../src/runtime/cli.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { access } from \"node:fs/promises\";\n\n/**\n * User-facing runner configuration. The same shape is accepted from a\n * `step-forge.config.ts` file (default export) and from CLI flags, with flags\n * taking precedence. Everything is optional; {@link resolveConfig} fills in\n * defaults.\n */\nexport interface RunnerOptions {\n /** Feature-file glob(s), relative to `cwd`. Defaults to every `.feature` file. */\n features?: string | string[];\n /** Step-module glob(s), relative to `cwd`. Defaults to every `.steps.ts` file. */\n steps?: string | string[];\n /**\n * Module that default-exports a world factory `() => world`, relative to\n * `cwd`. When omitted each scenario gets a fresh `BasicWorld`.\n */\n world?: string;\n /**\n * Max scenarios in flight at once. Defaults to `1` (serial), matching\n * Cucumber's default execution model — scenarios often share module-level\n * state via hooks, which only holds under serial execution. Raise it to opt\n * into parallelism for isolated, I/O-bound suites.\n */\n concurrency?: number;\n /** Reporter name. Default `pretty`. */\n reporter?: \"pretty\" | \"progress\";\n /**\n * Verbose output: report every scenario (pass, fail, skip) instead of only\n * failures. Passed to whichever reporter is active. Default `false`.\n */\n verbose?: boolean;\n /** Only run scenarios whose name matches this (string → substring/regex). */\n name?: string;\n /** Cucumber tag expression, e.g. `@smoke and not @wip`. */\n tags?: string;\n}\n\n/** Fully-resolved config: no optionals, globs kept as arrays, paths absolute. */\nexport interface ResolvedConfig {\n cwd: string;\n features: string[];\n steps: string[];\n world?: string;\n concurrency: number;\n reporter: \"pretty\" | \"progress\";\n verbose: boolean;\n name?: string;\n tags?: string;\n}\n\nconst DEFAULT_FEATURES = \"**/*.feature\";\nconst DEFAULT_STEPS = \"**/*.steps.ts\";\nconst CONFIG_BASENAMES = [\n \"step-forge.config.ts\",\n \"step-forge.config.mts\",\n \"step-forge.config.js\",\n \"step-forge.config.mjs\",\n];\n\nfunction toArray<T>(value: T | T[] | undefined): T[] {\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n}\n\nasync function exists(p: string): Promise<boolean> {\n try {\n await access(p);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Locate and import a `step-forge.config.*` file from `cwd`, returning its\n * default export (or `{}` if none is present). Imported by absolute file URL so\n * Bun transpiles the TypeScript config natively.\n */\nexport async function loadConfigFile(cwd: string): Promise<RunnerOptions> {\n for (const basename of CONFIG_BASENAMES) {\n const candidate = path.join(cwd, basename);\n if (!(await exists(candidate))) continue;\n const mod = await import(pathToFileURL(candidate).href);\n return (mod.default ?? mod) as RunnerOptions;\n }\n return {};\n}\n\n/**\n * Merge file config with CLI overrides and apply defaults. CLI overrides win\n * field-by-field; array globs are normalised to arrays and default when neither\n * source provides them.\n */\nexport function resolveConfig(\n cwd: string,\n file: RunnerOptions,\n cli: RunnerOptions\n): ResolvedConfig {\n const pick = <K extends keyof RunnerOptions>(key: K): RunnerOptions[K] =>\n cli[key] ?? file[key];\n\n const features = toArray(pick(\"features\"));\n const steps = toArray(pick(\"steps\"));\n\n return {\n cwd,\n features: features.length ? features : [DEFAULT_FEATURES],\n steps: steps.length ? steps : [DEFAULT_STEPS],\n world: pick(\"world\"),\n concurrency: pick(\"concurrency\") ?? 1,\n reporter: pick(\"reporter\") ?? \"pretty\",\n verbose: pick(\"verbose\") ?? false,\n name: pick(\"name\"),\n tags: pick(\"tags\"),\n };\n}\n","import { ParsedScenario } from \"../analyzer/types\";\n\n/**\n * A predicate over a scenario's tags, compiled from a Cucumber tag expression.\n * Supports `and`, `or`, `not`, parentheses, and bare `@tag` atoms — the common\n * subset of Cucumber's tag-expression language. Kept dependency-free; swap for\n * `@cucumber/tag-expressions` if fuller parity is needed.\n */\nexport type TagPredicate = (tags: readonly string[]) => boolean;\n\n/** Tokenise a tag expression into atoms, operators, and parentheses. */\nfunction tokenize(expr: string): string[] {\n const tokens: string[] = [];\n const re = /\\s*(\\(|\\)|@[^\\s()]+|\\band\\b|\\bor\\b|\\bnot\\b)\\s*/gy;\n let index = 0;\n while (index < expr.length) {\n re.lastIndex = index;\n const m = re.exec(expr);\n if (!m || m.index !== index) {\n throw new Error(`Invalid tag expression near: ${expr.slice(index)}`);\n }\n tokens.push(m[1]);\n index = re.lastIndex;\n }\n return tokens;\n}\n\n/**\n * Compile a tag expression into a predicate via recursive descent\n * (or → and → not → primary). Throws on malformed input so a bad `--tags` flag\n * fails loudly rather than silently matching nothing.\n */\nexport function compileTagExpression(expr: string): TagPredicate {\n const tokens = tokenize(expr);\n let pos = 0;\n\n const peek = () => tokens[pos];\n const next = () => tokens[pos++];\n\n const parseOr = (): TagPredicate => {\n let left = parseAnd();\n while (peek() === \"or\") {\n next();\n const right = parseAnd();\n const l = left;\n left = tags => l(tags) || right(tags);\n }\n return left;\n };\n\n const parseAnd = (): TagPredicate => {\n let left = parseNot();\n while (peek() === \"and\") {\n next();\n const right = parseNot();\n const l = left;\n left = tags => l(tags) && right(tags);\n }\n return left;\n };\n\n const parseNot = (): TagPredicate => {\n if (peek() === \"not\") {\n next();\n const operand = parseNot();\n return tags => !operand(tags);\n }\n return parsePrimary();\n };\n\n const parsePrimary = (): TagPredicate => {\n const token = next();\n if (token === \"(\") {\n const inner = parseOr();\n if (next() !== \")\") throw new Error(\"Unbalanced parentheses in tags\");\n return inner;\n }\n if (token === undefined || !token.startsWith(\"@\")) {\n throw new Error(`Expected a tag, got: ${token ?? \"end of input\"}`);\n }\n return tags => tags.includes(token);\n };\n\n const predicate = parseOr();\n if (pos !== tokens.length) {\n throw new Error(`Unexpected token in tag expression: ${peek()}`);\n }\n return predicate;\n}\n\nexport interface SelectOptions {\n /** Substring or `/regex/flags` match against the scenario (or outline) name. */\n name?: string;\n /** Cucumber tag expression. */\n tags?: string;\n}\n\n/** Parse a `/pattern/flags` string into a RegExp, else treat it as a substring. */\nfunction toNameMatcher(name: string): (candidate: string) => boolean {\n const delim = /^\\/(.*)\\/([a-z]*)$/.exec(name);\n if (delim) {\n const re = new RegExp(delim[1], delim[2]);\n return candidate => re.test(candidate);\n }\n return candidate => candidate.includes(name);\n}\n\n/**\n * Narrow scenarios by name and tags, then apply `@only` focus. `@skip` is *not*\n * applied here — skipped scenarios stay in the set so the runner can report them\n * as skipped rather than silently dropping them. Returns scenarios in input\n * order.\n *\n * `@only` semantics mirror the Vitest plugin: if any surviving scenario is\n * tagged `@only` (and not `@skip`), the run is focused to just those.\n */\nexport function selectScenarios(\n scenarios: ParsedScenario[],\n options: SelectOptions\n): ParsedScenario[] {\n let selected = scenarios;\n\n if (options.name) {\n const matches = toNameMatcher(options.name);\n selected = selected.filter(\n s => matches(s.name) || (s.outline ? matches(s.outline.name) : false)\n );\n }\n\n if (options.tags) {\n const predicate = compileTagExpression(options.tags);\n selected = selected.filter(s => predicate(s.tags));\n }\n\n const focused = selected.filter(\n s => s.tags.includes(\"@only\") && !s.tags.includes(\"@skip\")\n );\n return focused.length ? focused : selected;\n}\n","import { relative } from \"node:path\";\nimport { relativeFrame, relativeLocation, userFrames } from \"../sourceLocation\";\nimport { ScenarioResult, StepResult } from \"./engine\";\n\n/**\n * A reporter observes the run. `onScenarioEnd` fires as each scenario finishes\n * (completion order, non-deterministic under concurrency); `onComplete` fires\n * once with every result for the end-of-run output.\n *\n * Every reporter accepts a `verbose` flag: without it a reporter reports only\n * failures (plus a summary); with it, it reports every scenario. A reporter may\n * render the same either way — `verbose` is a request, not a requirement.\n */\nexport interface Reporter {\n onScenarioEnd?(result: ScenarioResult): void;\n onComplete(results: ScenarioResult[], durationMs: number): void;\n}\n\nexport interface ReporterOptions {\n cwd?: string;\n verbose?: boolean;\n}\n\n// --- ANSI colouring -------------------------------------------------------\nconst useColor =\n !process.env.NO_COLOR && (process.stdout.isTTY ?? false) === true;\n\nconst wrap = (open: number, close: number) => (s: string) =>\n useColor ? `\\x1b[${open}m${s}\\x1b[${close}m` : s;\n\nconst c = {\n green: wrap(32, 39),\n red: wrap(31, 39),\n yellow: wrap(33, 39),\n dim: wrap(2, 22),\n bold: wrap(1, 22),\n};\n\nconst STATUS_MARK: Record<StepResult[\"status\"], string> = {\n passed: c.green(\"✓\"),\n failed: c.red(\"✗\"),\n skipped: c.yellow(\"-\"),\n};\n\n/** ✓ / ✗ / - for a whole scenario (skipped = every step skipped). */\nfunction scenarioMark(result: ScenarioResult): string {\n if (result.status === \"failed\") return c.red(\"✗\");\n if (result.steps.every(s => s.status === \"skipped\")) return c.yellow(\"-\");\n return c.green(\"✓\");\n}\n\n/** Dot per scenario for the live heartbeat: `.` pass / `F` fail / `-` skip. */\nfunction scenarioDot(result: ScenarioResult): string {\n if (result.status === \"failed\") return c.red(\"F\");\n if (result.steps.every(s => s.status === \"skipped\")) return c.yellow(\"-\");\n return c.green(\".\");\n}\n\n/** Indent every non-empty line of a block by `pad` spaces. */\nfunction indent(text: string, pad: number): string {\n const prefix = \" \".repeat(pad);\n return text\n .split(\"\\n\")\n .map(line => (line ? prefix + line : line))\n .join(\"\\n\");\n}\n\n/**\n * The error, trimmed to user frames: `Name: message` followed by only the\n * caller's own stack frames (library/engine and `node_modules` frames removed),\n * source-mapped by Bun to the original `.ts`. Falls back to just the message\n * when nothing user-owned is left (e.g. an undefined-step error).\n */\nfunction renderError(error: Error, cwd: string): string {\n const header = `${error.name}: ${error.message}`;\n const frames = userFrames(error.stack).map(\n f => ` at ${relativeFrame(f, cwd)}`\n );\n return frames.length ? `${header}\\n${frames.join(\"\\n\")}` : header;\n}\n\n/**\n * The detail block shown beneath a failing step: the `.feature` line, the step\n * definition location, and the trimmed error — the two coordinates that make a\n * failure easy to chase (where in the feature, which step definition).\n */\nfunction failureDetail(\n stepResult: StepResult,\n result: ScenarioResult,\n cwd: string\n): string {\n const lines = [\n `feature: ${relative(cwd, result.scenario.file)}:${stepResult.step.line}`,\n ];\n if (stepResult.source) {\n lines.push(`defined: ${relativeLocation(stepResult.source, cwd)}`);\n }\n if (stepResult.error) lines.push(renderError(stepResult.error, cwd));\n return indent(c.red(lines.join(\"\\n\")), 6);\n}\n\n/**\n * One scenario as a Cucumber-style block: a marked header with its `.feature`\n * location, then each step with its mark (and, in `verbose`, the step\n * definition location as a trailing comment). A failing step is followed by its\n * failure detail; a scenario-level error (a failing hook, no step to blame) is\n * appended at the end.\n */\nfunction renderScenario(\n result: ScenarioResult,\n cwd: string,\n opts: { stepSource: boolean }\n): string {\n const label = result.scenario.outline\n ? `${result.scenario.outline.name} › ${result.scenario.name}`\n : result.scenario.name;\n const lines: string[] = [`${scenarioMark(result)} ${c.bold(label)}`];\n\n const loc = result.scenario.line\n ? `${relative(cwd, result.scenario.file)}:${result.scenario.line}`\n : relative(cwd, result.scenario.file);\n lines.push(indent(c.dim(loc), 4));\n lines.push(\"\");\n\n for (const step of result.scenario.steps) {\n const sr = result.steps.find(s => s.step === step);\n const status = sr?.status ?? \"skipped\";\n const comment =\n opts.stepSource && sr?.source\n ? c.dim(` # ${relativeLocation(sr.source, cwd)}`)\n : \"\";\n lines.push(\n ` ${STATUS_MARK[status]} ${c.dim(step.effectiveKeyword)} ${step.text}${comment}`\n );\n if (sr?.status === \"failed\") lines.push(failureDetail(sr, result, cwd));\n }\n\n // A hook failure has no failing step; surface its error at scenario level.\n const stepFailed = result.steps.some(s => s.status === \"failed\");\n if (result.error && !stepFailed) {\n lines.push(indent(c.red(renderError(result.error, cwd)), 4));\n }\n\n return lines.join(\"\\n\");\n}\n\n// --- Summary --------------------------------------------------------------\ninterface Totals {\n scenarios: { passed: number; failed: number; skipped: number };\n steps: { passed: number; failed: number; skipped: number };\n}\n\nfunction tally(results: ScenarioResult[]): Totals {\n const totals: Totals = {\n scenarios: { passed: 0, failed: 0, skipped: 0 },\n steps: { passed: 0, failed: 0, skipped: 0 },\n };\n for (const result of results) {\n if (result.status === \"failed\") totals.scenarios.failed++;\n else if (result.steps.every(s => s.status === \"skipped\"))\n totals.scenarios.skipped++;\n else totals.scenarios.passed++;\n for (const step of result.steps) totals.steps[step.status]++;\n }\n return totals;\n}\n\nfunction renderSummary(results: ScenarioResult[], durationMs: number): string {\n const t = tally(results);\n const scenarioTotal =\n t.scenarios.passed + t.scenarios.failed + t.scenarios.skipped;\n const stepTotal = t.steps.passed + t.steps.failed + t.steps.skipped;\n\n const part = (n: number, label: string, color: (s: string) => string) =>\n n > 0 ? color(`${n} ${label}`) : null;\n\n const line = (\n total: number,\n noun: string,\n counts: { passed: number; failed: number; skipped: number }\n ) => {\n const parts = [\n part(counts.passed, \"passed\", c.green),\n part(counts.failed, \"failed\", c.red),\n part(counts.skipped, \"skipped\", c.yellow),\n ].filter((x): x is string => x !== null);\n return `${total} ${noun}${total === 1 ? \"\" : \"s\"} (${parts.join(\", \")})`;\n };\n\n return [\n line(scenarioTotal, \"scenario\", t.scenarios),\n line(stepTotal, \"step\", t.steps),\n c.dim(`${(durationMs / 1000).toFixed(2)}s`),\n ].join(\"\\n\");\n}\n\nfunction write(text: string): void {\n process.stdout.write(text);\n}\n\n/** Feature-grouped tree of every scenario (used by `--verbose`). */\nfunction renderFullTree(results: ScenarioResult[], cwd: string): string {\n const groups = new Map<string, ScenarioResult[]>();\n for (const r of results) {\n const bucket = groups.get(r.scenario.file) ?? [];\n bucket.push(r);\n groups.set(r.scenario.file, bucket);\n }\n const out: string[] = [];\n for (const [file, group] of groups) {\n out.push(c.bold(`Feature: ${relative(cwd, file)}`), \"\");\n for (const r of group)\n out.push(indent(renderScenario(r, cwd, { stepSource: true }), 2), \"\");\n }\n return out.join(\"\\n\");\n}\n\n/** The failing scenarios only (used by the default, non-verbose output). */\nfunction renderFailures(results: ScenarioResult[], cwd: string): string {\n const failed = results.filter(r => r.status === \"failed\");\n if (!failed.length) return \"\";\n return (\n failed\n .map(r => renderScenario(r, cwd, { stepSource: false }))\n .join(\"\\n\\n\") + \"\\n\\n\"\n );\n}\n\n/**\n * Default reporter. Non-verbose: a dot per scenario as a heartbeat, then the\n * failing scenarios in Cucumber-style detail, then the summary. Verbose: the\n * full feature → scenario → step tree instead of just failures.\n */\nexport function prettyReporter(opts: ReporterOptions = {}): Reporter {\n const cwd = opts.cwd ?? process.cwd();\n const verbose = opts.verbose ?? false;\n return {\n onScenarioEnd(result) {\n if (!verbose) write(scenarioDot(result));\n },\n onComplete(results, durationMs) {\n const body = verbose\n ? `\\n${renderFullTree(results, cwd)}\\n`\n : `\\n\\n${renderFailures(results, cwd)}`;\n write(`${body}${renderSummary(results, durationMs)}\\n`);\n },\n };\n}\n\n/**\n * Compact reporter: a dot per scenario, then failures in detail and the\n * summary. Always minimal — `verbose` is accepted for interface parity but does\n * not expand the output (use `pretty --verbose` for the full tree).\n */\nexport function progressReporter(opts: ReporterOptions = {}): Reporter {\n const cwd = opts.cwd ?? process.cwd();\n return {\n onScenarioEnd(result) {\n write(scenarioDot(result));\n },\n onComplete(results, durationMs) {\n write(\n `\\n\\n${renderFailures(results, cwd)}${renderSummary(results, durationMs)}\\n`\n );\n },\n };\n}\n\nexport function makeReporter(\n name: \"pretty\" | \"progress\",\n opts: ReporterOptions = {}\n): Reporter {\n return name === \"progress\" ? progressReporter(opts) : prettyReporter(opts);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { ParsedScenario } from \"../analyzer/types\";\nimport { parseFeatureFiles } from \"../analyzer/gherkinParser\";\nimport { globFiles } from \"../globFiles\";\nimport { BasicWorld, MergeableWorld } from \"../world\";\nimport {\n compileRegistry,\n CompiledStep,\n runScenario,\n ScenarioResult,\n} from \"./engine\";\nimport { globalHookRegistry, runHooks, runHooksParallel } from \"./hooks\";\nimport { globalRegistry } from \"./registry\";\nimport { selectScenarios } from \"./filter\";\nimport { makeReporter, Reporter } from \"./reporters\";\nimport { ResolvedConfig } from \"./config\";\n\ntype WorldFactory = () => MergeableWorld<any, any, any>;\n\n/**\n * Import every step-definition module so its `.step(...)` calls self-register\n * into the shared `globalRegistry`. Imported by file URL so Bun transpiles the\n * TypeScript natively.\n */\nasync function importSteps(files: string[]): Promise<void> {\n for (const file of files) {\n await import(pathToFileURL(file).href);\n }\n}\n\n/** Load the configured world factory, or default to a fresh `BasicWorld`. */\nasync function loadWorldFactory(\n world: string | undefined,\n cwd: string\n): Promise<WorldFactory> {\n if (!world) return () => new BasicWorld();\n const resolved = path.resolve(cwd, world);\n const mod = await import(pathToFileURL(resolved).href);\n const factory = mod.default ?? mod;\n if (typeof factory !== \"function\") {\n throw new Error(\n `World module ${world} must default-export a factory function () => world`\n );\n }\n return factory as WorldFactory;\n}\n\n/** A scenario carrying `@skip` never runs: report it with all steps skipped. */\nfunction skippedResult(scenario: ParsedScenario): ScenarioResult {\n return {\n scenario,\n status: \"passed\",\n steps: scenario.steps.map(step => ({ step, status: \"skipped\" as const })),\n };\n}\n\n/**\n * Run `items` through `worker`, at most `limit` in flight. Results come back in\n * input order even though completion order is not deterministic. A minimal\n * dependency-free pool — the whole point of the single-process model.\n */\nasync function runPool<T, R>(\n items: T[],\n limit: number,\n worker: (item: T, index: number) => Promise<R>\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n let cursor = 0;\n const runNext = async (): Promise<void> => {\n while (cursor < items.length) {\n const index = cursor++;\n results[index] = await worker(items[index], index);\n }\n };\n const workers = Array.from(\n { length: Math.min(Math.max(1, limit), items.length) },\n runNext\n );\n await Promise.all(workers);\n return results;\n}\n\nexport interface RunResult {\n results: ScenarioResult[];\n passed: boolean;\n durationMs: number;\n}\n\n/**\n * Execute a whole run end to end: discover and import steps, load the world,\n * parse and select scenarios, then run them concurrently against a\n * compiled-once step table with global/feature hooks around the batch. Never\n * throws for test failures — inspect `RunResult.passed`.\n */\nexport async function run(\n config: ResolvedConfig,\n reporter: Reporter = makeReporter(config.reporter, {\n cwd: config.cwd,\n verbose: config.verbose,\n })\n): Promise<RunResult> {\n const start =\n typeof performance !== \"undefined\" ? performance.now() : Date.now();\n\n const [featureFiles, stepFiles] = await Promise.all([\n globFiles(config.features, config.cwd),\n globFiles(config.steps, config.cwd),\n ]);\n\n await importSteps(stepFiles);\n const makeWorld = await loadWorldFactory(config.world, config.cwd);\n\n const compiled: CompiledStep[] = compileRegistry(globalRegistry);\n const allScenarios = parseFeatureFiles(featureFiles);\n const selected = selectScenarios(allScenarios, {\n name: config.name,\n tags: config.tags,\n });\n\n // Global `beforeAll` hooks run once, in parallel, before any scenario starts;\n // feature before/after bracket the whole batch inside them. (Hooks aren't\n // file-scoped in the registry, so per-file bracketing would be meaningless\n // under concurrent execution.)\n await runHooksParallel(\"global\", \"before\", globalHookRegistry);\n await runHooks(\"feature\", \"before\", globalHookRegistry);\n\n const results = await runPool(\n selected,\n config.concurrency,\n async scenario => {\n const result = scenario.tags.includes(\"@skip\")\n ? skippedResult(scenario)\n : await runScenario(scenario, compiled, makeWorld, globalHookRegistry);\n reporter.onScenarioEnd?.(result);\n return result;\n }\n );\n\n await runHooks(\"feature\", \"after\", globalHookRegistry);\n // Global `afterAll` hooks run once, in parallel, after every scenario is done.\n await runHooksParallel(\"global\", \"after\", globalHookRegistry);\n\n const durationMs =\n (typeof performance !== \"undefined\" ? performance.now() : Date.now()) -\n start;\n reporter.onComplete(results, durationMs);\n\n return {\n results,\n passed: results.every(r => r.status !== \"failed\"),\n durationMs,\n };\n}\n","#!/usr/bin/env bun\nimport { parseArgs } from \"node:util\";\nimport * as path from \"node:path\";\nimport { loadConfigFile, resolveConfig, RunnerOptions } from \"./config\";\nimport { run } from \"./runner\";\n\nconst HELP = `step-forge — native TypeScript runner for Gherkin step definitions\n\nUsage:\n step-forge [options] [feature globs...]\n\nOptions:\n -t, --tags <expr> Tag expression, e.g. \"@smoke and not @wip\"\n -n, --name <pattern> Only scenarios whose name matches (substring or /regex/)\n -s, --steps <glob> Step-definition module glob (repeatable)\n -w, --world <module> World factory module (default export () => world)\n -c, --concurrency <n> Max scenarios in flight (default: 1, i.e. serial)\n -r, --reporter <name> \"pretty\" (default) or \"progress\"\n -v, --verbose Report every scenario, not just failures\n --config <path> Config file directory (default: cwd)\n -h, --help Show this help\n\nPositional arguments are feature globs and override the configured features.\n`;\n\n/** Parse argv into config overrides. Positional args become feature globs. */\nfunction parseCli(argv: string[]): { cwd: string; overrides: RunnerOptions } {\n const { values, positionals } = parseArgs({\n args: argv,\n allowPositionals: true,\n options: {\n tags: { type: \"string\", short: \"t\" },\n name: { type: \"string\", short: \"n\" },\n steps: { type: \"string\", short: \"s\", multiple: true },\n world: { type: \"string\", short: \"w\" },\n concurrency: { type: \"string\", short: \"c\" },\n reporter: { type: \"string\", short: \"r\" },\n verbose: { type: \"boolean\", short: \"v\" },\n config: { type: \"string\" },\n help: { type: \"boolean\", short: \"h\" },\n },\n });\n\n if (values.help) {\n process.stdout.write(HELP);\n process.exit(0);\n }\n\n const overrides: RunnerOptions = {};\n if (positionals.length) overrides.features = positionals;\n if (values.tags) overrides.tags = values.tags;\n if (values.name) overrides.name = values.name;\n if (values.steps) overrides.steps = values.steps;\n if (values.world) overrides.world = values.world;\n if (values.verbose) overrides.verbose = true;\n if (values.reporter) {\n if (values.reporter !== \"pretty\" && values.reporter !== \"progress\") {\n throw new Error(`Unknown reporter: ${values.reporter}`);\n }\n overrides.reporter = values.reporter;\n }\n if (values.concurrency !== undefined) {\n const n = Number(values.concurrency);\n if (!Number.isInteger(n) || n < 1) {\n throw new Error(`--concurrency must be a positive integer`);\n }\n overrides.concurrency = n;\n }\n\n const cwd = values.config\n ? path.resolve(process.cwd(), values.config)\n : process.cwd();\n return { cwd, overrides };\n}\n\nasync function main(): Promise<void> {\n const { cwd, overrides } = parseCli(process.argv.slice(2));\n const fileConfig = await loadConfigFile(cwd);\n const config = resolveConfig(cwd, fileConfig, overrides);\n const { passed } = await run(config);\n process.exitCode = passed ? 0 : 1;\n}\n\nmain().catch(err => {\n process.stderr.write(`${err instanceof Error ? err.stack : String(err)}\\n`);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;;AAqDA,MAAM,mBAAmB;AACzB,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;AACF;AAEA,SAAS,QAAW,OAAiC;CACnD,IAAI,UAAU,KAAA,GAAW,OAAO,CAAC;CACjC,OAAO,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK;AAC9C;AAEA,eAAe,OAAO,GAA6B;C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AK,CAAC,CAAC,OAAM,QAAO;CAClB,QAAQ,OAAO,MAAM,GAAG,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,EAAE,GAAG;CAC1E,QAAQ,WAAW;AACrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["path","useColor","wrap","userFrames","relativeFrame","relativeLocation","write","BasicWorld","path","globFiles","compileRegistry","globalRegistry","parseFeatureFiles","runHooksParallel","globalHookRegistry","runHooks","runScenario","useColor","fs","path","globFiles","parseFeatureCatalog","path","path"],"sources":["../../src/runtime/config.ts","../../src/runtime/filter.ts","../../src/runtime/reporters.ts","../../src/runtime/runner.ts","../../src/runtime/prompt.ts","../../src/runtime/watcher.ts","../../src/runtime/interactive.ts","../../src/runtime/cli.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { access } from \"node:fs/promises\";\n\n/**\n * User-facing runner configuration. The same shape is accepted from a\n * `step-forge.config.ts` file (default export) and from CLI flags, with flags\n * taking precedence. Everything is optional; {@link resolveConfig} fills in\n * defaults.\n */\nexport interface RunnerOptions {\n /** Feature-file glob(s), relative to `cwd`. Defaults to every `.feature` file. */\n features?: string | string[];\n /** Step-module glob(s), relative to `cwd`. Defaults to every `.steps.ts` file. */\n steps?: string | string[];\n /**\n * Module that default-exports a world factory `() => world`, relative to\n * `cwd`. When omitted each scenario gets a fresh `BasicWorld`.\n */\n world?: string;\n /**\n * Max scenarios in flight at once. Defaults to `1` (serial), matching\n * Cucumber's default execution model — scenarios often share module-level\n * state via hooks, which only holds under serial execution. Raise it to opt\n * into parallelism for isolated, I/O-bound suites.\n */\n concurrency?: number;\n /** Reporter name. Default `pretty`. */\n reporter?: \"pretty\" | \"progress\";\n /**\n * Verbose output: report every scenario (pass, fail, skip) instead of only\n * failures. Passed to whichever reporter is active. Default `false`.\n */\n verbose?: boolean;\n /** Only run scenarios whose name matches this (string → substring/regex). */\n name?: string;\n /** Cucumber tag expression, e.g. `@smoke and not @wip`. */\n tags?: string;\n}\n\n/** Fully-resolved config: no optionals, globs kept as arrays, paths absolute. */\nexport interface ResolvedConfig {\n cwd: string;\n features: string[];\n steps: string[];\n world?: string;\n concurrency: number;\n reporter: \"pretty\" | \"progress\";\n verbose: boolean;\n name?: string;\n tags?: string;\n}\n\nconst DEFAULT_FEATURES = \"**/*.feature\";\nconst DEFAULT_STEPS = \"**/*.steps.ts\";\nconst CONFIG_BASENAMES = [\n \"step-forge.config.ts\",\n \"step-forge.config.mts\",\n \"step-forge.config.js\",\n \"step-forge.config.mjs\",\n];\n\nfunction toArray<T>(value: T | T[] | undefined): T[] {\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n}\n\nasync function exists(p: string): Promise<boolean> {\n try {\n await access(p);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Locate and import a `step-forge.config.*` file from `cwd`, returning its\n * default export (or `{}` if none is present). Imported by absolute file URL so\n * Bun transpiles the TypeScript config natively.\n */\nexport async function loadConfigFile(cwd: string): Promise<RunnerOptions> {\n for (const basename of CONFIG_BASENAMES) {\n const candidate = path.join(cwd, basename);\n if (!(await exists(candidate))) continue;\n const mod = await import(pathToFileURL(candidate).href);\n return (mod.default ?? mod) as RunnerOptions;\n }\n return {};\n}\n\n/**\n * Merge file config with CLI overrides and apply defaults. CLI overrides win\n * field-by-field; array globs are normalised to arrays and default when neither\n * source provides them.\n */\nexport function resolveConfig(\n cwd: string,\n file: RunnerOptions,\n cli: RunnerOptions\n): ResolvedConfig {\n const pick = <K extends keyof RunnerOptions>(key: K): RunnerOptions[K] =>\n cli[key] ?? file[key];\n\n const features = toArray(pick(\"features\"));\n const steps = toArray(pick(\"steps\"));\n\n return {\n cwd,\n features: features.length ? features : [DEFAULT_FEATURES],\n steps: steps.length ? steps : [DEFAULT_STEPS],\n world: pick(\"world\"),\n concurrency: pick(\"concurrency\") ?? 1,\n reporter: pick(\"reporter\") ?? \"pretty\",\n verbose: pick(\"verbose\") ?? false,\n name: pick(\"name\"),\n tags: pick(\"tags\"),\n };\n}\n","import { ParsedScenario } from \"../analyzer/types\";\n\n/**\n * A predicate over a scenario's tags, compiled from a Cucumber tag expression.\n * Supports `and`, `or`, `not`, parentheses, and bare `@tag` atoms — the common\n * subset of Cucumber's tag-expression language. Kept dependency-free; swap for\n * `@cucumber/tag-expressions` if fuller parity is needed.\n */\nexport type TagPredicate = (tags: readonly string[]) => boolean;\n\n/** Tokenise a tag expression into atoms, operators, and parentheses. */\nfunction tokenize(expr: string): string[] {\n const tokens: string[] = [];\n const re = /\\s*(\\(|\\)|@[^\\s()]+|\\band\\b|\\bor\\b|\\bnot\\b)\\s*/gy;\n let index = 0;\n while (index < expr.length) {\n re.lastIndex = index;\n const m = re.exec(expr);\n if (!m || m.index !== index) {\n throw new Error(`Invalid tag expression near: ${expr.slice(index)}`);\n }\n tokens.push(m[1]);\n index = re.lastIndex;\n }\n return tokens;\n}\n\n/**\n * Compile a tag expression into a predicate via recursive descent\n * (or → and → not → primary). Throws on malformed input so a bad `--tags` flag\n * fails loudly rather than silently matching nothing.\n */\nexport function compileTagExpression(expr: string): TagPredicate {\n const tokens = tokenize(expr);\n let pos = 0;\n\n const peek = () => tokens[pos];\n const next = () => tokens[pos++];\n\n const parseOr = (): TagPredicate => {\n let left = parseAnd();\n while (peek() === \"or\") {\n next();\n const right = parseAnd();\n const l = left;\n left = tags => l(tags) || right(tags);\n }\n return left;\n };\n\n const parseAnd = (): TagPredicate => {\n let left = parseNot();\n while (peek() === \"and\") {\n next();\n const right = parseNot();\n const l = left;\n left = tags => l(tags) && right(tags);\n }\n return left;\n };\n\n const parseNot = (): TagPredicate => {\n if (peek() === \"not\") {\n next();\n const operand = parseNot();\n return tags => !operand(tags);\n }\n return parsePrimary();\n };\n\n const parsePrimary = (): TagPredicate => {\n const token = next();\n if (token === \"(\") {\n const inner = parseOr();\n if (next() !== \")\") throw new Error(\"Unbalanced parentheses in tags\");\n return inner;\n }\n if (token === undefined || !token.startsWith(\"@\")) {\n throw new Error(`Expected a tag, got: ${token ?? \"end of input\"}`);\n }\n return tags => tags.includes(token);\n };\n\n const predicate = parseOr();\n if (pos !== tokens.length) {\n throw new Error(`Unexpected token in tag expression: ${peek()}`);\n }\n return predicate;\n}\n\nexport interface SelectOptions {\n /** Substring or `/regex/flags` match against the scenario (or outline) name. */\n name?: string;\n /** Cucumber tag expression. */\n tags?: string;\n}\n\n/** Parse a `/pattern/flags` string into a RegExp, else treat it as a substring. */\nfunction toNameMatcher(name: string): (candidate: string) => boolean {\n const delim = /^\\/(.*)\\/([a-z]*)$/.exec(name);\n if (delim) {\n const re = new RegExp(delim[1], delim[2]);\n return candidate => re.test(candidate);\n }\n return candidate => candidate.includes(name);\n}\n\n/**\n * Narrow scenarios by name and tags, then apply `@only` focus. `@skip` is *not*\n * applied here — skipped scenarios stay in the set so the runner can report them\n * as skipped rather than silently dropping them. Returns scenarios in input\n * order.\n *\n * `@only` semantics mirror the Vitest plugin: if any surviving scenario is\n * tagged `@only` (and not `@skip`), the run is focused to just those.\n */\nexport function selectScenarios(\n scenarios: ParsedScenario[],\n options: SelectOptions\n): ParsedScenario[] {\n let selected = scenarios;\n\n if (options.name) {\n const matches = toNameMatcher(options.name);\n selected = selected.filter(\n s => matches(s.name) || (s.outline ? matches(s.outline.name) : false)\n );\n }\n\n if (options.tags) {\n const predicate = compileTagExpression(options.tags);\n selected = selected.filter(s => predicate(s.tags));\n }\n\n const focused = selected.filter(\n s => s.tags.includes(\"@only\") && !s.tags.includes(\"@skip\")\n );\n return focused.length ? focused : selected;\n}\n","import { relative } from \"node:path\";\nimport { relativeFrame, relativeLocation, userFrames } from \"../sourceLocation\";\nimport { ScenarioResult, StepResult } from \"./engine\";\n\n/**\n * A reporter observes the run. `onScenarioEnd` fires as each scenario finishes\n * (completion order, non-deterministic under concurrency); `onComplete` fires\n * once with every result for the end-of-run output.\n *\n * Every reporter accepts a `verbose` flag: without it a reporter reports only\n * failures (plus a summary); with it, it reports every scenario. A reporter may\n * render the same either way — `verbose` is a request, not a requirement.\n */\nexport interface Reporter {\n onScenarioEnd?(result: ScenarioResult): void;\n onComplete(results: ScenarioResult[], durationMs: number): void;\n}\n\nexport interface ReporterOptions {\n cwd?: string;\n verbose?: boolean;\n}\n\n// --- ANSI colouring -------------------------------------------------------\nconst useColor =\n !process.env.NO_COLOR && (process.stdout.isTTY ?? false) === true;\n\nconst wrap = (open: number, close: number) => (s: string) =>\n useColor ? `\\x1b[${open}m${s}\\x1b[${close}m` : s;\n\nconst c = {\n green: wrap(32, 39),\n red: wrap(31, 39),\n yellow: wrap(33, 39),\n dim: wrap(2, 22),\n bold: wrap(1, 22),\n};\n\nconst STATUS_MARK: Record<StepResult[\"status\"], string> = {\n passed: c.green(\"✓\"),\n failed: c.red(\"✗\"),\n skipped: c.yellow(\"-\"),\n};\n\n/** ✓ / ✗ / - for a whole scenario (skipped = every step skipped). */\nfunction scenarioMark(result: ScenarioResult): string {\n if (result.status === \"failed\") return c.red(\"✗\");\n if (result.steps.every(s => s.status === \"skipped\")) return c.yellow(\"-\");\n return c.green(\"✓\");\n}\n\n/** Dot per scenario for the live heartbeat: `.` pass / `F` fail / `-` skip. */\nfunction scenarioDot(result: ScenarioResult): string {\n if (result.status === \"failed\") return c.red(\"F\");\n if (result.steps.every(s => s.status === \"skipped\")) return c.yellow(\"-\");\n return c.green(\".\");\n}\n\n/** Indent every non-empty line of a block by `pad` spaces. */\nfunction indent(text: string, pad: number): string {\n const prefix = \" \".repeat(pad);\n return text\n .split(\"\\n\")\n .map(line => (line ? prefix + line : line))\n .join(\"\\n\");\n}\n\n/**\n * The error, trimmed to user frames: `Name: message` followed by only the\n * caller's own stack frames (library/engine and `node_modules` frames removed),\n * source-mapped by Bun to the original `.ts`. Falls back to just the message\n * when nothing user-owned is left (e.g. an undefined-step error).\n */\nfunction renderError(error: Error, cwd: string): string {\n const header = `${error.name}: ${error.message}`;\n const frames = userFrames(error.stack).map(\n f => ` at ${relativeFrame(f, cwd)}`\n );\n return frames.length ? `${header}\\n${frames.join(\"\\n\")}` : header;\n}\n\n/**\n * The detail block shown beneath a failing step: the `.feature` line, the step\n * definition location, and the trimmed error — the two coordinates that make a\n * failure easy to chase (where in the feature, which step definition).\n */\nfunction failureDetail(\n stepResult: StepResult,\n result: ScenarioResult,\n cwd: string\n): string {\n const lines = [\n `feature: ${relative(cwd, result.scenario.file)}:${stepResult.step.line}`,\n ];\n if (stepResult.source) {\n lines.push(`defined: ${relativeLocation(stepResult.source, cwd)}`);\n }\n if (stepResult.error) lines.push(renderError(stepResult.error, cwd));\n return indent(c.red(lines.join(\"\\n\")), 6);\n}\n\n/**\n * One scenario as a Cucumber-style block: a marked header with its `.feature`\n * location, then each step with its mark (and, in `verbose`, the step\n * definition location as a trailing comment). A failing step is followed by its\n * failure detail; a scenario-level error (a failing hook, no step to blame) is\n * appended at the end.\n */\nfunction renderScenario(\n result: ScenarioResult,\n cwd: string,\n opts: { stepSource: boolean }\n): string {\n const label = result.scenario.outline\n ? `${result.scenario.outline.name} › ${result.scenario.name}`\n : result.scenario.name;\n const lines: string[] = [`${scenarioMark(result)} ${c.bold(label)}`];\n\n const loc = result.scenario.line\n ? `${relative(cwd, result.scenario.file)}:${result.scenario.line}`\n : relative(cwd, result.scenario.file);\n lines.push(indent(c.dim(loc), 4));\n lines.push(\"\");\n\n for (const step of result.scenario.steps) {\n const sr = result.steps.find(s => s.step === step);\n const status = sr?.status ?? \"skipped\";\n const comment =\n opts.stepSource && sr?.source\n ? c.dim(` # ${relativeLocation(sr.source, cwd)}`)\n : \"\";\n lines.push(\n ` ${STATUS_MARK[status]} ${c.dim(step.effectiveKeyword)} ${step.text}${comment}`\n );\n if (sr?.status === \"failed\") lines.push(failureDetail(sr, result, cwd));\n }\n\n // A hook failure has no failing step; surface its error at scenario level.\n const stepFailed = result.steps.some(s => s.status === \"failed\");\n if (result.error && !stepFailed) {\n lines.push(indent(c.red(renderError(result.error, cwd)), 4));\n }\n\n return lines.join(\"\\n\");\n}\n\n// --- Summary --------------------------------------------------------------\ninterface Totals {\n scenarios: { passed: number; failed: number; skipped: number };\n steps: { passed: number; failed: number; skipped: number };\n}\n\nfunction tally(results: ScenarioResult[]): Totals {\n const totals: Totals = {\n scenarios: { passed: 0, failed: 0, skipped: 0 },\n steps: { passed: 0, failed: 0, skipped: 0 },\n };\n for (const result of results) {\n if (result.status === \"failed\") totals.scenarios.failed++;\n else if (result.steps.every(s => s.status === \"skipped\"))\n totals.scenarios.skipped++;\n else totals.scenarios.passed++;\n for (const step of result.steps) totals.steps[step.status]++;\n }\n return totals;\n}\n\nfunction renderSummary(results: ScenarioResult[], durationMs: number): string {\n const t = tally(results);\n const scenarioTotal =\n t.scenarios.passed + t.scenarios.failed + t.scenarios.skipped;\n const stepTotal = t.steps.passed + t.steps.failed + t.steps.skipped;\n\n const part = (n: number, label: string, color: (s: string) => string) =>\n n > 0 ? color(`${n} ${label}`) : null;\n\n const line = (\n total: number,\n noun: string,\n counts: { passed: number; failed: number; skipped: number }\n ) => {\n const parts = [\n part(counts.passed, \"passed\", c.green),\n part(counts.failed, \"failed\", c.red),\n part(counts.skipped, \"skipped\", c.yellow),\n ].filter((x): x is string => x !== null);\n return `${total} ${noun}${total === 1 ? \"\" : \"s\"} (${parts.join(\", \")})`;\n };\n\n return [\n line(scenarioTotal, \"scenario\", t.scenarios),\n line(stepTotal, \"step\", t.steps),\n c.dim(`${(durationMs / 1000).toFixed(2)}s`),\n ].join(\"\\n\");\n}\n\nfunction write(text: string): void {\n process.stdout.write(text);\n}\n\n/** Feature-grouped tree of every scenario (used by `--verbose`). */\nfunction renderFullTree(results: ScenarioResult[], cwd: string): string {\n const groups = new Map<string, ScenarioResult[]>();\n for (const r of results) {\n const bucket = groups.get(r.scenario.file) ?? [];\n bucket.push(r);\n groups.set(r.scenario.file, bucket);\n }\n const out: string[] = [];\n for (const [file, group] of groups) {\n out.push(c.bold(`Feature: ${relative(cwd, file)}`), \"\");\n for (const r of group)\n out.push(indent(renderScenario(r, cwd, { stepSource: true }), 2), \"\");\n }\n return out.join(\"\\n\");\n}\n\n/** The failing scenarios only (used by the default, non-verbose output). */\nfunction renderFailures(results: ScenarioResult[], cwd: string): string {\n const failed = results.filter(r => r.status === \"failed\");\n if (!failed.length) return \"\";\n return (\n failed\n .map(r => renderScenario(r, cwd, { stepSource: false }))\n .join(\"\\n\\n\") + \"\\n\\n\"\n );\n}\n\n/**\n * Default reporter. Non-verbose: a dot per scenario as a heartbeat, then the\n * failing scenarios in Cucumber-style detail, then the summary. Verbose: the\n * full feature → scenario → step tree instead of just failures.\n */\nexport function prettyReporter(opts: ReporterOptions = {}): Reporter {\n const cwd = opts.cwd ?? process.cwd();\n const verbose = opts.verbose ?? false;\n return {\n onScenarioEnd(result) {\n if (!verbose) write(scenarioDot(result));\n },\n onComplete(results, durationMs) {\n const body = verbose\n ? `\\n${renderFullTree(results, cwd)}\\n`\n : `\\n\\n${renderFailures(results, cwd)}`;\n write(`${body}${renderSummary(results, durationMs)}\\n`);\n },\n };\n}\n\n/**\n * Compact reporter: a dot per scenario, then failures in detail and the\n * summary. Always minimal — `verbose` is accepted for interface parity but does\n * not expand the output (use `pretty --verbose` for the full tree).\n */\nexport function progressReporter(opts: ReporterOptions = {}): Reporter {\n const cwd = opts.cwd ?? process.cwd();\n return {\n onScenarioEnd(result) {\n write(scenarioDot(result));\n },\n onComplete(results, durationMs) {\n write(\n `\\n\\n${renderFailures(results, cwd)}${renderSummary(results, durationMs)}\\n`\n );\n },\n };\n}\n\nexport function makeReporter(\n name: \"pretty\" | \"progress\",\n opts: ReporterOptions = {}\n): Reporter {\n return name === \"progress\" ? progressReporter(opts) : prettyReporter(opts);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { ParsedScenario } from \"../analyzer/types\";\nimport { parseFeatureFiles } from \"../analyzer/gherkinParser\";\nimport { globFiles } from \"../globFiles\";\nimport { BasicWorld, MergeableWorld } from \"../world\";\nimport {\n compileRegistry,\n CompiledStep,\n runScenario,\n ScenarioResult,\n} from \"./engine\";\nimport { globalHookRegistry, runHooks, runHooksParallel } from \"./hooks\";\nimport { globalRegistry } from \"./registry\";\nimport { selectScenarios } from \"./filter\";\nimport { makeReporter, Reporter } from \"./reporters\";\nimport { ResolvedConfig } from \"./config\";\n\ntype WorldFactory = () => MergeableWorld<any, any, any>;\n\n/**\n * Import every step-definition module so its `.step(...)` calls self-register\n * into the shared `globalRegistry`. Imported by file URL so Bun transpiles the\n * TypeScript natively.\n */\nasync function importSteps(files: string[]): Promise<void> {\n for (const file of files) {\n await import(pathToFileURL(file).href);\n }\n}\n\n/** Load the configured world factory, or default to a fresh `BasicWorld`. */\nasync function loadWorldFactory(\n world: string | undefined,\n cwd: string\n): Promise<WorldFactory> {\n if (!world) return () => new BasicWorld();\n const resolved = path.resolve(cwd, world);\n const mod = await import(pathToFileURL(resolved).href);\n const factory = mod.default ?? mod;\n if (typeof factory !== \"function\") {\n throw new Error(\n `World module ${world} must default-export a factory function () => world`\n );\n }\n return factory as WorldFactory;\n}\n\n/** A scenario carrying `@skip` never runs: report it with all steps skipped. */\nfunction skippedResult(scenario: ParsedScenario): ScenarioResult {\n return {\n scenario,\n status: \"passed\",\n steps: scenario.steps.map(step => ({ step, status: \"skipped\" as const })),\n };\n}\n\n/**\n * Run `items` through `worker`, at most `limit` in flight. Results come back in\n * input order even though completion order is not deterministic. A minimal\n * dependency-free pool — the whole point of the single-process model.\n */\nasync function runPool<T, R>(\n items: T[],\n limit: number,\n worker: (item: T, index: number) => Promise<R>\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n let cursor = 0;\n const runNext = async (): Promise<void> => {\n while (cursor < items.length) {\n const index = cursor++;\n results[index] = await worker(items[index], index);\n }\n };\n const workers = Array.from(\n { length: Math.min(Math.max(1, limit), items.length) },\n runNext\n );\n await Promise.all(workers);\n return results;\n}\n\nexport interface RunResult {\n results: ScenarioResult[];\n passed: boolean;\n durationMs: number;\n}\n\n/**\n * Execute a whole run end to end: discover and import steps, load the world,\n * parse and select scenarios, then run them concurrently against a\n * compiled-once step table with global/feature hooks around the batch. Never\n * throws for test failures — inspect `RunResult.passed`.\n */\nexport async function run(\n config: ResolvedConfig,\n reporter: Reporter = makeReporter(config.reporter, {\n cwd: config.cwd,\n verbose: config.verbose,\n })\n): Promise<RunResult> {\n const start =\n typeof performance !== \"undefined\" ? performance.now() : Date.now();\n\n const [featureFiles, stepFiles] = await Promise.all([\n globFiles(config.features, config.cwd),\n globFiles(config.steps, config.cwd),\n ]);\n\n await importSteps(stepFiles);\n const makeWorld = await loadWorldFactory(config.world, config.cwd);\n\n const compiled: CompiledStep[] = compileRegistry(globalRegistry);\n const allScenarios = parseFeatureFiles(featureFiles);\n const selected = selectScenarios(allScenarios, {\n name: config.name,\n tags: config.tags,\n });\n\n // Global `beforeAll` hooks run once, in parallel, before any scenario starts;\n // feature before/after bracket the whole batch inside them. (Hooks aren't\n // file-scoped in the registry, so per-file bracketing would be meaningless\n // under concurrent execution.)\n await runHooksParallel(\"global\", \"before\", globalHookRegistry);\n await runHooks(\"feature\", \"before\", globalHookRegistry);\n\n const results = await runPool(\n selected,\n config.concurrency,\n async scenario => {\n const result = scenario.tags.includes(\"@skip\")\n ? skippedResult(scenario)\n : await runScenario(scenario, compiled, makeWorld, globalHookRegistry);\n reporter.onScenarioEnd?.(result);\n return result;\n }\n );\n\n await runHooks(\"feature\", \"after\", globalHookRegistry);\n // Global `afterAll` hooks run once, in parallel, after every scenario is done.\n await runHooksParallel(\"global\", \"after\", globalHookRegistry);\n\n const durationMs =\n (typeof performance !== \"undefined\" ? performance.now() : Date.now()) -\n start;\n reporter.onComplete(results, durationMs);\n\n return {\n results,\n passed: results.every(r => r.status !== \"failed\"),\n durationMs,\n };\n}\n","import * as readline from \"node:readline\";\n\n/**\n * A hand-rolled, dependency-free typeahead prompt for interactive mode. It owns\n * the terminal's raw-mode input and renders a block pinned to the bottom of the\n * screen: a scrollable list of suggestions above a `> query` input line. Run\n * output is meant to scroll *above* this block — {@link Prompt.printAbove} erases\n * the block, lets a caller write, then redraws it lower down.\n *\n * The prompt is pure view + input: it filters/ranks {@link Suggestion}s by the\n * typed query and reports intent through callbacks ({@link PromptHandlers}), but\n * holds no run/watch logic. The orchestrator wires those callbacks.\n */\nexport interface Suggestion {\n /** Human label shown after the badge, e.g. a scenario name. */\n label: string;\n /** Short kind marker shown before the label, e.g. `#tag` / `feature`. */\n badge: string;\n /** Text the query is matched against (case-insensitively). */\n search: string;\n /** Opaque payload handed back to {@link PromptHandlers.onSubmit}. */\n value: unknown;\n}\n\nexport interface PromptHandlers {\n /** Enter: `value` is the highlighted suggestion, or `null` when none matches. */\n onSubmit(value: unknown | null, query: string): void;\n /** The query text changed (insert/delete) — used to suspend auto-runs. */\n onEdit(query: string): void;\n /** Escape pressed. */\n onEscape(): void;\n /** Ctrl-C / Ctrl-D — the caller should tear down and exit. */\n onQuit(): void;\n}\n\nexport interface PromptOptions {\n handlers: PromptHandlers;\n /** Input prefix. Default `\"› \"`. */\n prefix?: string;\n /** Max suggestion rows shown at once. Default `10`. */\n maxVisible?: number;\n /** Initial query text. */\n initialQuery?: string;\n}\n\n// --- ANSI ------------------------------------------------------------------\nconst useColor =\n !process.env.NO_COLOR && (process.stdout.isTTY ?? false) === true;\nconst wrap = (open: number, close: number) => (s: string) =>\n useColor ? `\\x1b[${open}m${s}\\x1b[${close}m` : s;\nconst color = {\n green: wrap(32, 39),\n cyan: wrap(36, 39),\n dim: wrap(2, 22),\n bold: wrap(1, 22),\n inverse: wrap(7, 27),\n};\n\n/** Ranked match: lower rank sorts first; `-1` means \"no match\" (excluded). */\nfunction rank(search: string, query: string): number {\n if (!query) return 0;\n const idx = search.indexOf(query);\n if (idx === -1) return -1;\n if (idx === 0) return 0; // prefix\n // word-boundary (space, `:`, `›`, `@`) scores above a bare substring.\n return /[\\s:›@/]/.test(search[idx - 1]) ? 1 : 2;\n}\n\nexport class Prompt {\n private readonly handlers: PromptHandlers;\n private readonly prefix: string;\n private readonly maxVisible: number;\n\n private all: Suggestion[] = [];\n private matches: Suggestion[] = [];\n private query: string;\n private cursor: number; // caret index within `query`\n private selected = 0; // index into `matches`\n private window = 0; // first visible match index\n\n /** Optional dim status line shown just above the input (set by the caller). */\n status = \"\";\n\n /** Lines the pinned block currently occupies, so a redraw can erase them. */\n private rendered = 0;\n private started = false;\n /** While true the block is hidden so a run's output can own the screen. */\n private suspended = false;\n private keyListener?: (str: string, key: readline.Key) => void;\n\n constructor(options: PromptOptions) {\n this.handlers = options.handlers;\n this.prefix = options.prefix ?? \"› \";\n this.maxVisible = options.maxVisible ?? 10;\n this.query = options.initialQuery ?? \"\";\n this.cursor = this.query.length;\n }\n\n /** Replace the suggestion pool (e.g. after the feature cache rebuilds). */\n setSuggestions(suggestions: Suggestion[]): void {\n this.all = suggestions;\n this.refilter();\n if (this.started) this.render();\n }\n\n get value(): string {\n return this.query;\n }\n\n /** Enter raw mode, attach the keypress listener, and draw the block. */\n start(): void {\n if (this.started) return;\n this.started = true;\n readline.emitKeypressEvents(process.stdin);\n if (process.stdin.isTTY) process.stdin.setRawMode(true);\n this.keyListener = (str, key) => this.onKey(str, key ?? {});\n process.stdin.on(\"keypress\", this.keyListener);\n process.stdin.resume();\n this.render();\n }\n\n /** Erase the block, restore cooked mode, and detach the listener. */\n stop(): void {\n if (!this.started) return;\n this.started = false;\n this.erase();\n write(\"\\x1b[?25h\"); // ensure the cursor is visible again\n if (this.keyListener) process.stdin.off(\"keypress\", this.keyListener);\n if (process.stdin.isTTY) process.stdin.setRawMode(false);\n process.stdin.pause();\n }\n\n /**\n * Erase the pinned block and hide it for the duration of an (async) run, so\n * everything written to stdout in the meantime scrolls where the prompt was.\n * Keypresses still update state but don't repaint until {@link endOutput}.\n */\n beginOutput(): void {\n if (!this.started) return;\n this.erase();\n this.suspended = true;\n }\n\n /** Redraw the pinned block below whatever output {@link beginOutput} let through. */\n endOutput(): void {\n if (!this.started) return;\n this.suspended = false;\n this.render();\n }\n\n /** Force a redraw (after mutating `status`, say). No-op while suspended. */\n redraw(): void {\n if (this.started && !this.suspended) this.render();\n }\n\n // --- input ---------------------------------------------------------------\n private onKey(str: string, key: readline.Key): void {\n if (key.ctrl && (key.name === \"c\" || key.name === \"d\")) {\n this.handlers.onQuit();\n return;\n }\n switch (key.name) {\n case \"return\":\n case \"enter\": {\n const value = this.matches[this.selected]?.value ?? null;\n this.handlers.onSubmit(value, this.query);\n return;\n }\n case \"escape\":\n this.handlers.onEscape();\n return;\n case \"up\":\n this.move(-1);\n return;\n case \"down\":\n this.move(1);\n return;\n case \"left\":\n this.cursor = Math.max(0, this.cursor - 1);\n this.render();\n return;\n case \"right\":\n this.cursor = Math.min(this.query.length, this.cursor + 1);\n this.render();\n return;\n case \"home\":\n this.cursor = 0;\n this.render();\n return;\n case \"end\":\n this.cursor = this.query.length;\n this.render();\n return;\n case \"backspace\":\n this.deleteBefore();\n return;\n case \"delete\":\n this.deleteAfter();\n return;\n }\n // Any single printable character (space included) is inserted.\n if (str && str.length === 1 && str >= \" \" && !key.ctrl && !key.meta) {\n this.insert(str);\n }\n }\n\n private insert(ch: string): void {\n this.query =\n this.query.slice(0, this.cursor) + ch + this.query.slice(this.cursor);\n this.cursor += ch.length;\n this.afterEdit();\n }\n\n private deleteBefore(): void {\n if (this.cursor === 0) return;\n this.query =\n this.query.slice(0, this.cursor - 1) + this.query.slice(this.cursor);\n this.cursor--;\n this.afterEdit();\n }\n\n private deleteAfter(): void {\n if (this.cursor >= this.query.length) return;\n this.query =\n this.query.slice(0, this.cursor) + this.query.slice(this.cursor + 1);\n this.afterEdit();\n }\n\n private afterEdit(): void {\n this.refilter();\n this.render();\n this.handlers.onEdit(this.query);\n }\n\n private move(delta: number): void {\n if (this.matches.length === 0) return;\n this.selected = Math.min(\n this.matches.length - 1,\n Math.max(0, this.selected + delta)\n );\n this.reWindow();\n this.render();\n }\n\n private refilter(): void {\n const q = this.query.trim().toLowerCase();\n this.matches = this.all\n .map((s, index) => ({ s, index, r: rank(s.search, q) }))\n .filter(m => m.r !== -1)\n .sort((a, b) => a.r - b.r || a.index - b.index)\n .map(m => m.s);\n this.selected = 0;\n this.window = 0;\n }\n\n private reWindow(): void {\n if (this.selected < this.window) this.window = this.selected;\n else if (this.selected >= this.window + this.maxVisible)\n this.window = this.selected - this.maxVisible + 1;\n }\n\n // --- rendering -----------------------------------------------------------\n /** Build the block's lines, top (suggestions) to bottom (input). */\n private buildLines(): string[] {\n const lines: string[] = [];\n const total = this.matches.length;\n\n if (this.query.trim() && total === 0) {\n lines.push(color.dim(\" no matching tag, feature, or scenario\"));\n }\n\n const end = Math.min(this.window + this.maxVisible, total);\n for (let i = this.window; i < end; i++) {\n const s = this.matches[i];\n const active = i === this.selected;\n const badge = color.cyan(s.badge.padEnd(9));\n const row = `${badge} ${s.label}`;\n lines.push(active ? color.inverse(`❯ ${row}`) : ` ${row}`);\n }\n if (total > end) {\n lines.push(color.dim(` …and ${total - end} more`));\n }\n\n if (this.status) lines.push(color.dim(this.status));\n lines.push(`${color.bold(this.prefix)}${this.query}`);\n return lines;\n }\n\n private render(): void {\n if (this.suspended) return; // a run owns the screen; don't repaint over it\n write(\"\\x1b[?25l\"); // hide caret while we repaint\n this.moveToBlockStart();\n write(\"\\x1b[0J\"); // clear from here to end of screen\n const lines = this.buildLines();\n write(lines.join(\"\\r\\n\"));\n this.rendered = lines.length;\n // Park the caret on the input line at the right column.\n write(`\\r\\x1b[${stringWidth(this.prefix) + this.cursor}C`);\n write(\"\\x1b[?25h\");\n }\n\n /** Erase the block and leave the caret at the block's top-left. */\n private erase(): void {\n this.moveToBlockStart();\n write(\"\\x1b[0J\");\n this.rendered = 0;\n }\n\n /** Move the caret to column 0 of the block's first line. */\n private moveToBlockStart(): void {\n if (this.rendered > 1) write(`\\x1b[${this.rendered - 1}A`);\n write(\"\\r\");\n }\n}\n\n/** Visible width, ignoring the ANSI escapes our color helpers may inject. */\nfunction stringWidth(s: string): number {\n // eslint-disable-next-line no-control-regex\n return s.replace(/\\x1b\\[[0-9;]*m/g, \"\").length;\n}\n\nfunction write(s: string): void {\n process.stdout.write(s);\n}\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\n/** Glob metacharacters — the same set {@link globFiles} treats as \"magic\". */\nconst MAGIC = /[*?[\\]{}!()]/;\n\n/** File extensions worth reacting to: features and step/world modules. */\nconst WATCHED_EXT = /\\.(feature|ts|mts|js|mjs|cts|cjs)$/;\n\nexport interface Watcher {\n /** Stop watching and release every underlying `fs.watch` handle. */\n close(): void;\n}\n\n/**\n * Watch the directories implied by feature/step globs and invoke `onChange`\n * (debounced, coalesced) whenever a relevant file changes. Roots are the literal\n * directory prefixes of each glob — e.g. `features/**\\/*.feature` watches\n * `features/` recursively — deduped so nested roots aren't watched twice.\n *\n * Recursive watching is supported on macOS and Windows and on modern Linux\n * (Node ≥ 20 / Bun); on older Linux only the top level of each root is seen.\n */\nexport function watchFeatures(\n globs: string[],\n cwd: string,\n onChange: () => void,\n debounceMs = 120\n): Watcher {\n const roots = watchRoots(globs, cwd);\n const watchers: fs.FSWatcher[] = [];\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const schedule = (filename: string | null) => {\n // `fs.watch` may report a null filename; when we do get one, ignore churn\n // from unrelated files (editor swap files, `.git`, build output).\n if (filename && !WATCHED_EXT.test(filename)) return;\n if (timer) clearTimeout(timer);\n timer = setTimeout(onChange, debounceMs);\n };\n\n for (const root of roots) {\n try {\n const w = fs.watch(root, { recursive: true }, (_event, filename) =>\n schedule(filename)\n );\n w.on(\"error\", () => {}); // a removed/renamed root shouldn't crash the loop\n watchers.push(w);\n } catch {\n // Root doesn't exist yet (or can't be watched) — skip it silently.\n }\n }\n\n return {\n close() {\n if (timer) clearTimeout(timer);\n for (const w of watchers) w.close();\n },\n };\n}\n\n/**\n * The set of directories to watch: each glob's literal prefix (the path up to\n * its first magic character), resolved against `cwd`, deduped, with any root\n * that nests inside another dropped. Falls back to `cwd` when nothing resolves.\n */\nexport function watchRoots(globs: string[], cwd: string): string[] {\n const dirs = new Set<string>();\n for (const glob of globs) {\n dirs.add(path.resolve(cwd, literalPrefix(glob)));\n }\n const roots = [...dirs].sort();\n // Drop any root contained in an earlier (shorter) one, so recursive watches\n // don't overlap.\n const pruned = roots.filter(\n (r, i) => !roots.some((other, j) => j < i && isInside(r, other))\n );\n return pruned.length ? pruned : [cwd];\n}\n\n/** The directory portion of a glob before its first magic segment. */\nfunction literalPrefix(glob: string): string {\n const segments = glob.split(\"/\");\n const literal: string[] = [];\n for (const seg of segments) {\n if (MAGIC.test(seg)) break;\n literal.push(seg);\n }\n const joined = literal.join(\"/\");\n // A bare `*.feature` has no literal prefix → watch cwd (\".\").\n if (!joined) return \".\";\n // If the whole pattern was literal it points at a file; watch its directory.\n return MAGIC.test(glob) ? joined : path.dirname(joined);\n}\n\n/** True when `child` is `parent` itself or nested beneath it. */\nfunction isInside(child: string, parent: string): boolean {\n if (child === parent) return true;\n const rel = path.relative(parent, child);\n return !!rel && !rel.startsWith(\"..\") && !path.isAbsolute(rel);\n}\n","import { spawn } from \"node:child_process\";\nimport * as path from \"node:path\";\nimport { ParsedScenario } from \"../analyzer/types\";\nimport { ParsedFeature, parseFeatureCatalog } from \"../analyzer/gherkinParser\";\nimport { globFiles } from \"../globFiles\";\nimport { ResolvedConfig } from \"./config\";\nimport { Prompt, Suggestion } from \"./prompt\";\nimport { watchFeatures, Watcher } from \"./watcher\";\n\n/**\n * A population the user can pick and run: a whole tag, a whole feature file, a\n * single scenario, or a whole scenario outline (all its example rows). Scenarios\n * and outlines are keyed by name — an outline is one choice that runs every row —\n * so selection is stable across edits that shift line numbers. Resolved against\n * the freshly-parsed features on every run.\n */\ntype Choice =\n | { kind: \"tag\"; tag: string }\n | { kind: \"feature\"; file: string; name: string }\n | { kind: \"scenario\"; file: string; name: string };\n\nconst useColor =\n !process.env.NO_COLOR && (process.stdout.isTTY ?? false) === true;\nconst bold = (s: string) => (useColor ? `\\x1b[1m${s}\\x1b[22m` : s);\nconst dim = (s: string) => (useColor ? `\\x1b[2m${s}\\x1b[22m` : s);\nconst red = (s: string) => (useColor ? `\\x1b[31m${s}\\x1b[39m` : s);\nconst yellow = (s: string) => (useColor ? `\\x1b[33m${s}\\x1b[39m` : s);\n\n/**\n * Entry point for `step-forge -i`. Brings up the always-live typeahead prompt,\n * watches the configured feature/step directories, and re-runs the armed\n * population on every relevant file change. Requires a TTY.\n */\nexport async function runInteractive(config: ResolvedConfig): Promise<void> {\n if (!process.stdin.isTTY) {\n process.stderr.write(\n \"Interactive mode (-i) requires a TTY; stdin is not a terminal.\\n\"\n );\n process.exitCode = 1;\n return;\n }\n await new InteractiveSession(config).start();\n}\n\nclass InteractiveSession {\n private readonly config: ResolvedConfig;\n private readonly prompt: Prompt;\n private watcher?: Watcher;\n private catalog: ParsedFeature[] = [];\n\n // State machine: `armed` is the committed population; `dirty` means the query\n // was edited since the last commit, which suspends file-change re-runs.\n private armed: Choice | null = null;\n private dirty = false;\n private running = false;\n private rerunQueued = false;\n /** Increments per run so back-to-back identical output is still distinguishable. */\n private runCount = 0;\n\n private done!: () => void;\n\n constructor(config: ResolvedConfig) {\n this.config = config;\n this.prompt = new Prompt({\n initialQuery: config.tags ?? config.name ?? \"\",\n handlers: {\n onSubmit: value => this.onSubmit(value),\n onEdit: () => this.onEdit(),\n onEscape: () => this.onEscape(),\n onQuit: () => this.onQuit(),\n },\n });\n }\n\n async start(): Promise<void> {\n await this.rebuildCatalog();\n this.prompt.status = this.status();\n this.prompt.start();\n this.watcher = watchFeatures(\n [...this.config.features, ...this.config.steps],\n this.config.cwd,\n () => void this.onFsChange()\n );\n await new Promise<void>(resolve => {\n this.done = resolve;\n });\n }\n\n // --- prompt events -------------------------------------------------------\n private onSubmit(value: unknown | null): void {\n if (!value) return; // nothing highlighted (empty query / no matches)\n this.armed = value as Choice;\n this.dirty = false;\n this.prompt.status = this.status();\n this.triggerRun();\n }\n\n private onEdit(): void {\n // Editing the query suspends auto-runs until the next Enter re-commits.\n if (this.armed) this.dirty = true;\n this.prompt.status = this.status();\n this.prompt.redraw();\n }\n\n private onEscape(): void {\n if (!this.armed) return;\n this.armed = null;\n this.dirty = false;\n this.prompt.status = this.status();\n this.prompt.redraw();\n }\n\n private onQuit(): void {\n this.watcher?.close();\n this.prompt.stop();\n process.stdout.write(\"\\n\");\n process.exitCode = 0;\n this.done?.();\n }\n\n // --- filesystem watch ----------------------------------------------------\n private async onFsChange(): Promise<void> {\n await this.rebuildCatalog();\n if (this.armed && !this.dirty) this.triggerRun();\n }\n\n private async rebuildCatalog(): Promise<void> {\n try {\n const featureFiles = await globFiles(\n this.config.features,\n this.config.cwd\n );\n this.catalog = parseFeatureCatalog(featureFiles);\n } catch {\n // A half-written feature mid-save may fail to parse; keep the old cache.\n }\n this.prompt.setSuggestions(buildSuggestions(this.catalog));\n }\n\n // --- run cycle -----------------------------------------------------------\n private triggerRun(): void {\n if (!this.armed) return;\n if (this.running) {\n this.rerunQueued = true; // coalesce: run once more when the current ends\n return;\n }\n this.running = true;\n this.prompt.beginOutput();\n void this.runLoop();\n }\n\n private async runLoop(): Promise<void> {\n try {\n do {\n this.rerunQueued = false;\n if (this.armed) await this.executeOnce(this.armed);\n } while (this.rerunQueued && this.armed && !this.dirty);\n } catch (err) {\n process.stdout.write(\n red(`\\n run failed: ${err instanceof Error ? err.message : err}\\n`)\n );\n } finally {\n this.running = false;\n this.prompt.status = this.status();\n this.prompt.endOutput(); // redraws the prompt below the run's output\n }\n }\n\n /**\n * One run of `choice`: resolve its scenarios against the current parse, then\n * shell out to a **fresh** `step-forge` process scoped to just that\n * population. A child process is used deliberately — Bun caches ES modules for\n * the life of a process and ignores query-string cache-busting, so re-running\n * in-process would never pick up edited step code. A new process re-reads\n * every step/feature file, which is exactly what a watch loop needs.\n */\n private async executeOnce(choice: Choice): Promise<void> {\n const selected = resolveScenarios(choice, this.scenarios());\n\n const count = `${selected.length} scenario${selected.length === 1 ? \"\" : \"s\"}`;\n process.stdout.write(\n `\\n${bold(`▶ ${choiceLabel(choice)}`)} ${dim(\n `(${count} · run #${++this.runCount} · ${clock()})`\n )}\\n\\n`\n );\n\n if (selected.length === 0) {\n process.stdout.write(yellow(\" no scenarios match this selection\\n\"));\n return;\n }\n\n // A single scenario is analyzed (dependency/undefined/ambiguous checks) and\n // run verbose; a broader population uses the configured reporter.\n const single = selected.length === 1;\n if (single) await this.analyzeScenario(selected[0]);\n\n await this.spawnRun(runArgs(choice, single, this.config));\n }\n\n /** Every scenario across the current catalog, flattened. */\n private scenarios(): ParsedScenario[] {\n return this.catalog.flatMap(f => f.scenarios);\n }\n\n /**\n * Run `step-forge` as a child process with `args`, streaming its output to the\n * terminal (where the erased prompt was). Re-invokes the very CLI that's\n * running us (`process.execPath` + `argv[1]`), so it works identically from\n * the source tree and the built bin. Never rejects — a spawn error is reported\n * and swallowed so the watch loop survives.\n */\n private spawnRun(args: string[]): Promise<void> {\n return new Promise(resolve => {\n const child = spawn(process.execPath, [process.argv[1], ...args], {\n cwd: this.config.cwd,\n // Own stdin ourselves (raw-mode prompt); let the child inherit our\n // stdout/stderr so its reporter output lands above the prompt live.\n stdio: [\"ignore\", \"inherit\", \"inherit\"],\n });\n child.on(\"error\", err => {\n process.stdout.write(red(` could not start runner: ${err.message}\\n`));\n resolve();\n });\n child.on(\"close\", () => resolve());\n });\n }\n\n /**\n * Run the static analyzer over a single scenario and print any dependency /\n * undefined / ambiguous diagnostics. The analyzer needs the optional\n * `typescript` peer for AST extraction; if it's absent we note that and skip,\n * never failing the run.\n */\n private async analyzeScenario(scenario: ParsedScenario): Promise<void> {\n let analyzer: typeof import(\"../analyzer/index\");\n try {\n analyzer = await import(\"../analyzer/index\");\n } catch {\n process.stdout.write(\n dim(\" analysis skipped: install `typescript` to enable it\\n\\n\")\n );\n return;\n }\n try {\n const stepFiles = await globFiles(this.config.steps, this.config.cwd);\n const defs = analyzer.extractStepDefinitions(stepFiles);\n const matched = analyzer.matchScenarioSteps(scenario, defs);\n const diagnostics = analyzer.defaultRules.flatMap(rule =>\n rule.check(scenario, matched)\n );\n printDiagnostics(diagnostics, this.config.cwd);\n } catch (err) {\n process.stdout.write(\n dim(\n ` analysis unavailable: ${err instanceof Error ? err.message : err}\\n\\n`\n )\n );\n }\n }\n\n // --- status line ---------------------------------------------------------\n private status(): string {\n if (!this.armed) {\n return \" type to filter · ↑↓ move · enter run · ctrl-c quit\";\n }\n if (this.dirty) {\n return \" ⏸ suspended (query edited) · enter runs the selection · esc cancel\";\n }\n return ` ▶ watching ${choiceLabel(this.armed)} · save a file to re-run · enter forces · esc change · ctrl-c quit`;\n }\n}\n\n// --- choices ---------------------------------------------------------------\n/** Build the typeahead pool: every tag, feature, and scenario in the catalog. */\nfunction buildSuggestions(catalog: ParsedFeature[]): Suggestion[] {\n const suggestions: Suggestion[] = [];\n\n const tags = new Set<string>();\n for (const feature of catalog) {\n for (const scenario of feature.scenarios) {\n for (const tag of scenario.tags) tags.add(tag);\n }\n }\n for (const tag of [...tags].sort()) {\n suggestions.push({\n badge: \"#tag\",\n label: tag,\n search: tag.toLowerCase(),\n value: { kind: \"tag\", tag } satisfies Choice,\n });\n }\n\n for (const feature of catalog) {\n const featureLabel = feature.name || path.basename(feature.file);\n suggestions.push({\n badge: \"feature\",\n label: featureLabel,\n search: `${feature.name} ${feature.file}`.toLowerCase(),\n value: {\n kind: \"feature\",\n file: feature.file,\n name: feature.name,\n } satisfies Choice,\n });\n\n // Each row of a scenario outline shares the outline's name; collapse them\n // into a single choice (selected by the outline name, which runs every row)\n // rather than one entry per row. Regular scenarios stay one entry each.\n const seen = new Set<string>();\n for (const scenario of feature.scenarios) {\n const name = scenario.outline ? scenario.outline.name : scenario.name;\n if (seen.has(name)) continue;\n seen.add(name);\n suggestions.push({\n badge: scenario.outline ? \"outline\" : \"scenario\",\n label: name,\n search: `${featureLabel} ${name}`.toLowerCase(),\n value: { kind: \"scenario\", file: scenario.file, name } satisfies Choice,\n });\n }\n }\n\n return suggestions;\n}\n\n/** Resolve a choice to its scenarios against the current parse. */\nfunction resolveScenarios(\n choice: Choice,\n scenarios: ParsedScenario[]\n): ParsedScenario[] {\n switch (choice.kind) {\n case \"tag\":\n return scenarios.filter(s => s.tags.includes(choice.tag));\n case \"feature\":\n return scenarios.filter(s => s.file === choice.file);\n case \"scenario\":\n // Matches a regular scenario by its name, or every row of an outline by\n // the shared outline name — mirroring the runner's `-n` (name || outline).\n return scenarios.filter(\n s =>\n s.file === choice.file &&\n (s.name === choice.name || s.outline?.name === choice.name)\n );\n }\n}\n\nfunction choiceLabel(choice: Choice): string {\n switch (choice.kind) {\n case \"tag\":\n return choice.tag;\n case \"feature\":\n return choice.name || path.basename(choice.file);\n case \"scenario\":\n return choice.name;\n }\n}\n\n/**\n * The `step-forge` argv that reproduces this selection in a child process. The\n * base flags forward the resolved config (steps/world/concurrency) so the child\n * matches the parent's setup regardless of its own config file; the scope flags\n * narrow to the chosen population:\n * - tag → all configured features, filtered by `-t <tag>`\n * - feature → that single feature file\n * - scenario → that feature file, name-anchored with `-n \"/^…$/\"` (the name is\n * the outline name for an outline, so all its rows run)\n * A single scenario runs verbose; a population uses the configured reporter.\n */\nfunction runArgs(\n choice: Choice,\n single: boolean,\n config: ResolvedConfig\n): string[] {\n const args: string[] = [];\n for (const glob of config.steps) args.push(\"-s\", glob);\n if (config.world) args.push(\"-w\", config.world);\n args.push(\"-c\", String(config.concurrency));\n\n switch (choice.kind) {\n case \"tag\":\n args.push(...config.features, \"-t\", choice.tag);\n break;\n case \"feature\":\n args.push(choice.file);\n break;\n case \"scenario\":\n args.push(choice.file, \"-n\", `/^${escapeRegExp(choice.name)}$/`);\n break;\n }\n\n if (single) {\n args.push(\"-v\");\n } else {\n args.push(\"-r\", config.reporter);\n if (config.verbose) args.push(\"-v\");\n }\n return args;\n}\n\n/** Escape a scenario name for use inside an anchored `-n` regex. */\nfunction escapeRegExp(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\n/** Local wall-clock time as `HH:MM:SS`, so each run's header is dated. */\nfunction clock(): string {\n const d = new Date();\n return [d.getHours(), d.getMinutes(), d.getSeconds()]\n .map(n => String(n).padStart(2, \"0\"))\n .join(\":\");\n}\n\n// --- diagnostics -----------------------------------------------------------\nfunction printDiagnostics(\n diagnostics: import(\"../analyzer/types\").Diagnostic[],\n cwd: string\n): void {\n if (diagnostics.length === 0) return; // clean scenario: say nothing, let the run speak\n process.stdout.write(bold(\" analyzer:\\n\"));\n for (const d of diagnostics) {\n const mark =\n d.severity === \"error\"\n ? red(\"✗\")\n : d.severity === \"warning\"\n ? yellow(\"!\")\n : dim(\"i\");\n const loc = `${path.relative(cwd, d.file)}:${d.range.startLine}`;\n process.stdout.write(` ${mark} ${d.message} ${dim(`(${loc})`)}\\n`);\n }\n process.stdout.write(\"\\n\");\n}\n","#!/usr/bin/env bun\nimport { parseArgs } from \"node:util\";\nimport * as path from \"node:path\";\nimport { loadConfigFile, resolveConfig, RunnerOptions } from \"./config\";\nimport { run } from \"./runner\";\nimport { runInteractive } from \"./interactive\";\n\nconst HELP = `step-forge — native TypeScript runner for Gherkin step definitions\n\nUsage:\n step-forge [options] [feature globs...]\n\nOptions:\n -t, --tags <expr> Tag expression, e.g. \"@smoke and not @wip\"\n -n, --name <pattern> Only scenarios whose name matches (substring or /regex/)\n -s, --steps <glob> Step-definition module glob (repeatable)\n -w, --world <module> World factory module (default export () => world)\n -c, --concurrency <n> Max scenarios in flight (default: 1, i.e. serial)\n -r, --reporter <name> \"pretty\" (default) or \"progress\"\n -v, --verbose Report every scenario, not just failures\n -i, --interactive Interactive watch mode: pick a tag/feature/scenario\n and re-run it on every file change\n --config <path> Config file directory (default: cwd)\n -h, --help Show this help\n\nPositional arguments are feature globs and override the configured features.\n`;\n\n/** Parse argv into config overrides. Positional args become feature globs. */\nfunction parseCli(argv: string[]): {\n cwd: string;\n overrides: RunnerOptions;\n interactive: boolean;\n} {\n const { values, positionals } = parseArgs({\n args: argv,\n allowPositionals: true,\n options: {\n tags: { type: \"string\", short: \"t\" },\n name: { type: \"string\", short: \"n\" },\n steps: { type: \"string\", short: \"s\", multiple: true },\n world: { type: \"string\", short: \"w\" },\n concurrency: { type: \"string\", short: \"c\" },\n reporter: { type: \"string\", short: \"r\" },\n verbose: { type: \"boolean\", short: \"v\" },\n interactive: { type: \"boolean\", short: \"i\" },\n config: { type: \"string\" },\n help: { type: \"boolean\", short: \"h\" },\n },\n });\n\n if (values.help) {\n process.stdout.write(HELP);\n process.exit(0);\n }\n\n const overrides: RunnerOptions = {};\n if (positionals.length) overrides.features = positionals;\n if (values.tags) overrides.tags = values.tags;\n if (values.name) overrides.name = values.name;\n if (values.steps) overrides.steps = values.steps;\n if (values.world) overrides.world = values.world;\n if (values.verbose) overrides.verbose = true;\n if (values.reporter) {\n if (values.reporter !== \"pretty\" && values.reporter !== \"progress\") {\n throw new Error(`Unknown reporter: ${values.reporter}`);\n }\n overrides.reporter = values.reporter;\n }\n if (values.concurrency !== undefined) {\n const n = Number(values.concurrency);\n if (!Number.isInteger(n) || n < 1) {\n throw new Error(`--concurrency must be a positive integer`);\n }\n overrides.concurrency = n;\n }\n\n const cwd = values.config\n ? path.resolve(process.cwd(), values.config)\n : process.cwd();\n return { cwd, overrides, interactive: values.interactive ?? false };\n}\n\nasync function main(): Promise<void> {\n const { cwd, overrides, interactive } = parseCli(process.argv.slice(2));\n const fileConfig = await loadConfigFile(cwd);\n const config = resolveConfig(cwd, fileConfig, overrides);\n if (interactive) {\n await runInteractive(config);\n return; // interactive mode manages its own lifecycle and exit code\n }\n const { passed } = await run(config);\n process.exitCode = passed ? 0 : 1;\n}\n\nmain().catch(err => {\n process.stderr.write(`${err instanceof Error ? err.stack : String(err)}\\n`);\n process.exitCode = 1;\n});\n"],"mappings":";;;;;;;;;;;;;;;AAqDA,MAAM,mBAAmB;AACzB,MAAM,gBAAgB;AACtB,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;AACF;AAEA,SA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