@step-forge/step-forge 0.0.19 → 0.0.21

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.
Files changed (40) hide show
  1. package/README.md +5 -2
  2. package/RUNTIME.md +212 -0
  3. package/dist/{analyzer-QH03uejK.js → analyzer-DYfdoSIS.js} +55 -16
  4. package/dist/analyzer-DYfdoSIS.js.map +1 -0
  5. package/dist/analyzer-cli.js +1 -1
  6. package/dist/analyzer-cli.js.map +1 -1
  7. package/dist/analyzer.d.ts +14 -0
  8. package/dist/analyzer.js +1 -1
  9. package/dist/cli.cjs +470 -0
  10. package/dist/cli.cjs.map +1 -0
  11. package/dist/cli.d.cts +1 -0
  12. package/dist/cli.d.ts +1 -0
  13. package/dist/cli.js +471 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/engine-DPRxs6eC.js +181 -0
  16. package/dist/engine-DPRxs6eC.js.map +1 -0
  17. package/dist/engine-DWAIlwWp.cjs +204 -0
  18. package/dist/engine-DWAIlwWp.cjs.map +1 -0
  19. package/dist/gherkinParser-CHpkEwii.cjs +243 -0
  20. package/dist/gherkinParser-CHpkEwii.cjs.map +1 -0
  21. package/dist/gherkinParser-CKARHgt4.js +188 -0
  22. package/dist/gherkinParser-CKARHgt4.js.map +1 -0
  23. package/dist/hooks-CGYzwDOv.cjs +117 -0
  24. package/dist/hooks-CGYzwDOv.cjs.map +1 -0
  25. package/dist/hooks-CywugMQQ.js +82 -0
  26. package/dist/hooks-CywugMQQ.js.map +1 -0
  27. package/dist/hooks-Dar49TtT.d.cts +189 -0
  28. package/dist/hooks-Dar49TtT.d.ts +189 -0
  29. package/dist/runtime.cjs +13 -0
  30. package/dist/runtime.d.cts +142 -0
  31. package/dist/runtime.d.ts +142 -0
  32. package/dist/runtime.js +3 -0
  33. package/dist/step-forge.cjs +185 -306
  34. package/dist/step-forge.cjs.map +1 -1
  35. package/dist/step-forge.d.cts +193 -733
  36. package/dist/step-forge.d.ts +193 -733
  37. package/dist/step-forge.js +174 -276
  38. package/dist/step-forge.js.map +1 -1
  39. package/package.json +20 -9
  40. package/dist/analyzer-QH03uejK.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gherkinParser-CHpkEwii.cjs","names":["_","path","fs","Parser","AstBuilder","messages","GherkinClassicTokenMatcher"],"sources":["../../src/world.ts","../../src/globFiles.ts","../../src/analyzer/gherkinParser.ts"],"sourcesContent":["import _ from \"lodash\";\n\nexport type WorldState<State> = {\n readonly [K in keyof State]?: State[K];\n};\n\nexport type MergeableWorldState<T> = WorldState<T> & {\n merge: (newState: Partial<T>) => void;\n};\n\nfunction mergeCustomizer(objValue: unknown, srcValue: unknown) {\n if (_.isArray(objValue)) {\n return objValue.concat(srcValue);\n } else if (objValue && !_.isPlainObject(objValue) && objValue !== srcValue) {\n throw new Error(\n `Merge would have destroyed previous value ${objValue} with ${srcValue}`\n );\n }\n return objValue;\n}\n\nexport const createMergeableState = <T>(\n state: WorldState<T>\n): MergeableWorldState<T> => {\n return {\n ...state,\n merge: (newState: Partial<T>) => {\n state = _.merge({ ...state }, newState, mergeCustomizer);\n },\n };\n};\n\nexport type MergeableWorld<Given, When, Then> = {\n given: MergeableWorldState<Given>;\n when: MergeableWorldState<When>;\n then: MergeableWorldState<Then>;\n};\n\nexport class BasicWorld<Given, When, Then> {\n private givenState: WorldState<Given> = {};\n private whenState: WorldState<When> = {};\n private thenState: WorldState<Then> = {};\n\n public get given(): MergeableWorldState<Given> {\n return {\n ...this.givenState,\n merge: (newState: Partial<Given>) => {\n this.givenState = _.merge(\n { ...this.givenState },\n newState,\n mergeCustomizer\n );\n },\n };\n }\n\n public get when(): MergeableWorldState<When> {\n return {\n ...this.whenState,\n merge: (newState: Partial<When>) => {\n this.whenState = _.merge(\n { ...this.whenState },\n newState,\n mergeCustomizer\n );\n },\n };\n }\n\n public get then(): MergeableWorldState<Then> {\n return {\n ...this.thenState,\n merge: (newState: Partial<Then>) => {\n this.thenState = _.merge(\n { ...this.thenState },\n newState,\n mergeCustomizer\n );\n },\n };\n }\n}\n\nexport const createBasicWorld = <Given, When, Then>(): MergeableWorld<\n Given,\n When,\n Then\n> => {\n return new BasicWorld<Given, When, Then>();\n};\n","import { glob } from \"node:fs/promises\";\nimport { stat } from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\n/** Glob metacharacters. A pattern with none of these is a literal path. */\nconst MAGIC = /[*?[\\]{}!()]/;\n\nasync function isFile(p: string): Promise<boolean> {\n try {\n return (await stat(p)).isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * Resolve glob patterns to a de-duplicated list of absolute file paths, with one\n * important portability guarantee: a **literal absolute path** (no glob magic)\n * is returned directly if it exists, without being handed to `glob()`.\n *\n * This exists because `node:fs`'s `glob` diverges between runtimes — Node\n * matches an absolute-path pattern, Bun returns nothing for one. Rather than\n * depend on that behaviour, we only ever glob relative patterns (against `cwd`)\n * and short-circuit concrete absolute paths ourselves, so callers get identical\n * results under Node and Bun.\n */\nexport async function globFiles(\n patterns: string[],\n cwd: string = process.cwd()\n): Promise<string[]> {\n const files = new Set<string>();\n for (const pattern of patterns) {\n if (path.isAbsolute(pattern) && !MAGIC.test(pattern)) {\n if (await isFile(pattern)) files.add(pattern);\n continue;\n }\n for await (const match of glob(pattern, { cwd })) {\n files.add(path.resolve(cwd, match));\n }\n }\n return [...files];\n}\n","import * as fs from \"node:fs\";\nimport { GherkinClassicTokenMatcher, Parser, AstBuilder } from \"@cucumber/gherkin\";\nimport * as messages from \"@cucumber/messages\";\nimport { ParsedScenario, ParsedStep } from \"./types.js\";\n\ntype GherkinKeyword = \"Given\" | \"When\" | \"Then\" | \"And\" | \"But\";\n\nexport function parseFeatureFiles(filePaths: string[]): ParsedScenario[] {\n const scenarios: ParsedScenario[] = [];\n\n for (const filePath of filePaths) {\n const content = fs.readFileSync(filePath, \"utf-8\");\n const parsed = parseFeatureContent(content, filePath);\n scenarios.push(...parsed);\n }\n\n return scenarios;\n}\n\nexport function parseFeatureContent(\n content: string,\n filePath: string\n): ParsedScenario[] {\n const newId = messages.IdGenerator.uuid();\n const builder = new AstBuilder(newId);\n const matcher = new GherkinClassicTokenMatcher();\n const parser = new Parser(builder, matcher);\n\n const gherkinDocument: messages.GherkinDocument = parser.parse(content);\n const feature = gherkinDocument.feature;\n if (!feature) return [];\n\n // Collect background steps at the feature level\n const featureBackground: messages.Step[] = [];\n const scenarios: ParsedScenario[] = [];\n const featureTags = tagNames(feature.tags);\n\n for (const child of feature.children) {\n if (child.background) {\n featureBackground.push(...child.background.steps);\n }\n\n if (child.scenario) {\n scenarios.push(\n ...expandScenario(\n child.scenario,\n featureBackground,\n filePath,\n featureTags\n )\n );\n }\n\n if (child.rule) {\n // Rules can have their own backgrounds and tags, both inherited by the\n // rule's scenarios.\n const ruleBackground: messages.Step[] = [...featureBackground];\n const ruleTags = [...featureTags, ...tagNames(child.rule.tags)];\n for (const ruleChild of child.rule.children) {\n if (ruleChild.background) {\n ruleBackground.push(...ruleChild.background.steps);\n }\n if (ruleChild.scenario) {\n scenarios.push(\n ...expandScenario(\n ruleChild.scenario,\n ruleBackground,\n filePath,\n ruleTags\n )\n );\n }\n }\n }\n }\n\n return scenarios;\n}\n\n/** Extract tag names (each keeping its leading `@`), deduped in order. */\nfunction tagNames(tags: readonly messages.Tag[] | undefined): string[] {\n return [...new Set((tags ?? []).map(t => t.name))];\n}\n\nfunction expandScenario(\n scenario: messages.Scenario,\n backgroundSteps: messages.Step[],\n filePath: string,\n inheritedTags: string[]\n): ParsedScenario[] {\n const scenarioTags = [...inheritedTags, ...tagNames(scenario.tags)];\n const hasExamples =\n scenario.examples.length > 0 &&\n scenario.examples.some((e) => e.tableBody.length > 0);\n\n if (!hasExamples) {\n // Regular scenario\n const bgParsed = convertSteps(backgroundSteps);\n const scenarioParsed = convertSteps(scenario.steps);\n const allSteps = resolveEffectiveKeywords([...bgParsed, ...scenarioParsed]);\n\n return [\n {\n name: scenario.name,\n file: filePath,\n steps: allSteps,\n tags: scenarioTags,\n },\n ];\n }\n\n // Scenario Outline — expand with each example row. Rows carry the outline's\n // base name so the runner can group them, plus the Examples-block tags.\n const results: ParsedScenario[] = [];\n for (const example of scenario.examples) {\n if (!example.tableHeader || example.tableBody.length === 0) continue;\n const headers = example.tableHeader.cells.map((c) => c.value);\n const exampleTags = [...scenarioTags, ...tagNames(example.tags)];\n\n for (const row of example.tableBody) {\n const values = row.cells.map((c) => c.value);\n const substitution: Record<string, string> = {};\n headers.forEach((h, i) => {\n substitution[h] = values[i];\n });\n\n const bgParsed = convertSteps(backgroundSteps);\n const scenarioSteps = convertSteps(scenario.steps).map((step) => ({\n ...step,\n text: substituteExampleValues(step.text, substitution),\n }));\n const allSteps = resolveEffectiveKeywords([...bgParsed, ...scenarioSteps]);\n\n results.push({\n name: headers.map((h, i) => `${h}=${values[i]}`).join(\", \"),\n file: filePath,\n steps: allSteps,\n tags: exampleTags,\n outline: { name: scenario.name },\n });\n }\n }\n\n return results;\n}\n\nfunction convertSteps(\n steps: readonly messages.Step[]\n): Omit<ParsedStep, \"effectiveKeyword\">[] {\n return steps.map((step) => ({\n keyword: normalizeKeyword(step.keyword),\n text: step.text,\n line: step.location.line,\n // step.location.column points to the keyword start; shift past the\n // keyword (which includes a trailing space) so column points to the\n // start of the step text. This makes `column + text.length` produce\n // the correct end position for diagnostic ranges.\n column: (step.location.column ?? 1) + step.keyword.length,\n }));\n}\n\nfunction normalizeKeyword(keyword: string): GherkinKeyword {\n const trimmed = keyword.trim();\n // Gherkin keywords may include trailing space, e.g. \"Given \"\n if (trimmed === \"Given\") return \"Given\";\n if (trimmed === \"When\") return \"When\";\n if (trimmed === \"Then\") return \"Then\";\n if (trimmed === \"And\") return \"And\";\n if (trimmed === \"But\") return \"But\";\n // Fallback: treat as Given (shouldn't happen with valid Gherkin)\n return \"Given\";\n}\n\nfunction resolveEffectiveKeywords(\n steps: Omit<ParsedStep, \"effectiveKeyword\">[]\n): ParsedStep[] {\n let lastEffective: \"Given\" | \"When\" | \"Then\" = \"Given\";\n\n return steps.map((step) => {\n let effectiveKeyword: \"Given\" | \"When\" | \"Then\";\n if (step.keyword === \"And\" || step.keyword === \"But\") {\n effectiveKeyword = lastEffective;\n } else {\n effectiveKeyword = step.keyword as \"Given\" | \"When\" | \"Then\";\n }\n lastEffective = effectiveKeyword;\n\n return {\n ...step,\n effectiveKeyword,\n };\n });\n}\n\nfunction substituteExampleValues(\n text: string,\n substitution: Record<string, string>\n): string {\n let result = text;\n for (const [key, value] of Object.entries(substitution)) {\n result = result.replace(new RegExp(`<${key}>`, \"g\"), value);\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,gBAAgB,UAAmB,UAAmB;CAC7D,IAAIA,OAAAA,QAAE,QAAQ,QAAQ,GACpB,OAAO,SAAS,OAAO,QAAQ;MAC1B,IAAI,YAAY,CAACA,OAAAA,QAAE,cAAc,QAAQ,KAAK,aAAa,UAChE,MAAM,IAAI,MACR,6CAA6C,SAAS,QAAQ,UAChE;CAEF,OAAO;AACT;AAmBA,IAAa,aAAb,MAA2C;CACzC,aAAwC,CAAC;CACzC,YAAsC,CAAC;CACvC,YAAsC,CAAC;CAEvC,IAAW,QAAoC;EAC7C,OAAO;GACL,GAAG,KAAK;GACR,QAAQ,aAA6B;IACnC,KAAK,aAAaA,OAAAA,QAAE,MAClB,EAAE,GAAG,KAAK,WAAW,GACrB,UACA,eACF;GACF;EACF;CACF;CAEA,IAAW,OAAkC;EAC3C,OAAO;GACL,GAAG,KAAK;GACR,QAAQ,aAA4B;IAClC,KAAK,YAAYA,OAAAA,QAAE,MACjB,EAAE,GAAG,KAAK,UAAU,GACpB,UACA,eACF;GACF;EACF;CACF;CAEA,IAAW,OAAkC;EAC3C,OAAO;GACL,GAAG,KAAK;GACR,QAAQ,aAA4B;IAClC,KAAK,YAAYA,OAAAA,QAAE,MACjB,EAAE,GAAG,KAAK,UAAU,GACpB,UACA,eACF;GACF;EACF;CACF;A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AAG;GACH;EACF;CACF,CAAC;AACH;AAEA,SAAS,wBACP,MACA,cACQ;CACR,IAAI,SAAS;CACb,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,YAAY,GACpD,SAAS,OAAO,QAAQ,IAAI,OAAO,IAAI,IAAI,IAAI,GAAG,GAAG,KAAK;CAE5D,OAAO;AACT"}
@@ -0,0 +1,188 @@
1
+ import _ from "lodash";
2
+ import { glob, stat } from "node:fs/promises";
3
+ import * as path from "node:path";
4
+ import * as fs from "node:fs";
5
+ import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherkin";
6
+ import * as messages from "@cucumber/messages";
7
+ //#region src/world.ts
8
+ function mergeCustomizer(objValue, srcValue) {
9
+ if (_.isArray(objValue)) return objValue.concat(srcValue);
10
+ else if (objValue && !_.isPlainObject(objValue) && objValue !== srcValue) throw new Error(`Merge would have destroyed previous value ${objValue} with ${srcValue}`);
11
+ return objValue;
12
+ }
13
+ var BasicWorld = class {
14
+ givenState = {};
15
+ whenState = {};
16
+ thenState = {};
17
+ get given() {
18
+ return {
19
+ ...this.givenState,
20
+ merge: (newState) => {
21
+ this.givenState = _.merge({ ...this.givenState }, newState, mergeCustomizer);
22
+ }
23
+ };
24
+ }
25
+ get when() {
26
+ return {
27
+ ...this.whenState,
28
+ merge: (newState) => {
29
+ this.whenState = _.merge({ ...this.whenState }, newState, mergeCustomizer);
30
+ }
31
+ };
32
+ }
33
+ get then() {
34
+ return {
35
+ ...this.thenState,
36
+ merge: (newState) => {
37
+ this.thenState = _.merge({ ...this.thenState }, newState, mergeCustomizer);
38
+ }
39
+ };
40
+ }
41
+ };
42
+ //#endregion
43
+ //#region src/globFiles.ts
44
+ /** Glob metacharacters. A pattern with none of these is a literal path. */
45
+ const MAGIC = /[*?[\]{}!()]/;
46
+ async function isFile(p) {
47
+ try {
48
+ return (await stat(p)).isFile();
49
+ } catch {
50
+ return false;
51
+ }
52
+ }
53
+ /**
54
+ * Resolve glob patterns to a de-duplicated list of absolute file paths, with one
55
+ * important portability guarantee: a **literal absolute path** (no glob magic)
56
+ * is returned directly if it exists, without being handed to `glob()`.
57
+ *
58
+ * This exists because `node:fs`'s `glob` diverges between runtimes — Node
59
+ * matches an absolute-path pattern, Bun returns nothing for one. Rather than
60
+ * depend on that behaviour, we only ever glob relative patterns (against `cwd`)
61
+ * and short-circuit concrete absolute paths ourselves, so callers get identical
62
+ * results under Node and Bun.
63
+ */
64
+ async function globFiles(patterns, cwd = process.cwd()) {
65
+ const files = /* @__PURE__ */ new Set();
66
+ for (const pattern of patterns) {
67
+ if (path.isAbsolute(pattern) && !MAGIC.test(pattern)) {
68
+ if (await isFile(pattern)) files.add(pattern);
69
+ continue;
70
+ }
71
+ for await (const match of glob(pattern, { cwd })) files.add(path.resolve(cwd, match));
72
+ }
73
+ return [...files];
74
+ }
75
+ //#endregion
76
+ //#region src/analyzer/gherkinParser.ts
77
+ function parseFeatureFiles(filePaths) {
78
+ const scenarios = [];
79
+ for (const filePath of filePaths) {
80
+ const parsed = parseFeatureContent(fs.readFileSync(filePath, "utf-8"), filePath);
81
+ scenarios.push(...parsed);
82
+ }
83
+ return scenarios;
84
+ }
85
+ function parseFeatureContent(content, filePath) {
86
+ const feature = new Parser(new AstBuilder(messages.IdGenerator.uuid()), new GherkinClassicTokenMatcher()).parse(content).feature;
87
+ if (!feature) return [];
88
+ const featureBackground = [];
89
+ const scenarios = [];
90
+ const featureTags = tagNames(feature.tags);
91
+ for (const child of feature.children) {
92
+ if (child.background) featureBackground.push(...child.background.steps);
93
+ if (child.scenario) scenarios.push(...expandScenario(child.scenario, featureBackground, filePath, featureTags));
94
+ if (child.rule) {
95
+ const ruleBackground = [...featureBackground];
96
+ const ruleTags = [...featureTags, ...tagNames(child.rule.tags)];
97
+ for (const ruleChild of child.rule.children) {
98
+ if (ruleChild.background) ruleBackground.push(...ruleChild.background.steps);
99
+ if (ruleChild.scenario) scenarios.push(...expandScenario(ruleChild.scenario, ruleBackground, filePath, ruleTags));
100
+ }
101
+ }
102
+ }
103
+ return scenarios;
104
+ }
105
+ /** Extract tag names (each keeping its leading `@`), deduped in order. */
106
+ function tagNames(tags) {
107
+ return [...new Set((tags ?? []).map((t) => t.name))];
108
+ }
109
+ function expandScenario(scenario, backgroundSteps, filePath, inheritedTags) {
110
+ const scenarioTags = [...inheritedTags, ...tagNames(scenario.tags)];
111
+ if (!(scenario.examples.length > 0 && scenario.examples.some((e) => e.tableBody.length > 0))) {
112
+ const bgParsed = convertSteps(backgroundSteps);
113
+ const scenarioParsed = convertSteps(scenario.steps);
114
+ const allSteps = resolveEffectiveKeywords([...bgParsed, ...scenarioParsed]);
115
+ return [{
116
+ name: scenario.name,
117
+ file: filePath,
118
+ steps: allSteps,
119
+ tags: scenarioTags
120
+ }];
121
+ }
122
+ const results = [];
123
+ for (const example of scenario.examples) {
124
+ if (!example.tableHeader || example.tableBody.length === 0) continue;
125
+ const headers = example.tableHeader.cells.map((c) => c.value);
126
+ const exampleTags = [...scenarioTags, ...tagNames(example.tags)];
127
+ for (const row of example.tableBody) {
128
+ const values = row.cells.map((c) => c.value);
129
+ const substitution = {};
130
+ headers.forEach((h, i) => {
131
+ substitution[h] = values[i];
132
+ });
133
+ const bgParsed = convertSteps(backgroundSteps);
134
+ const scenarioSteps = convertSteps(scenario.steps).map((step) => ({
135
+ ...step,
136
+ text: substituteExampleValues(step.text, substitution)
137
+ }));
138
+ const allSteps = resolveEffectiveKeywords([...bgParsed, ...scenarioSteps]);
139
+ results.push({
140
+ name: headers.map((h, i) => `${h}=${values[i]}`).join(", "),
141
+ file: filePath,
142
+ steps: allSteps,
143
+ tags: exampleTags,
144
+ outline: { name: scenario.name }
145
+ });
146
+ }
147
+ }
148
+ return results;
149
+ }
150
+ function convertSteps(steps) {
151
+ return steps.map((step) => ({
152
+ keyword: normalizeKeyword(step.keyword),
153
+ text: step.text,
154
+ line: step.location.line,
155
+ column: (step.location.column ?? 1) + step.keyword.length
156
+ }));
157
+ }
158
+ function normalizeKeyword(keyword) {
159
+ const trimmed = keyword.trim();
160
+ if (trimmed === "Given") return "Given";
161
+ if (trimmed === "When") return "When";
162
+ if (trimmed === "Then") return "Then";
163
+ if (trimmed === "And") return "And";
164
+ if (trimmed === "But") return "But";
165
+ return "Given";
166
+ }
167
+ function resolveEffectiveKeywords(steps) {
168
+ let lastEffective = "Given";
169
+ return steps.map((step) => {
170
+ let effectiveKeyword;
171
+ if (step.keyword === "And" || step.keyword === "But") effectiveKeyword = lastEffective;
172
+ else effectiveKeyword = step.keyword;
173
+ lastEffective = effectiveKeyword;
174
+ return {
175
+ ...step,
176
+ effectiveKeyword
177
+ };
178
+ });
179
+ }
180
+ function substituteExampleValues(text, substitution) {
181
+ let result = text;
182
+ for (const [key, value] of Object.entries(substitution)) result = result.replace(new RegExp(`<${key}>`, "g"), value);
183
+ return result;
184
+ }
185
+ //#endregion
186
+ export { BasicWorld as i, parseFeatureFiles as n, globFiles as r, parseFeatureContent as t };
187
+
188
+ //# sourceMappingURL=gherkinParser-CKARHgt4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gherkinParser-CKARHgt4.js","names":[],"sources":["../../src/world.ts","../../src/globFiles.ts","../../src/analyzer/gherkinParser.ts"],"sourcesContent":["import _ from \"lodash\";\n\nexport type WorldState<State> = {\n readonly [K in keyof State]?: State[K];\n};\n\nexport type MergeableWorldState<T> = WorldState<T> & {\n merge: (newState: Partial<T>) => void;\n};\n\nfunction mergeCustomizer(objValue: unknown, srcValue: unknown) {\n if (_.isArray(objValue)) {\n return objValue.concat(srcValue);\n } else if (objValue && !_.isPlainObject(objValue) && objValue !== srcValue) {\n throw new Error(\n `Merge would have destroyed previous value ${objValue} with ${srcValue}`\n );\n }\n return objValue;\n}\n\nexport const createMergeableState = <T>(\n state: WorldState<T>\n): MergeableWorldState<T> => {\n return {\n ...state,\n merge: (newState: Partial<T>) => {\n state = _.merge({ ...state }, newState, mergeCustomizer);\n },\n };\n};\n\nexport type MergeableWorld<Given, When, Then> = {\n given: MergeableWorldState<Given>;\n when: MergeableWorldState<When>;\n then: MergeableWorldState<Then>;\n};\n\nexport class BasicWorld<Given, When, Then> {\n private givenState: WorldState<Given> = {};\n private whenState: WorldState<When> = {};\n private thenState: WorldState<Then> = {};\n\n public get given(): MergeableWorldState<Given> {\n return {\n ...this.givenState,\n merge: (newState: Partial<Given>) => {\n this.givenState = _.merge(\n { ...this.givenState },\n newState,\n mergeCustomizer\n );\n },\n };\n }\n\n public get when(): MergeableWorldState<When> {\n return {\n ...this.whenState,\n merge: (newState: Partial<When>) => {\n this.whenState = _.merge(\n { ...this.whenState },\n newState,\n mergeCustomizer\n );\n },\n };\n }\n\n public get then(): MergeableWorldState<Then> {\n return {\n ...this.thenState,\n merge: (newState: Partial<Then>) => {\n this.thenState = _.merge(\n { ...this.thenState },\n newState,\n mergeCustomizer\n );\n },\n };\n }\n}\n\nexport const createBasicWorld = <Given, When, Then>(): MergeableWorld<\n Given,\n When,\n Then\n> => {\n return new BasicWorld<Given, When, Then>();\n};\n","import { glob } from \"node:fs/promises\";\nimport { stat } from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\n/** Glob metacharacters. A pattern with none of these is a literal path. */\nconst MAGIC = /[*?[\\]{}!()]/;\n\nasync function isFile(p: string): Promise<boolean> {\n try {\n return (await stat(p)).isFile();\n } catch {\n return false;\n }\n}\n\n/**\n * Resolve glob patterns to a de-duplicated list of absolute file paths, with one\n * important portability guarantee: a **literal absolute path** (no glob magic)\n * is returned directly if it exists, without being handed to `glob()`.\n *\n * This exists because `node:fs`'s `glob` diverges between runtimes — Node\n * matches an absolute-path pattern, Bun returns nothing for one. Rather than\n * depend on that behaviour, we only ever glob relative patterns (against `cwd`)\n * and short-circuit concrete absolute paths ourselves, so callers get identical\n * results under Node and Bun.\n */\nexport async function globFiles(\n patterns: string[],\n cwd: string = process.cwd()\n): Promise<string[]> {\n const files = new Set<string>();\n for (const pattern of patterns) {\n if (path.isAbsolute(pattern) && !MAGIC.test(pattern)) {\n if (await isFile(pattern)) files.add(pattern);\n continue;\n }\n for await (const match of glob(pattern, { cwd })) {\n files.add(path.resolve(cwd, match));\n }\n }\n return [...files];\n}\n","import * as fs from \"node:fs\";\nimport { GherkinClassicTokenMatcher, Parser, AstBuilder } from \"@cucumber/gherkin\";\nimport * as messages from \"@cucumber/messages\";\nimport { ParsedScenario, ParsedStep } from \"./types.js\";\n\ntype GherkinKeyword = \"Given\" | \"When\" | \"Then\" | \"And\" | \"But\";\n\nexport function parseFeatureFiles(filePaths: string[]): ParsedScenario[] {\n const scenarios: ParsedScenario[] = [];\n\n for (const filePath of filePaths) {\n const content = fs.readFileSync(filePath, \"utf-8\");\n const parsed = parseFeatureContent(content, filePath);\n scenarios.push(...parsed);\n }\n\n return scenarios;\n}\n\nexport function parseFeatureContent(\n content: string,\n filePath: string\n): ParsedScenario[] {\n const newId = messages.IdGenerator.uuid();\n const builder = new AstBuilder(newId);\n const matcher = new GherkinClassicTokenMatcher();\n const parser = new Parser(builder, matcher);\n\n const gherkinDocument: messages.GherkinDocument = parser.parse(content);\n const feature = gherkinDocument.feature;\n if (!feature) return [];\n\n // Collect background steps at the feature level\n const featureBackground: messages.Step[] = [];\n const scenarios: ParsedScenario[] = [];\n const featureTags = tagNames(feature.tags);\n\n for (const child of feature.children) {\n if (child.background) {\n featureBackground.push(...child.background.steps);\n }\n\n if (child.scenario) {\n scenarios.push(\n ...expandScenario(\n child.scenario,\n featureBackground,\n filePath,\n featureTags\n )\n );\n }\n\n if (child.rule) {\n // Rules can have their own backgrounds and tags, both inherited by the\n // rule's scenarios.\n const ruleBackground: messages.Step[] = [...featureBackground];\n const ruleTags = [...featureTags, ...tagNames(child.rule.tags)];\n for (const ruleChild of child.rule.children) {\n if (ruleChild.background) {\n ruleBackground.push(...ruleChild.background.steps);\n }\n if (ruleChild.scenario) {\n scenarios.push(\n ...expandScenario(\n ruleChild.scenario,\n ruleBackground,\n filePath,\n ruleTags\n )\n );\n }\n }\n }\n }\n\n return scenarios;\n}\n\n/** Extract tag names (each keeping its leading `@`), deduped in order. */\nfunction tagNames(tags: readonly messages.Tag[] | undefined): string[] {\n return [...new Set((tags ?? []).map(t => t.name))];\n}\n\nfunction expandScenario(\n scenario: messages.Scenario,\n backgroundSteps: messages.Step[],\n filePath: string,\n inheritedTags: string[]\n): ParsedScenario[] {\n const scenarioTags = [...inheritedTags, ...tagNames(scenario.tags)];\n const hasExamples =\n scenario.examples.length > 0 &&\n scenario.examples.some((e) => e.tableBody.length > 0);\n\n if (!hasExamples) {\n // Regular scenario\n const bgParsed = convertSteps(backgroundSteps);\n const scenarioParsed = convertSteps(scenario.steps);\n const allSteps = resolveEffectiveKeywords([...bgParsed, ...scenarioParsed]);\n\n return [\n {\n name: scenario.name,\n file: filePath,\n steps: allSteps,\n tags: scenarioTags,\n },\n ];\n }\n\n // Scenario Outline — expand with each example row. Rows carry the outline's\n // base name so the runner can group them, plus the Examples-block tags.\n const results: ParsedScenario[] = [];\n for (const example of scenario.examples) {\n if (!example.tableHeader || example.tableBody.length === 0) continue;\n const headers = example.tableHeader.cells.map((c) => c.value);\n const exampleTags = [...scenarioTags, ...tagNames(example.tags)];\n\n for (const row of example.tableBody) {\n const values = row.cells.map((c) => c.value);\n const substitution: Record<string, string> = {};\n headers.forEach((h, i) => {\n substitution[h] = values[i];\n });\n\n const bgParsed = convertSteps(backgroundSteps);\n const scenarioSteps = convertSteps(scenario.steps).map((step) => ({\n ...step,\n text: substituteExampleValues(step.text, substitution),\n }));\n const allSteps = resolveEffectiveKeywords([...bgParsed, ...scenarioSteps]);\n\n results.push({\n name: headers.map((h, i) => `${h}=${values[i]}`).join(\", \"),\n file: filePath,\n steps: allSteps,\n tags: exampleTags,\n outline: { name: scenario.name },\n });\n }\n }\n\n return results;\n}\n\nfunction convertSteps(\n steps: readonly messages.Step[]\n): Omit<ParsedStep, \"effectiveKeyword\">[] {\n return steps.map((step) => ({\n keyword: normalizeKeyword(step.keyword),\n text: step.text,\n line: step.location.line,\n // step.location.column points to the keyword start; shift past the\n // keyword (which includes a trailing space) so column points to the\n // start of the step text. This makes `column + text.length` produce\n // the correct end position for diagnostic ranges.\n column: (step.location.column ?? 1) + step.keyword.length,\n }));\n}\n\nfunction normalizeKeyword(keyword: string): GherkinKeyword {\n const trimmed = keyword.trim();\n // Gherkin keywords may include trailing space, e.g. \"Given \"\n if (trimmed === \"Given\") return \"Given\";\n if (trimmed === \"When\") return \"When\";\n if (trimmed === \"Then\") return \"Then\";\n if (trimmed === \"And\") return \"And\";\n if (trimmed === \"But\") return \"But\";\n // Fallback: treat as Given (shouldn't happen with valid Gherkin)\n return \"Given\";\n}\n\nfunction resolveEffectiveKeywords(\n steps: Omit<ParsedStep, \"effectiveKeyword\">[]\n): ParsedStep[] {\n let lastEffective: \"Given\" | \"When\" | \"Then\" = \"Given\";\n\n return steps.map((step) => {\n let effectiveKeyword: \"Given\" | \"When\" | \"Then\";\n if (step.keyword === \"And\" || step.keyword === \"But\") {\n effectiveKeyword = lastEffective;\n } else {\n effectiveKeyword = step.keyword as \"Given\" | \"When\" | \"Then\";\n }\n lastEffective = effectiveKeyword;\n\n return {\n ...step,\n effectiveKeyword,\n };\n });\n}\n\nfunction substituteExampleValues(\n text: string,\n substitution: Record<string, string>\n): string {\n let result = text;\n for (const [key, value] of Object.entries(substitution)) {\n result = result.replace(new RegExp(`<${key}>`, \"g\"), value);\n }\n return result;\n}\n"],"mappings":";;;;;;;AAUA,SAAS,gBAAgB,UAAmB,UAAmB;CAC7D,IAAI,EAAE,QAAQ,QAAQ,GACpB,OAAO,SAAS,OAAO,QAAQ;MAC1B,IAAI,YAAY,CAAC,EAAE,cAAc,QAAQ,KAAK,aAAa,UAChE,MAAM,IAAI,MACR,6CAA6C,SAAS,QAAQ,UAChE;CAEF,OAAO;AACT;AAmBA,IAAa,aAAb,MAA2C;CACzC,aAAwC,CAAC;CACzC,YAAsC,CAAC;CACvC,YAAsC,CAAC;CAEvC,IAAW,QAAoC;EAC7C,OAAO;GACL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OAAO;CAChC,IAAI,YAAY,QAAQ,OAAO;CAC/B,IAAI,YAAY,QAAQ,OAAO;CAC/B,IAAI,YAAY,OAAO,OAAO;CAC9B,IAAI,YAAY,OAAO,OAAO;CAE9B,OAAO;AACT;AAEA,SAAS,yBACP,OACc;CACd,IAAI,gBAA2C;CAE/C,OAAO,MAAM,KAAK,SAAS;EACzB,IAAI;EACJ,IAAI,KAAK,YAAY,SAAS,KAAK,YAAY,OAC7C,mBAAmB;OAEnB,mBAAmB,KAAK;EAE1B,gBAAgB;EAEhB,OAAO;GACL,GAAG;GACH;EACF;CACF,CAAC;AACH;AAEA,SAAS,wBACP,MACA,cACQ;CACR,IAAI,SAAS;CACb,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,YAAY,GACpD,SAAS,OAAO,QAAQ,IAAI,OAAO,IAAI,IAAI,IAAI,GAAG,GAAG,KAAK;CAE5D,OAAO;AACT"}
@@ -0,0 +1,117 @@
1
+ //#region src/runtime/registry.ts
2
+ /**
3
+ * A collection of registered steps. Deliberately a plain instance (not a hidden
4
+ * module global) so tests and the Vitest plugin can create isolated registries.
5
+ * `globalRegistry` is the default sink that `.step()` writes to.
6
+ */
7
+ var StepRegistry = class {
8
+ steps = [];
9
+ add(step) {
10
+ this.steps.push(step);
11
+ }
12
+ all() {
13
+ return this.steps;
14
+ }
15
+ clear() {
16
+ this.steps = [];
17
+ }
18
+ };
19
+ const globalRegistry = new StepRegistry();
20
+ //#endregion
21
+ //#region src/runtime/hooks.ts
22
+ /**
23
+ * Collection of registered hooks. Like {@link StepRegistry}, a plain instance
24
+ * (not a hidden global) so tests can isolate; `globalHookRegistry` is the
25
+ * default sink the public `beforeScenario`/`afterAll`/etc helpers write to.
26
+ */
27
+ var HookRegistry = class {
28
+ hooks = [];
29
+ add(hook) {
30
+ this.hooks.push(hook);
31
+ }
32
+ /**
33
+ * Hooks for a scope+timing. `before` hooks run in registration order;
34
+ * `after` hooks run in reverse (LIFO), so teardown unwinds setup.
35
+ */
36
+ for(scope, timing) {
37
+ const matching = this.hooks.filter((h) => h.scope === scope && h.timing === timing);
38
+ return timing === "after" ? matching.reverse() : matching;
39
+ }
40
+ clear() {
41
+ this.hooks = [];
42
+ }
43
+ };
44
+ const globalHookRegistry = new HookRegistry();
45
+ /**
46
+ * Run every registered feature/global hook of a scope+timing in order. Used by
47
+ * the generated test modules (feature hooks). Throws if a hook throws, so the
48
+ * runner reports it against the enclosing boundary.
49
+ */
50
+ async function runHooks(scope, timing, registry = globalHookRegistry) {
51
+ for (const hook of registry.for(scope, timing)) await hook.fn();
52
+ }
53
+ const GLOBAL_GUARD = Symbol.for("step-forge.globalHooksStarted");
54
+ /**
55
+ * Run global before-hooks once per worker, ahead of that worker's first
56
+ * scenario, and schedule global after-hooks for worker exit. Idempotent: every
57
+ * feature module calls this in a `beforeAll`, but only the first call in a given
58
+ * worker does anything.
59
+ *
60
+ * Semantics & caveats (the once-per-worker model):
61
+ * - Runs in the *same* realm as steps, so global setup may touch in-process
62
+ * state that steps later read.
63
+ * - "Once per worker", not strictly once per run — with multiple workers it runs
64
+ * in each. Size global setup to be worker-safe (e.g. a server per worker).
65
+ * - Teardown is best-effort: after-hooks start on the worker's `beforeExit` and
66
+ * are not awaited by the runner, so keep them fast/synchronous.
67
+ */
68
+ async function ensureGlobalHooks(registry = globalHookRegistry) {
69
+ const store = globalThis;
70
+ if (store[GLOBAL_GUARD]) return;
71
+ store[GLOBAL_GUARD] = true;
72
+ for (const hook of registry.for("global", "before")) await hook.fn();
73
+ process.once("beforeExit", () => {
74
+ (async () => {
75
+ for (const hook of registry.for("global", "after")) await hook.fn();
76
+ })();
77
+ });
78
+ }
79
+ //#endregion
80
+ Object.defineProperty(exports, "HookRegistry", {
81
+ enumerable: true,
82
+ get: function() {
83
+ return HookRegistry;
84
+ }
85
+ });
86
+ Object.defineProperty(exports, "StepRegistry", {
87
+ enumerable: true,
88
+ get: function() {
89
+ return StepRegistry;
90
+ }
91
+ });
92
+ Object.defineProperty(exports, "ensureGlobalHooks", {
93
+ enumerable: true,
94
+ get: function() {
95
+ return ensureGlobalHooks;
96
+ }
97
+ });
98
+ Object.defineProperty(exports, "globalHookRegistry", {
99
+ enumerable: true,
100
+ get: function() {
101
+ return globalHookRegistry;
102
+ }
103
+ });
104
+ Object.defineProperty(exports, "globalRegistry", {
105
+ enumerable: true,
106
+ get: function() {
107
+ return globalRegistry;
108
+ }
109
+ });
110
+ Object.defineProperty(exports, "runHooks", {
111
+ enumerable: true,
112
+ get: function() {
113
+ return runHooks;
114
+ }
115
+ });
116
+
117
+ //# sourceMappingURL=hooks-CGYzwDOv.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-CGYzwDOv.cjs","names":[],"sources":["../../src/runtime/registry.ts","../../src/runtime/hooks.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Parser } from \"../parsers\";\nimport { MergeableWorld } from \"../world\";\n\nexport type StepType = \"given\" | \"when\" | \"then\";\n\n/**\n * A step definition as it exists at *runtime*, independent of any test runner.\n *\n * `execute` is the fully-wired step body: given a world and the raw values\n * captured from a Gherkin step, it applies parsers, validates + narrows\n * dependencies, runs the user's step function, and merges the result back into\n * the world. The engine never needs to know how any of that works — it just\n * matches text to a step and calls `execute`.\n */\nexport interface RegisteredStep {\n stepType: StepType;\n /** The Cucumber-expression source, e.g. `a user named {string}`. */\n expression: string;\n /** Parsers, one per captured variable, applied after expression capture. */\n parsers: Parser<any>[];\n execute: (\n world: MergeableWorld<any, any, any>,\n capturedArgs: unknown[]\n ) => Promise<void>;\n /** Where the step was defined, for ambiguous-match diagnostics. */\n source?: string;\n}\n\n/**\n * A collection of registered steps. Deliberately a plain instance (not a hidden\n * module global) so tests and the Vitest plugin can create isolated registries.\n * `globalRegistry` is the default sink that `.step()` writes to.\n */\nexport class StepRegistry {\n private steps: RegisteredStep[] = [];\n\n add(step: RegisteredStep): void {\n this.steps.push(step);\n }\n\n all(): readonly RegisteredStep[] {\n return this.steps;\n }\n\n clear(): void {\n this.steps = [];\n }\n}\n\nexport const globalRegistry = new StepRegistry();\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { MergeableWorld } from \"../world\";\n\n/**\n * Hooks are side-effect callbacks that run around scenarios, feature files, or\n * the whole run. Unlike steps they never seed state: state is owned end to end\n * by the typed dependency graph (given/when/then), and hooks exist for setup and\n * teardown (opening a DB, starting a server, resetting mocks). A scenario hook\n * may *read* the world, but its return value is ignored.\n */\nexport type HookScope = \"scenario\" | \"feature\" | \"global\";\nexport type HookTiming = \"before\" | \"after\";\n\n/** Lightweight scenario identity handed to per-scenario hooks. */\nexport interface ScenarioInfo {\n name: string;\n file: string;\n}\n\n/** A per-scenario hook: gets the scenario's world (read-only in spirit). */\nexport type ScenarioHookFn = (context: {\n world: MergeableWorld<any, any, any>;\n scenario: ScenarioInfo;\n}) => void | Promise<void>;\n\n/** A per-feature-file or global hook: no world exists at these boundaries. */\nexport type PlainHookFn = () => void | Promise<void>;\n\nexport interface RegisteredHook {\n scope: HookScope;\n timing: HookTiming;\n fn: ScenarioHookFn | PlainHookFn;\n}\n\n/**\n * Collection of registered hooks. Like {@link StepRegistry}, a plain instance\n * (not a hidden global) so tests can isolate; `globalHookRegistry` is the\n * default sink the public `beforeScenario`/`afterAll`/etc helpers write to.\n */\nexport class HookRegistry {\n private hooks: RegisteredHook[] = [];\n\n add(hook: RegisteredHook): void {\n this.hooks.push(hook);\n }\n\n /**\n * Hooks for a scope+timing. `before` hooks run in registration order;\n * `after` hooks run in reverse (LIFO), so teardown unwinds setup.\n */\n for(scope: HookScope, timing: HookTiming): RegisteredHook[] {\n const matching = this.hooks.filter(\n h => h.scope === scope && h.timing === timing\n );\n return timing === \"after\" ? matching.reverse() : matching;\n }\n\n clear(): void {\n this.hooks = [];\n }\n}\n\nexport const globalHookRegistry = new HookRegistry();\n\n/**\n * Run every registered feature/global hook of a scope+timing in order. Used by\n * the generated test modules (feature hooks). Throws if a hook throws, so the\n * runner reports it against the enclosing boundary.\n */\nexport async function runHooks(\n scope: \"feature\" | \"global\",\n timing: HookTiming,\n registry: HookRegistry = globalHookRegistry\n): Promise<void> {\n for (const hook of registry.for(scope, timing)) {\n await (hook.fn as PlainHookFn)();\n }\n}\n\n// Process-global (via Symbol.for so it survives module duplication) guard so\n// global hooks fire exactly once per worker, no matter how many feature modules\n// call in.\nconst GLOBAL_GUARD = Symbol.for(\"step-forge.globalHooksStarted\");\n\n/**\n * Run global before-hooks once per worker, ahead of that worker's first\n * scenario, and schedule global after-hooks for worker exit. Idempotent: every\n * feature module calls this in a `beforeAll`, but only the first call in a given\n * worker does anything.\n *\n * Semantics & caveats (the once-per-worker model):\n * - Runs in the *same* realm as steps, so global setup may touch in-process\n * state that steps later read.\n * - \"Once per worker\", not strictly once per run — with multiple workers it runs\n * in each. Size global setup to be worker-safe (e.g. a server per worker).\n * - Teardown is best-effort: after-hooks start on the worker's `beforeExit` and\n * are not awaited by the runner, so keep them fast/synchronous.\n */\nexport async function ensureGlobalHooks(\n registry: HookRegistry = globalHookRegistry\n): Promise<void> {\n const store = globalThis as Record<symbol, boolean>;\n if (store[GLOBAL_GUARD]) return;\n store[GLOBAL_GUARD] = true;\n\n for (const hook of registry.for(\"global\", \"before\")) {\n await (hook.fn as PlainHookFn)();\n }\n\n process.once(\"beforeExit\", () => {\n void (async () => {\n for (const hook of registry.for(\"global\", \"after\")) {\n await (hook.fn as PlainHookFn)();\n }\n })();\n });\n}\n"],"mappings":";;;;;;AAkCA,IAAa,eAAb,MAA0B;CACxB,QAAkC,CAAC;CAEnC,IAAI,MAA4B;EAC9B,KAAK,MAAM,KAAK,IAAI;CACtB;CAEA,MAAiC;EAC/B,OAAO,KAAK;CACd;CAEA,QAAc;EACZ,KAAK,QAAQ,CAAC;CAChB;AACF;AAEA,MAAa,iBAAiB,IAAI,aAAa;;;;;;;;ACX/C,IAAa,eAAb,MAA0B;CACxB,QAAkC,CAAC;CAEnC,IAAI,MAA4B;EAC9B,KAAK,MAAM,KAAK,IAAI;CACtB;;;;;CAMA,IAAI,OAAkB,QAAsC;EAC1D,MAAM,WAAW,KAAK,MAAM,QAC1B,MAAK,EAAE,UAAU,SAAS,EAAE,WAAW,MACzC;EACA,OAAO,WAAW,UAAU,SAAS,QAAQ,IAAI;CACnD;CAEA,QAAc;EACZ,KAAK,QAAQ,CAAC;CAChB;AACF;AAEA,MAAa,qBAAqB,IAAI,aAAa;;;;;;AAOnD,eAAsB,SACpB,OACA,QACA,WAAyB,oBACV;CACf,KAAK,MAAM,QAAQ,SAAS,IAAI,OAAO,MAAM,GAC3C,MAAO,KAAK,GAAmB;AAEnC;AAKA,MAAM,eAAe,OAAO,IAAI,+BAA+B;;;;;;;;;;;;;;;AAgB/D,eAAsB,kBACpB,WAAyB,oBACV;CACf,MAAM,QAAQ;CACd,IAAI,MAAM,eAAe;CACzB,MAAM,gBAAgB;CAEtB,KAAK,MAAM,QAAQ,SAAS,IAAI,UAAU,QAAQ,GAChD,MAAO,KAAK,GAAmB;CAGjC,QAAQ,KAAK,oBAAoB;EAC/B,CAAM,YAAY;GAChB,KAAK,MAAM,QAAQ,SAAS,IAAI,UAAU,OAAO,GAC/C,MAAO,KAAK,GAAmB;EAEnC,EAAA,CAAG;CACL,CAAC;AACH"}
@@ -0,0 +1,82 @@
1
+ //#region src/runtime/registry.ts
2
+ /**
3
+ * A collection of registered steps. Deliberately a plain instance (not a hidden
4
+ * module global) so tests and the Vitest plugin can create isolated registries.
5
+ * `globalRegistry` is the default sink that `.step()` writes to.
6
+ */
7
+ var StepRegistry = class {
8
+ steps = [];
9
+ add(step) {
10
+ this.steps.push(step);
11
+ }
12
+ all() {
13
+ return this.steps;
14
+ }
15
+ clear() {
16
+ this.steps = [];
17
+ }
18
+ };
19
+ const globalRegistry = new StepRegistry();
20
+ //#endregion
21
+ //#region src/runtime/hooks.ts
22
+ /**
23
+ * Collection of registered hooks. Like {@link StepRegistry}, a plain instance
24
+ * (not a hidden global) so tests can isolate; `globalHookRegistry` is the
25
+ * default sink the public `beforeScenario`/`afterAll`/etc helpers write to.
26
+ */
27
+ var HookRegistry = class {
28
+ hooks = [];
29
+ add(hook) {
30
+ this.hooks.push(hook);
31
+ }
32
+ /**
33
+ * Hooks for a scope+timing. `before` hooks run in registration order;
34
+ * `after` hooks run in reverse (LIFO), so teardown unwinds setup.
35
+ */
36
+ for(scope, timing) {
37
+ const matching = this.hooks.filter((h) => h.scope === scope && h.timing === timing);
38
+ return timing === "after" ? matching.reverse() : matching;
39
+ }
40
+ clear() {
41
+ this.hooks = [];
42
+ }
43
+ };
44
+ const globalHookRegistry = new HookRegistry();
45
+ /**
46
+ * Run every registered feature/global hook of a scope+timing in order. Used by
47
+ * the generated test modules (feature hooks). Throws if a hook throws, so the
48
+ * runner reports it against the enclosing boundary.
49
+ */
50
+ async function runHooks(scope, timing, registry = globalHookRegistry) {
51
+ for (const hook of registry.for(scope, timing)) await hook.fn();
52
+ }
53
+ const GLOBAL_GUARD = Symbol.for("step-forge.globalHooksStarted");
54
+ /**
55
+ * Run global before-hooks once per worker, ahead of that worker's first
56
+ * scenario, and schedule global after-hooks for worker exit. Idempotent: every
57
+ * feature module calls this in a `beforeAll`, but only the first call in a given
58
+ * worker does anything.
59
+ *
60
+ * Semantics & caveats (the once-per-worker model):
61
+ * - Runs in the *same* realm as steps, so global setup may touch in-process
62
+ * state that steps later read.
63
+ * - "Once per worker", not strictly once per run — with multiple workers it runs
64
+ * in each. Size global setup to be worker-safe (e.g. a server per worker).
65
+ * - Teardown is best-effort: after-hooks start on the worker's `beforeExit` and
66
+ * are not awaited by the runner, so keep them fast/synchronous.
67
+ */
68
+ async function ensureGlobalHooks(registry = globalHookRegistry) {
69
+ const store = globalThis;
70
+ if (store[GLOBAL_GUARD]) return;
71
+ store[GLOBAL_GUARD] = true;
72
+ for (const hook of registry.for("global", "before")) await hook.fn();
73
+ process.once("beforeExit", () => {
74
+ (async () => {
75
+ for (const hook of registry.for("global", "after")) await hook.fn();
76
+ })();
77
+ });
78
+ }
79
+ //#endregion
80
+ export { StepRegistry as a, runHooks as i, ensureGlobalHooks as n, globalRegistry as o, globalHookRegistry as r, HookRegistry as t };
81
+
82
+ //# sourceMappingURL=hooks-CywugMQQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-CywugMQQ.js","names":[],"sources":["../../src/runtime/registry.ts","../../src/runtime/hooks.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Parser } from \"../parsers\";\nimport { MergeableWorld } from \"../world\";\n\nexport type StepType = \"given\" | \"when\" | \"then\";\n\n/**\n * A step definition as it exists at *runtime*, independent of any test runner.\n *\n * `execute` is the fully-wired step body: given a world and the raw values\n * captured from a Gherkin step, it applies parsers, validates + narrows\n * dependencies, runs the user's step function, and merges the result back into\n * the world. The engine never needs to know how any of that works — it just\n * matches text to a step and calls `execute`.\n */\nexport interface RegisteredStep {\n stepType: StepType;\n /** The Cucumber-expression source, e.g. `a user named {string}`. */\n expression: string;\n /** Parsers, one per captured variable, applied after expression capture. */\n parsers: Parser<any>[];\n execute: (\n world: MergeableWorld<any, any, any>,\n capturedArgs: unknown[]\n ) => Promise<void>;\n /** Where the step was defined, for ambiguous-match diagnostics. */\n source?: string;\n}\n\n/**\n * A collection of registered steps. Deliberately a plain instance (not a hidden\n * module global) so tests and the Vitest plugin can create isolated registries.\n * `globalRegistry` is the default sink that `.step()` writes to.\n */\nexport class StepRegistry {\n private steps: RegisteredStep[] = [];\n\n add(step: RegisteredStep): void {\n this.steps.push(step);\n }\n\n all(): readonly RegisteredStep[] {\n return this.steps;\n }\n\n clear(): void {\n this.steps = [];\n }\n}\n\nexport const globalRegistry = new StepRegistry();\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { MergeableWorld } from \"../world\";\n\n/**\n * Hooks are side-effect callbacks that run around scenarios, feature files, or\n * the whole run. Unlike steps they never seed state: state is owned end to end\n * by the typed dependency graph (given/when/then), and hooks exist for setup and\n * teardown (opening a DB, starting a server, resetting mocks). A scenario hook\n * may *read* the world, but its return value is ignored.\n */\nexport type HookScope = \"scenario\" | \"feature\" | \"global\";\nexport type HookTiming = \"before\" | \"after\";\n\n/** Lightweight scenario identity handed to per-scenario hooks. */\nexport interface ScenarioInfo {\n name: string;\n file: string;\n}\n\n/** A per-scenario hook: gets the scenario's world (read-only in spirit). */\nexport type ScenarioHookFn = (context: {\n world: MergeableWorld<any, any, any>;\n scenario: ScenarioInfo;\n}) => void | Promise<void>;\n\n/** A per-feature-file or global hook: no world exists at these boundaries. */\nexport type PlainHookFn = () => void | Promise<void>;\n\nexport interface RegisteredHook {\n scope: HookScope;\n timing: HookTiming;\n fn: ScenarioHookFn | PlainHookFn;\n}\n\n/**\n * Collection of registered hooks. Like {@link StepRegistry}, a plain instance\n * (not a hidden global) so tests can isolate; `globalHookRegistry` is the\n * default sink the public `beforeScenario`/`afterAll`/etc helpers write to.\n */\nexport class HookRegistry {\n private hooks: RegisteredHook[] = [];\n\n add(hook: RegisteredHook): void {\n this.hooks.push(hook);\n }\n\n /**\n * Hooks for a scope+timing. `before` hooks run in registration order;\n * `after` hooks run in reverse (LIFO), so teardown unwinds setup.\n */\n for(scope: HookScope, timing: HookTiming): RegisteredHook[] {\n const matching = this.hooks.filter(\n h => h.scope === scope && h.timing === timing\n );\n return timing === \"after\" ? matching.reverse() : matching;\n }\n\n clear(): void {\n this.hooks = [];\n }\n}\n\nexport const globalHookRegistry = new HookRegistry();\n\n/**\n * Run every registered feature/global hook of a scope+timing in order. Used by\n * the generated test modules (feature hooks). Throws if a hook throws, so the\n * runner reports it against the enclosing boundary.\n */\nexport async function runHooks(\n scope: \"feature\" | \"global\",\n timing: HookTiming,\n registry: HookRegistry = globalHookRegistry\n): Promise<void> {\n for (const hook of registry.for(scope, timing)) {\n await (hook.fn as PlainHookFn)();\n }\n}\n\n// Process-global (via Symbol.for so it survives module duplication) guard so\n// global hooks fire exactly once per worker, no matter how many feature modules\n// call in.\nconst GLOBAL_GUARD = Symbol.for(\"step-forge.globalHooksStarted\");\n\n/**\n * Run global before-hooks once per worker, ahead of that worker's first\n * scenario, and schedule global after-hooks for worker exit. Idempotent: every\n * feature module calls this in a `beforeAll`, but only the first call in a given\n * worker does anything.\n *\n * Semantics & caveats (the once-per-worker model):\n * - Runs in the *same* realm as steps, so global setup may touch in-process\n * state that steps later read.\n * - \"Once per worker\", not strictly once per run — with multiple workers it runs\n * in each. Size global setup to be worker-safe (e.g. a server per worker).\n * - Teardown is best-effort: after-hooks start on the worker's `beforeExit` and\n * are not awaited by the runner, so keep them fast/synchronous.\n */\nexport async function ensureGlobalHooks(\n registry: HookRegistry = globalHookRegistry\n): Promise<void> {\n const store = globalThis as Record<symbol, boolean>;\n if (store[GLOBAL_GUARD]) return;\n store[GLOBAL_GUARD] = true;\n\n for (const hook of registry.for(\"global\", \"before\")) {\n await (hook.fn as PlainHookFn)();\n }\n\n process.once(\"beforeExit\", () => {\n void (async () => {\n for (const hook of registry.for(\"global\", \"after\")) {\n await (hook.fn as PlainHookFn)();\n }\n })();\n });\n}\n"],"mappings":";;;;;;AAkCA,IAAa,eAAb,MAA0B;CACxB,QAAkC,CAAC;CAEnC,IAAI,MAA4B;EAC9B,KAAK,MAAM,KAAK,IAAI;CACtB;CAEA,MAAiC;EAC/B,OAAO,KAAK;CACd;CAEA,QAAc;EACZ,KAAK,QAAQ,CAAC;CAChB;AACF;AAEA,MAAa,iBAAiB,IAAI,aAAa;;;;;;;;ACX/C,IAAa,eAAb,MAA0B;CACxB,QAAkC,CAAC;CAEnC,IAAI,MAA4B;EAC9B,KAAK,MAAM,KAAK,IAAI;CACtB;;;;;CAMA,IAAI,OAAkB,QAAsC;EAC1D,MAAM,WAAW,KAAK,MAAM,QAC1B,MAAK,EAAE,UAAU,SAAS,EAAE,WAAW,MACzC;EACA,OAAO,WAAW,UAAU,SAAS,QAAQ,IAAI;CACnD;CAEA,QAAc;EACZ,KAAK,QAAQ,CAAC;CAChB;AACF;AAEA,MAAa,qBAAqB,IAAI,aAAa;;;;;;AAOnD,eAAsB,SACpB,OACA,QACA,WAAyB,oBACV;CACf,KAAK,MAAM,QAAQ,SAAS,IAAI,OAAO,MAAM,GAC3C,MAAO,KAAK,GAAmB;AAEnC;AAKA,MAAM,eAAe,OAAO,IAAI,+BAA+B;;;;;;;;;;;;;;;AAgB/D,eAAsB,kBACpB,WAAyB,oBACV;CACf,MAAM,QAAQ;CACd,IAAI,MAAM,eAAe;CACzB,MAAM,gBAAgB;CAEtB,KAAK,MAAM,QAAQ,SAAS,IAAI,UAAU,QAAQ,GAChD,MAAO,KAAK,GAAmB;CAGjC,QAAQ,KAAK,oBAAoB;EAC/B,CAAM,YAAY;GAChB,KAAK,MAAM,QAAQ,SAAS,IAAI,UAAU,OAAO,GAC/C,MAAO,KAAK,GAAmB;EAEnC,EAAA,CAAG;CACL,CAAC;AACH"}