@autometa/test-builder 0.1.3 → 0.1.4
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/.turbo/turbo-test.log +8 -8
- package/CHANGELOG.md +9 -0
- package/dist/esm/index.js +38 -19
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +33 -15
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
|
|
2
|
-
> @autometa/test-builder@0.1.
|
|
2
|
+
> @autometa/test-builder@0.1.3 test /Users/ben.aherne/Documents/GitHub/autometa/packages/test-builder
|
|
3
3
|
> vitest run --passWithNoTests
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
RUN v0.33.0 /Users/ben.aherne/Documents/GitHub/autometa/packages/test-builder
|
|
7
7
|
|
|
8
|
-
✓ src/
|
|
9
|
-
✓ src/
|
|
8
|
+
✓ src/bridges/bridge-query.spec.ts (1 test) 8ms
|
|
9
|
+
✓ src/gherkin-walker.spec.ts (1 test) 6ms
|
|
10
10
|
stdout | src/bridges/bridge-search.spec.ts > Bridge Search > findRuleType > should find a rule by name
|
|
11
11
|
My Rule
|
|
12
12
|
|
|
13
|
-
✓ src/bridges/bridge-search.spec.ts (18 tests)
|
|
14
|
-
✓ src/scope-search.spec.ts (12 tests)
|
|
15
|
-
✓ src/test-builder.spec.ts (12 tests)
|
|
13
|
+
✓ src/bridges/bridge-search.spec.ts (18 tests) 12ms
|
|
14
|
+
✓ src/scope-search.spec.ts (12 tests) 19ms
|
|
15
|
+
✓ src/test-builder.spec.ts (12 tests) 29ms
|
|
16
16
|
|
|
17
17
|
Test Files 5 passed (5)
|
|
18
18
|
Tests 44 passed (44)
|
|
19
|
-
Start at
|
|
20
|
-
Duration
|
|
19
|
+
Start at 15:46:00
|
|
20
|
+
Duration 1.06s (transform 484ms, setup 0ms, collect 3.25s, tests 74ms, environment 1ms, prepare 585ms)
|
|
21
21
|
|
package/CHANGELOG.md
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -24,8 +24,26 @@ var __privateMethod = (obj, member, method) => {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
// src/bridges/bridge.ts
|
|
27
|
+
import {
|
|
28
|
+
GherkinNode
|
|
29
|
+
} from "@autometa/gherkin";
|
|
27
30
|
var GherkinCodeBridge = class {
|
|
28
31
|
};
|
|
32
|
+
var GlobalBridge = class extends GherkinCodeBridge {
|
|
33
|
+
constructor(scope2) {
|
|
34
|
+
super();
|
|
35
|
+
const nullNode = class extends GherkinNode {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
this.keyword = "none";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
this.data = {
|
|
42
|
+
scope: scope2,
|
|
43
|
+
gherkin: new nullNode()
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
29
47
|
var FeatureBridge = class extends GherkinCodeBridge {
|
|
30
48
|
constructor() {
|
|
31
49
|
super(...arguments);
|
|
@@ -226,7 +244,7 @@ function findScenario(scenario, testName, from) {
|
|
|
226
244
|
|
|
227
245
|
// src/bridges/bridge-query.ts
|
|
228
246
|
import {
|
|
229
|
-
Background
|
|
247
|
+
Background as Background2
|
|
230
248
|
} from "@autometa/gherkin";
|
|
231
249
|
function failed(bridge) {
|
|
232
250
|
const accumulator = [];
|
|
@@ -270,7 +288,7 @@ function failedRule(bridge) {
|
|
|
270
288
|
return accumulator;
|
|
271
289
|
}
|
|
272
290
|
function gherkinToTestNames(node, path = "", accumulator = []) {
|
|
273
|
-
if (!("name" in node) || node instanceof
|
|
291
|
+
if (!("name" in node) || node instanceof Background2) {
|
|
274
292
|
return;
|
|
275
293
|
}
|
|
276
294
|
const title = `${node.keyword}: ${node.name}`;
|
|
@@ -280,7 +298,7 @@ function gherkinToTestNames(node, path = "", accumulator = []) {
|
|
|
280
298
|
return;
|
|
281
299
|
}
|
|
282
300
|
for (const child of node.children) {
|
|
283
|
-
if (!("name" in child) || child instanceof
|
|
301
|
+
if (!("name" in child) || child instanceof Background2) {
|
|
284
302
|
continue;
|
|
285
303
|
}
|
|
286
304
|
gherkinToTestNames(child, fullPath, accumulator);
|
|
@@ -296,16 +314,16 @@ var Query = {
|
|
|
296
314
|
|
|
297
315
|
// src/gherkin-walker.ts
|
|
298
316
|
import {
|
|
299
|
-
Background as
|
|
300
|
-
Examples,
|
|
301
|
-
Feature,
|
|
302
|
-
Rule,
|
|
303
|
-
Scenario,
|
|
304
|
-
ScenarioOutline,
|
|
305
|
-
Step
|
|
317
|
+
Background as Background3,
|
|
318
|
+
Examples as Examples2,
|
|
319
|
+
Feature as Feature2,
|
|
320
|
+
Rule as Rule2,
|
|
321
|
+
Scenario as Scenario2,
|
|
322
|
+
ScenarioOutline as ScenarioOutline2,
|
|
323
|
+
Step as Step2
|
|
306
324
|
} from "@autometa/gherkin";
|
|
307
325
|
import { AutomationError as AutomationError2 } from "@autometa/errors";
|
|
308
|
-
import { Example } from "@autometa/gherkin";
|
|
326
|
+
import { Example as Example2 } from "@autometa/gherkin";
|
|
309
327
|
var _walkNode, walkNode_fn, _walkChildren, walkChildren_fn;
|
|
310
328
|
var GherkinWalker = class {
|
|
311
329
|
static walk(walkFunction, childNode, accumulator, parentNode) {
|
|
@@ -320,27 +338,27 @@ var GherkinWalker = class {
|
|
|
320
338
|
};
|
|
321
339
|
_walkNode = new WeakSet();
|
|
322
340
|
walkNode_fn = function(child, accumulator, walkFunction, lastNode) {
|
|
323
|
-
if (child instanceof
|
|
341
|
+
if (child instanceof Feature2 && walkFunction.onFeature) {
|
|
324
342
|
const acc = walkFunction.onFeature(child, accumulator, lastNode);
|
|
325
343
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
326
344
|
}
|
|
327
|
-
if (child instanceof
|
|
345
|
+
if (child instanceof Rule2 && walkFunction.onRule) {
|
|
328
346
|
const acc = walkFunction.onRule(child, accumulator, lastNode);
|
|
329
347
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
330
348
|
}
|
|
331
|
-
if (child instanceof
|
|
349
|
+
if (child instanceof Examples2) {
|
|
332
350
|
const acc = walkFunction.onExamples?.(child, accumulator, lastNode);
|
|
333
351
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
334
352
|
}
|
|
335
|
-
if (child instanceof
|
|
353
|
+
if (child instanceof Example2) {
|
|
336
354
|
const acc = walkFunction.onExample?.(child, accumulator, lastNode);
|
|
337
355
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
338
356
|
}
|
|
339
|
-
if (child instanceof
|
|
357
|
+
if (child instanceof Scenario2) {
|
|
340
358
|
const acc = walkFunction.onScenario?.(child, accumulator, lastNode);
|
|
341
359
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
342
360
|
}
|
|
343
|
-
if (child instanceof
|
|
361
|
+
if (child instanceof ScenarioOutline2) {
|
|
344
362
|
const acc = walkFunction.onScenarioOutline?.(
|
|
345
363
|
child,
|
|
346
364
|
accumulator,
|
|
@@ -348,11 +366,11 @@ walkNode_fn = function(child, accumulator, walkFunction, lastNode) {
|
|
|
348
366
|
);
|
|
349
367
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
350
368
|
}
|
|
351
|
-
if (child instanceof
|
|
369
|
+
if (child instanceof Background3) {
|
|
352
370
|
const acc = walkFunction?.onBackground?.(child, accumulator, lastNode);
|
|
353
371
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
354
372
|
}
|
|
355
|
-
if (child instanceof
|
|
373
|
+
if (child instanceof Step2) {
|
|
356
374
|
const acc = walkFunction.onStep?.(child, accumulator, lastNode);
|
|
357
375
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
358
376
|
}
|
|
@@ -620,6 +638,7 @@ export {
|
|
|
620
638
|
FeatureBridge,
|
|
621
639
|
GherkinCodeBridge,
|
|
622
640
|
GherkinWalker,
|
|
641
|
+
GlobalBridge,
|
|
623
642
|
Query,
|
|
624
643
|
RuleBridge,
|
|
625
644
|
ScenarioBridge,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bridges/bridge.ts","../../src/bridges/bridge-search.ts","../../src/bridges/bridge-query.ts","../../src/gherkin-walker.ts","../../src/scope-search.ts","../../src/test-builder.ts"],"sourcesContent":["import {\n Background,\n DataTable,\n Example,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step\n} from \"@autometa/gherkin\";\nimport { BackgroundScope } from \"@autometa/scopes\";\nimport {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n ScenarioScope,\n Scope,\n StepScope\n} from \"@autometa/scopes\";\n\nexport abstract class GherkinCodeBridge {\n abstract data: { gherkin: GherkinNode; scope: Scope };\n}\nexport class FeatureBridge extends GherkinCodeBridge {\n data: { gherkin: Feature; scope: FeatureScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n rules: RuleBridge[] = [];\n steps: StepBridge[] = [];\n}\nexport class BackgroundBridge extends GherkinCodeBridge {\n data: { gherkin: Background; scope: BackgroundScope };\n steps: StepBridge[] = [];\n}\n\nexport class RuleBridge extends GherkinCodeBridge {\n data: { gherkin: Rule; scope: RuleScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class ScenarioBridge extends GherkinCodeBridge {\n data: { gherkin: Scenario; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n}\nexport class ExampleBridge extends GherkinCodeBridge {\n data: { gherkin: Example; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n}\nexport class ScenarioOutlineBridge extends GherkinCodeBridge {\n data: { gherkin: ScenarioOutline; scope: ScenarioOutlineScope };\n examples: ExamplesBridge[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class ExamplesBridge extends GherkinCodeBridge {\n data: { gherkin: Examples; scope: ScenarioOutlineScope };\n scenarios: ScenarioBridge[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class StepBridge extends GherkinCodeBridge {\n data: {\n gherkin: Step;\n scope: StepScope<string, DataTable | undefined>;\n args: unknown[];\n };\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport {\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n RuleBridge\n} from \"./bridge\";\n\nexport function find(\n bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n if (bridge instanceof FeatureBridge) {\n return findByFeature(bridge, testName);\n }\n if (bridge instanceof RuleBridge) {\n return findByRule(bridge, testName);\n }\n if (bridge instanceof ScenarioOutlineBridge) {\n return findScenarioOutlineOrChild(bridge, testName);\n }\n\n throw new AutomationError(`Could not find test matching ${testName}`);\n}\nfunction findByFeature(\n feature: FeatureBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = feature.data.scope.title(feature.data.gherkin);\n const byScenario = findTestTypes(feature.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleTypes(feature.rules, testName, title);\n if (byRule) {\n return byRule;\n }\n}\nfunction findByRule(\n rule: RuleBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = rule.data.scope.title(rule.data.gherkin);\n const byScenario = findTestTypes(rule.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleOrChild(rule, testName, title);\n if (byRule) {\n return byRule;\n }\n}\n\nexport function findTestTypes(\n scenarios: (ScenarioBridge | ScenarioOutlineBridge | ExamplesBridge)[],\n testName: string,\n from?: string\n) {\n for (const scenario of scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n const found = findScenarioOutlineOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ExamplesBridge) {\n const found = findExamplesOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ScenarioBridge) {\n const found = findScenario(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n }\n}\n\nexport function findRuleTypes(\n rules: RuleBridge[],\n testName: string,\n from?: string\n) {\n for (const rule of rules) {\n const found = findRuleOrChild(rule, testName, from);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findRuleOrChild(\n rule: RuleBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = rule;\n const title = scope.title(gherkin);\n if (testName === title) {\n return rule;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return rule;\n }\n }\n const newFrom = appendPath(from, title);\n return findTestTypes(rule.scenarios, testName, newFrom);\n}\n\nexport function findScenarioOutlineOrChild(\n outline: ScenarioOutlineBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = outline;\n const title = scope.title(gherkin);\n if (testName === title) {\n return outline;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return outline;\n }\n }\n for (const example of outline.examples) {\n const newFrom = appendPath(from, title);\n const found = findExamplesOrChild(example, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nfunction appendPath(from: string | undefined, title: string) {\n return from ? `${from} ${title}` : title;\n}\n\nexport function findExamplesOrChild(\n example: ExamplesBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = example;\n const title = scope.title(gherkin);\n if (testName === title) {\n return example;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return example;\n }\n }\n for (const scenario of example.scenarios) {\n const newFrom = appendPath(from, title);\n const found = findScenario(scenario, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findScenario(\n scenario: ScenarioBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = scenario;\n const title = scope.title(gherkin);\n if (testName === title) {\n return scenario;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return scenario;\n }\n }\n}\n","import {\n Background,\n GherkinNode} from \"@autometa/gherkin\";\nimport {\n FeatureBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge\n} from \".\";\n\nfunction failed(bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n if (bridge instanceof ScenarioOutlineBridge) {\n return failedOutline(bridge);\n }\n for (const scenario of bridge.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n if (bridge instanceof FeatureBridge) {\n accumulator.push(...failedRule(bridge));\n }\n return accumulator;\n}\n\nfunction failedOutline(bridge: ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n\n for (const example of bridge.examples) {\n for (const scenario of example.scenarios) {\n if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction failedRule(bridge: FeatureBridge) {\n const accumulator: ScenarioBridge[] = [];\n for (const rule of bridge.rules) {\n for (const scenario of rule.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction gherkinToTestNames(\n node: GherkinNode,\n path = \"\",\n accumulator: string[] = []\n) {\n if (!(\"name\" in node) || node instanceof Background) {\n return;\n }\n const title = `${node.keyword}: ${node.name}`;\n const fullPath = path ? `${path} ${title}` : title;\n accumulator.push(fullPath);\n if (!node.children) {\n return;\n }\n for (const child of node.children) {\n if (!(\"name\" in child) || child instanceof Background) {\n continue;\n }\n gherkinToTestNames(child, fullPath, accumulator);\n }\n return accumulator;\n}\n\nexport const Query = {\n find: {\n failed\n },\n testNames: gherkinToTestNames\n};\n","import {\n Background,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step\n} from \"@autometa/gherkin\";\nimport { AutomationError } from \"@autometa/errors\";\nimport { Example } from \"@autometa/gherkin\";\n\nexport type WalkFunction<T extends GherkinNode, TAccumulator, TReturn> = (\n node: T,\n accumulator: TAccumulator,\n lastNode?: GherkinNode\n) => TReturn;\n\nexport type WalkFunctionMap<TAccumulator> = {\n onFeature?: WalkFunction<Feature, TAccumulator, TAccumulator>;\n onRule?: WalkFunction<Rule, TAccumulator, TAccumulator>;\n onBackground?: WalkFunction<Background, TAccumulator, TAccumulator>;\n onScenario?: WalkFunction<Scenario, TAccumulator, TAccumulator>;\n onScenarioOutline?: WalkFunction<ScenarioOutline, TAccumulator, TAccumulator>;\n onExamples?: WalkFunction<Examples, TAccumulator, TAccumulator>;\n onExample?: WalkFunction<Example, TAccumulator, TAccumulator>;\n onStep?: WalkFunction<Step, TAccumulator, TAccumulator>;\n};\n\nexport class GherkinWalker {\n static walk<TAccumulator>(\n walkFunction: WalkFunctionMap<TAccumulator>,\n childNode: GherkinNode,\n accumulator: TAccumulator,\n parentNode?: GherkinNode\n ) {\n if (accumulator === undefined) {\n throw new AutomationError(\n `An accumulator must be defined to continue the walker from ${\n childNode.constructor.name\n }${JSON.stringify(childNode)}`\n );\n }\n this.#walkNode(childNode, accumulator, walkFunction, parentNode);\n return accumulator;\n }\n\n static #walkNode<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n walkFunction: WalkFunctionMap<TAccumulator>,\n lastNode?: GherkinNode\n ) {\n if (child instanceof Feature && walkFunction.onFeature) {\n const acc = walkFunction.onFeature(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Rule && walkFunction.onRule) {\n const acc = walkFunction.onRule(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Examples) {\n const acc = walkFunction.onExamples?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Example) {\n const acc = walkFunction.onExample?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Scenario) {\n const acc = walkFunction.onScenario?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof ScenarioOutline) {\n const acc = walkFunction.onScenarioOutline?.(\n child,\n accumulator,\n lastNode\n );\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Background) {\n const acc = walkFunction?.onBackground?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Step) {\n const acc = walkFunction.onStep?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n }\n\n static #walkChildren<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walkFunction: WalkFunctionMap<any>\n ) {\n for (const node of child.children) {\n this.walk(walkFunction, node, accumulator, child);\n }\n }\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport { StepKeyword } from \"@autometa/gherkin\";\nimport { StepType } from \"@autometa/gherkin\";\nimport {\n Scope,\n RuleScope,\n ScenarioScope,\n ScenarioOutlineScope,\n BackgroundScope\n} from \"@autometa/scopes\";\nimport { Empty_Function } from \"@autometa/scopes\";\n\nexport function scope(value: Scope) {\n return {\n findRule: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return child instanceof RuleScope && child.name === name;\n }) as RuleScope | undefined;\n if (!found) {\n const rule = new RuleScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(rule);\n return rule;\n }\n return found;\n },\n findScenario: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return (\n child instanceof ScenarioScope &&\n child.name === name &&\n !(child instanceof ScenarioOutlineScope)\n );\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findBackground: ({ name }: { name?: string }): BackgroundScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof BackgroundScope;\n }) as BackgroundScope | undefined;\n if (found && found.name !== name) {\n throw new AutomationError(\n `Could not find background matching ${name} but found ${found?.name}`\n );\n }\n if (found) {\n return found;\n }\n\n const bgScope = new BackgroundScope(\n name,\n Empty_Function,\n value.hooks,\n value.steps\n );\n value.attach(bgScope);\n return bgScope;\n },\n findScenarioOutline: (name: string): ScenarioOutlineScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof ScenarioOutlineScope && child.name === name;\n }) as ScenarioOutlineScope | undefined;\n if (!found) {\n const scenarioOutline = new ScenarioOutlineScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenarioOutline);\n return scenarioOutline;\n }\n return found;\n },\n findExample(name: string): ScenarioScope {\n const found = value.closedScopes.find((child) => {\n if (!(child instanceof ScenarioScope)) {\n return false;\n }\n return child.name === name;\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findStep: (keywordType: StepType, keyword: StepKeyword, name: string) => {\n return value.steps.find(keywordType, keyword, name);\n }\n };\n}\n","import {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n StepCache\n} from \"@autometa/scopes\";\nimport {\n BackgroundBridge,\n ExampleBridge,\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n StepBridge\n} from \"./bridges\";\nimport { GherkinWalker } from \"./gherkin-walker\";\nimport { scope } from \"./scope-search\";\nimport { Bind } from \"@autometa/bind-decorator\";\nimport {\n Example,\n Feature,\n GherkinNode,\n Scenario,\n scenarioExampleTitle\n} from \"@autometa/gherkin\";\nimport { raise } from \"@autometa/errors\";\nimport { StepKeyword, StepType } from \"@autometa/types\";\nexport class TestBuilder {\n constructor(readonly feature: Feature) {}\n @Bind\n onFeatureExecuted(featureScope: FeatureScope) {\n const bridge = new FeatureBridge();\n GherkinWalker.walk<GherkinCodeBridge>(\n {\n onFeature: (feature, accumulator) => {\n accumulator.data = { gherkin: feature, scope: featureScope };\n return accumulator;\n },\n onRule: (rule, accumulator) => {\n const ruleScope = scope(featureScope).findRule(\n rule.name\n ) as RuleScope;\n const bridge = new RuleBridge();\n bridge.data = { gherkin: rule, scope: ruleScope };\n (accumulator as FeatureBridge).rules.push(bridge);\n return bridge;\n },\n onScenario: (gherkin, accumulator) => {\n const scenarioScope = scope(accumulator.data.scope).findScenario(\n gherkin.name\n );\n const bridge = new ScenarioBridge();\n bridge.data = { gherkin, scope: scenarioScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n // if accumulator is a outline, push to examples\n\n return bridge;\n },\n onScenarioOutline: (gherkin, accumulator) => {\n const outlineScope = scope(\n accumulator.data.scope\n ).findScenarioOutline(gherkin.name);\n const bridge = new ScenarioOutlineBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n return bridge;\n },\n onExamples: (gherkin, accumulator) => {\n const outlineScope = accumulator.data.scope as ScenarioOutlineScope;\n const bridge = new ExamplesBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as ScenarioOutlineBridge).examples.push(bridge);\n return bridge;\n },\n onExample(gherkin, accumulator) {\n if (gherkin.table === undefined) {\n raise(\n `Example ${gherkin.name} has no Example Table data. A Row of data is required.`\n );\n }\n const titleSegments = Object.keys(gherkin.table);\n const values = Object.values(gherkin.table);\n const title = scenarioExampleTitle(\n titleSegments,\n gherkin.name,\n values\n );\n\n const exampleScope = scope(accumulator.data.scope).findExample(title);\n const bridge = new ExampleBridge();\n bridge.data = { gherkin, scope: exampleScope };\n const acc = accumulator as ExamplesBridge;\n acc.scenarios.push(bridge);\n return bridge;\n },\n onBackground(gherkin, accumulator) {\n const backgroundScope = scope(accumulator.data.scope).findBackground({\n name: gherkin.name\n });\n const bridge = new BackgroundBridge();\n bridge.data = { gherkin, scope: backgroundScope };\n const acc = accumulator as FeatureBridge | RuleBridge;\n acc.background = bridge;\n return bridge;\n },\n onStep: (step, accumulator) => {\n const {\n data: { scope: parentScope, gherkin }\n } = accumulator;\n const { keyword, keywordType, text } = step;\n const cache = parentScope.steps;\n const existing = getStep(\n accumulator,\n gherkin,\n cache,\n keywordType,\n keyword,\n text\n );\n const bridge = new StepBridge();\n const acc = accumulator as\n | BackgroundBridge\n | ScenarioBridge\n | RuleBridge\n | FeatureBridge;\n\n if (existing) {\n bridge.data = {\n gherkin: step,\n scope: existing.step,\n args: existing.args\n };\n } else {\n raise(`No step definition matching ${step.keyword} ${step.text}`);\n }\n\n acc.steps.push(bridge);\n return accumulator;\n }\n },\n this.feature,\n bridge\n );\n return bridge;\n }\n}\nfunction getStep(\n accumulator: GherkinCodeBridge,\n gherkin: GherkinNode,\n cache: StepCache,\n keywordType: StepType,\n keyword: StepKeyword,\n text: string\n) {\n try {\n if (accumulator instanceof ExampleBridge) {\n const scenario = gherkin as Example;\n if (scenario.table) {\n return cache.findByExample(keywordType, keyword, text, scenario.table);\n }\n }\n return cache.find(keywordType, keyword, text);\n } catch (e) {\n const cause = e as Error;\n const { title } = gherkin as Scenario;\n raise(\n `'${title}' could not find a step definition`,\n { cause }\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,IAAe,oBAAf,MAAiC;AAExC;AACO,IAAM,gBAAN,cAA4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eAAO,MAAM,cAAc,aAAa,SAAS,MAAM,SAAS,KAAK;AAAA,MACvE;AAAA,IACF;AACA,WAAO,MAAM,KAAK,aAAa,SAAS,IAAI;AAAA,EAC9C,SAAS,GAAG;AACV,UAAM,QAAQ;AACd,UAAM,EAAE,MAAM,IAAI;AAClB;AAAA,MACE,IAAI,KAAK;AAAA,MACT,EAAE,MAAM;AAAA,IACV;AAAA,EACF;AACF;","names":["scope","Background","AutomationError","AutomationError","Background","AutomationError","bridge"]}
|
|
1
|
+
{"version":3,"sources":["../../src/bridges/bridge.ts","../../src/bridges/bridge-search.ts","../../src/bridges/bridge-query.ts","../../src/gherkin-walker.ts","../../src/scope-search.ts","../../src/test-builder.ts"],"sourcesContent":["import {\n Background,\n DataTable,\n Example,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step\n} from \"@autometa/gherkin\";\nimport { BackgroundScope, GlobalScope } from \"@autometa/scopes\";\nimport {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n ScenarioScope,\n Scope,\n StepScope\n} from \"@autometa/scopes\";\n\nexport abstract class GherkinCodeBridge {\n abstract data: { gherkin: GherkinNode; scope: Scope };\n}\nexport class GlobalBridge extends GherkinCodeBridge {\n readonly data: { gherkin: GherkinNode; scope: GlobalScope };\n constructor(scope: GlobalScope) {\n super();\n const nullNode = class extends GherkinNode {\n keyword = \"none\";\n };\n this.data = {\n scope,\n gherkin: new nullNode()\n };\n }\n}\nexport class FeatureBridge extends GherkinCodeBridge {\n data: { gherkin: Feature; scope: FeatureScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n rules: RuleBridge[] = [];\n steps: StepBridge[] = [];\n}\nexport class BackgroundBridge extends GherkinCodeBridge {\n data: { gherkin: Background; scope: BackgroundScope };\n steps: StepBridge[] = [];\n}\n\nexport class RuleBridge extends GherkinCodeBridge {\n data: { gherkin: Rule; scope: RuleScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class ScenarioBridge extends GherkinCodeBridge {\n data: { gherkin: Scenario; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n}\nexport class ExampleBridge extends GherkinCodeBridge {\n data: { gherkin: Example; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n}\nexport class ScenarioOutlineBridge extends GherkinCodeBridge {\n data: { gherkin: ScenarioOutline; scope: ScenarioOutlineScope };\n examples: ExamplesBridge[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class ExamplesBridge extends GherkinCodeBridge {\n data: { gherkin: Examples; scope: ScenarioOutlineScope };\n scenarios: ScenarioBridge[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class StepBridge extends GherkinCodeBridge {\n data: {\n gherkin: Step;\n scope: StepScope<string, DataTable | undefined>;\n args: unknown[];\n };\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport {\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n RuleBridge\n} from \"./bridge\";\n\nexport function find(\n bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n if (bridge instanceof FeatureBridge) {\n return findByFeature(bridge, testName);\n }\n if (bridge instanceof RuleBridge) {\n return findByRule(bridge, testName);\n }\n if (bridge instanceof ScenarioOutlineBridge) {\n return findScenarioOutlineOrChild(bridge, testName);\n }\n\n throw new AutomationError(`Could not find test matching ${testName}`);\n}\nfunction findByFeature(\n feature: FeatureBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = feature.data.scope.title(feature.data.gherkin);\n const byScenario = findTestTypes(feature.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleTypes(feature.rules, testName, title);\n if (byRule) {\n return byRule;\n }\n}\nfunction findByRule(\n rule: RuleBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = rule.data.scope.title(rule.data.gherkin);\n const byScenario = findTestTypes(rule.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleOrChild(rule, testName, title);\n if (byRule) {\n return byRule;\n }\n}\n\nexport function findTestTypes(\n scenarios: (ScenarioBridge | ScenarioOutlineBridge | ExamplesBridge)[],\n testName: string,\n from?: string\n) {\n for (const scenario of scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n const found = findScenarioOutlineOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ExamplesBridge) {\n const found = findExamplesOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ScenarioBridge) {\n const found = findScenario(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n }\n}\n\nexport function findRuleTypes(\n rules: RuleBridge[],\n testName: string,\n from?: string\n) {\n for (const rule of rules) {\n const found = findRuleOrChild(rule, testName, from);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findRuleOrChild(\n rule: RuleBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = rule;\n const title = scope.title(gherkin);\n if (testName === title) {\n return rule;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return rule;\n }\n }\n const newFrom = appendPath(from, title);\n return findTestTypes(rule.scenarios, testName, newFrom);\n}\n\nexport function findScenarioOutlineOrChild(\n outline: ScenarioOutlineBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = outline;\n const title = scope.title(gherkin);\n if (testName === title) {\n return outline;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return outline;\n }\n }\n for (const example of outline.examples) {\n const newFrom = appendPath(from, title);\n const found = findExamplesOrChild(example, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nfunction appendPath(from: string | undefined, title: string) {\n return from ? `${from} ${title}` : title;\n}\n\nexport function findExamplesOrChild(\n example: ExamplesBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = example;\n const title = scope.title(gherkin);\n if (testName === title) {\n return example;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return example;\n }\n }\n for (const scenario of example.scenarios) {\n const newFrom = appendPath(from, title);\n const found = findScenario(scenario, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findScenario(\n scenario: ScenarioBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = scenario;\n const title = scope.title(gherkin);\n if (testName === title) {\n return scenario;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return scenario;\n }\n }\n}\n","import {\n Background,\n GherkinNode} from \"@autometa/gherkin\";\nimport {\n FeatureBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge\n} from \".\";\n\nfunction failed(bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n if (bridge instanceof ScenarioOutlineBridge) {\n return failedOutline(bridge);\n }\n for (const scenario of bridge.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n if (bridge instanceof FeatureBridge) {\n accumulator.push(...failedRule(bridge));\n }\n return accumulator;\n}\n\nfunction failedOutline(bridge: ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n\n for (const example of bridge.examples) {\n for (const scenario of example.scenarios) {\n if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction failedRule(bridge: FeatureBridge) {\n const accumulator: ScenarioBridge[] = [];\n for (const rule of bridge.rules) {\n for (const scenario of rule.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction gherkinToTestNames(\n node: GherkinNode,\n path = \"\",\n accumulator: string[] = []\n) {\n if (!(\"name\" in node) || node instanceof Background) {\n return;\n }\n const title = `${node.keyword}: ${node.name}`;\n const fullPath = path ? `${path} ${title}` : title;\n accumulator.push(fullPath);\n if (!node.children) {\n return;\n }\n for (const child of node.children) {\n if (!(\"name\" in child) || child instanceof Background) {\n continue;\n }\n gherkinToTestNames(child, fullPath, accumulator);\n }\n return accumulator;\n}\n\nexport const Query = {\n find: {\n failed\n },\n testNames: gherkinToTestNames\n};\n","import {\n Background,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step\n} from \"@autometa/gherkin\";\nimport { AutomationError } from \"@autometa/errors\";\nimport { Example } from \"@autometa/gherkin\";\n\nexport type WalkFunction<T extends GherkinNode, TAccumulator, TReturn> = (\n node: T,\n accumulator: TAccumulator,\n lastNode?: GherkinNode\n) => TReturn;\n\nexport type WalkFunctionMap<TAccumulator> = {\n onFeature?: WalkFunction<Feature, TAccumulator, TAccumulator>;\n onRule?: WalkFunction<Rule, TAccumulator, TAccumulator>;\n onBackground?: WalkFunction<Background, TAccumulator, TAccumulator>;\n onScenario?: WalkFunction<Scenario, TAccumulator, TAccumulator>;\n onScenarioOutline?: WalkFunction<ScenarioOutline, TAccumulator, TAccumulator>;\n onExamples?: WalkFunction<Examples, TAccumulator, TAccumulator>;\n onExample?: WalkFunction<Example, TAccumulator, TAccumulator>;\n onStep?: WalkFunction<Step, TAccumulator, TAccumulator>;\n};\n\nexport class GherkinWalker {\n static walk<TAccumulator>(\n walkFunction: WalkFunctionMap<TAccumulator>,\n childNode: GherkinNode,\n accumulator: TAccumulator,\n parentNode?: GherkinNode\n ) {\n if (accumulator === undefined) {\n throw new AutomationError(\n `An accumulator must be defined to continue the walker from ${\n childNode.constructor.name\n }${JSON.stringify(childNode)}`\n );\n }\n this.#walkNode(childNode, accumulator, walkFunction, parentNode);\n return accumulator;\n }\n\n static #walkNode<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n walkFunction: WalkFunctionMap<TAccumulator>,\n lastNode?: GherkinNode\n ) {\n if (child instanceof Feature && walkFunction.onFeature) {\n const acc = walkFunction.onFeature(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Rule && walkFunction.onRule) {\n const acc = walkFunction.onRule(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Examples) {\n const acc = walkFunction.onExamples?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Example) {\n const acc = walkFunction.onExample?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Scenario) {\n const acc = walkFunction.onScenario?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof ScenarioOutline) {\n const acc = walkFunction.onScenarioOutline?.(\n child,\n accumulator,\n lastNode\n );\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Background) {\n const acc = walkFunction?.onBackground?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Step) {\n const acc = walkFunction.onStep?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n }\n\n static #walkChildren<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walkFunction: WalkFunctionMap<any>\n ) {\n for (const node of child.children) {\n this.walk(walkFunction, node, accumulator, child);\n }\n }\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport { StepKeyword } from \"@autometa/gherkin\";\nimport { StepType } from \"@autometa/gherkin\";\nimport {\n Scope,\n RuleScope,\n ScenarioScope,\n ScenarioOutlineScope,\n BackgroundScope\n} from \"@autometa/scopes\";\nimport { Empty_Function } from \"@autometa/scopes\";\n\nexport function scope(value: Scope) {\n return {\n findRule: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return child instanceof RuleScope && child.name === name;\n }) as RuleScope | undefined;\n if (!found) {\n const rule = new RuleScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(rule);\n return rule;\n }\n return found;\n },\n findScenario: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return (\n child instanceof ScenarioScope &&\n child.name === name &&\n !(child instanceof ScenarioOutlineScope)\n );\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findBackground: ({ name }: { name?: string }): BackgroundScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof BackgroundScope;\n }) as BackgroundScope | undefined;\n if (found && found.name !== name) {\n throw new AutomationError(\n `Could not find background matching ${name} but found ${found?.name}`\n );\n }\n if (found) {\n return found;\n }\n\n const bgScope = new BackgroundScope(\n name,\n Empty_Function,\n value.hooks,\n value.steps\n );\n value.attach(bgScope);\n return bgScope;\n },\n findScenarioOutline: (name: string): ScenarioOutlineScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof ScenarioOutlineScope && child.name === name;\n }) as ScenarioOutlineScope | undefined;\n if (!found) {\n const scenarioOutline = new ScenarioOutlineScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenarioOutline);\n return scenarioOutline;\n }\n return found;\n },\n findExample(name: string): ScenarioScope {\n const found = value.closedScopes.find((child) => {\n if (!(child instanceof ScenarioScope)) {\n return false;\n }\n return child.name === name;\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findStep: (keywordType: StepType, keyword: StepKeyword, name: string) => {\n return value.steps.find(keywordType, keyword, name);\n }\n };\n}\n","import {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n StepCache\n} from \"@autometa/scopes\";\nimport {\n BackgroundBridge,\n ExampleBridge,\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n StepBridge\n} from \"./bridges\";\nimport { GherkinWalker } from \"./gherkin-walker\";\nimport { scope } from \"./scope-search\";\nimport { Bind } from \"@autometa/bind-decorator\";\nimport {\n Example,\n Feature,\n GherkinNode,\n Scenario,\n scenarioExampleTitle\n} from \"@autometa/gherkin\";\nimport { raise } from \"@autometa/errors\";\nimport { StepKeyword, StepType } from \"@autometa/types\";\nexport class TestBuilder {\n constructor(readonly feature: Feature) {}\n @Bind\n onFeatureExecuted(featureScope: FeatureScope) {\n const bridge = new FeatureBridge();\n GherkinWalker.walk<GherkinCodeBridge>(\n {\n onFeature: (feature, accumulator) => {\n accumulator.data = { gherkin: feature, scope: featureScope };\n return accumulator;\n },\n onRule: (rule, accumulator) => {\n const ruleScope = scope(featureScope).findRule(\n rule.name\n ) as RuleScope;\n const bridge = new RuleBridge();\n bridge.data = { gherkin: rule, scope: ruleScope };\n (accumulator as FeatureBridge).rules.push(bridge);\n return bridge;\n },\n onScenario: (gherkin, accumulator) => {\n const scenarioScope = scope(accumulator.data.scope).findScenario(\n gherkin.name\n );\n const bridge = new ScenarioBridge();\n bridge.data = { gherkin, scope: scenarioScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n // if accumulator is a outline, push to examples\n\n return bridge;\n },\n onScenarioOutline: (gherkin, accumulator) => {\n const outlineScope = scope(\n accumulator.data.scope\n ).findScenarioOutline(gherkin.name);\n const bridge = new ScenarioOutlineBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n return bridge;\n },\n onExamples: (gherkin, accumulator) => {\n const outlineScope = accumulator.data.scope as ScenarioOutlineScope;\n const bridge = new ExamplesBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as ScenarioOutlineBridge).examples.push(bridge);\n return bridge;\n },\n onExample(gherkin, accumulator) {\n if (gherkin.table === undefined) {\n raise(\n `Example ${gherkin.name} has no Example Table data. A Row of data is required.`\n );\n }\n const titleSegments = Object.keys(gherkin.table);\n const values = Object.values(gherkin.table);\n const title = scenarioExampleTitle(\n titleSegments,\n gherkin.name,\n values\n );\n\n const exampleScope = scope(accumulator.data.scope).findExample(title);\n const bridge = new ExampleBridge();\n bridge.data = { gherkin, scope: exampleScope };\n const acc = accumulator as ExamplesBridge;\n acc.scenarios.push(bridge);\n return bridge;\n },\n onBackground(gherkin, accumulator) {\n const backgroundScope = scope(accumulator.data.scope).findBackground({\n name: gherkin.name\n });\n const bridge = new BackgroundBridge();\n bridge.data = { gherkin, scope: backgroundScope };\n const acc = accumulator as FeatureBridge | RuleBridge;\n acc.background = bridge;\n return bridge;\n },\n onStep: (step, accumulator) => {\n const {\n data: { scope: parentScope, gherkin }\n } = accumulator;\n const { keyword, keywordType, text } = step;\n const cache = parentScope.steps;\n const existing = getStep(\n accumulator,\n gherkin,\n cache,\n keywordType,\n keyword,\n text\n );\n const bridge = new StepBridge();\n const acc = accumulator as\n | BackgroundBridge\n | ScenarioBridge\n | RuleBridge\n | FeatureBridge;\n\n if (existing) {\n bridge.data = {\n gherkin: step,\n scope: existing.step,\n args: existing.args\n };\n } else {\n raise(`No step definition matching ${step.keyword} ${step.text}`);\n }\n\n acc.steps.push(bridge);\n return accumulator;\n }\n },\n this.feature,\n bridge\n );\n return bridge;\n }\n}\nfunction getStep(\n accumulator: GherkinCodeBridge,\n gherkin: GherkinNode,\n cache: StepCache,\n keywordType: StepType,\n keyword: StepKeyword,\n text: string\n) {\n try {\n if (accumulator instanceof ExampleBridge) {\n const scenario = gherkin as Example;\n if (scenario.table) {\n return cache.findByExample(keywordType, keyword, text, scenario.table);\n }\n }\n return cache.find(keywordType, keyword, text);\n } catch (e) {\n const cause = e as Error;\n const { title } = gherkin as Scenario;\n raise(\n `'${title}' could not find a step definition`,\n { cause }\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EAME;AAAA,OAKK;AAWA,IAAe,oBAAf,MAAiC;AAExC;AACO,IAAM,eAAN,cAA2B,kBAAkB;AAAA,EAElD,YAAYA,QAAoB;AAC9B,UAAM;AACN,UAAM,WAAW,cAAc,YAAY;AAAA,MAA1B;AAAA;AACf,uBAAU;AAAA;AAAA,IACZ;AACA,SAAK,OAAO;AAAA,MACV,OAAAA;AAAA,MACA,SAAS,IAAI,SAAS;AAAA,IACxB;AAAA,EACF;AACF;AACO,IAAM,gBAAN,cAA4B,kBAAkB;AAAA,EAA9C;AAAA;AAGL,qBAAwD,CAAC;AACzD,iBAAsB,CAAC;AACvB,iBAAsB,CAAC;AAAA;AACzB;AACO,IAAM,mBAAN,cAA+B,kBAAkB;AAAA,EAAjD;AAAA;AAEL,iBAAsB,CAAC;AAAA;AACzB;AAEO,IAAM,aAAN,cAAyB,kBAAkB;AAAA,EAA3C;AAAA;AAGL,qBAAwD,CAAC;AACzD,iBAAsB,CAAC;AAAA;AACzB;AAEO,IAAM,iBAAN,cAA6B,kBAAkB;AAAA,EAA/C;AAAA;AAEL,iBAAsB,CAAC;AACvB,kBAGI,CAAC;AAAA;AACP;AACO,IAAM,gBAAN,cAA4B,kBAAkB;AAAA,EAA9C;AAAA;AAEL,iBAAsB,CAAC;AACvB,kBAGI,CAAC;AAAA;AACP;AACO,IAAM,wBAAN,cAAoC,kBAAkB;AAAA,EAAtD;AAAA;AAEL,oBAA6B,CAAC;AAC9B,iBAAsB,CAAC;AAAA;AACzB;AAEO,IAAM,iBAAN,cAA6B,kBAAkB;AAAA,EAA/C;AAAA;AAEL,qBAA8B,CAAC;AAC/B,iBAAsB,CAAC;AAAA;AACzB;AAEO,IAAM,aAAN,cAAyB,kBAAkB;AAMlD;;;AC3FA,SAAS,uBAAu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9B,gBAAM,MAAM;AAMZ,cAAI,UAAU;AACZ,YAAAA,QAAO,OAAO;AAAA,cACZ,SAAS;AAAA,cACT,OAAO,SAAS;AAAA,cAChB,MAAM,SAAS;AAAA,YACjB;AAAA,UACF,OAAO;AACL,kBAAM,+BAA+B,KAAK,OAAO,IAAI,KAAK,IAAI,EAAE;AAAA,UAClE;AAEA,cAAI,MAAM,KAAKA,OAAM;AACrB,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA,KAAK;AAAA,MACL;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;AAnHE;AAAA,EADC;AAAA,GAFU,YAGX;AAoHF,SAAS,QACP,aACA,SACA,OACA,aACA,SACA,MACA;AACA,MAAI;AACF,QAAI,uBAAuB,eAAe;AACxC,YAAM,WAAW;AACjB,UAAI,SAAS,OAAO;AAClB,eAAO,MAAM,cAAc,aAAa,SAAS,MAAM,SAAS,KAAK;AAAA,MACvE;AAAA,IACF;AACA,WAAO,MAAM,KAAK,aAAa,SAAS,IAAI;AAAA,EAC9C,SAAS,GAAG;AACV,UAAM,QAAQ;AACd,UAAM,EAAE,MAAM,IAAI;AAClB;AAAA,MACE,IAAI,KAAK;AAAA,MACT,EAAE,MAAM;AAAA,IACV;AAAA,EACF;AACF;","names":["scope","scope","Background","Background","Background","Examples","Feature","Rule","Scenario","ScenarioOutline","Step","AutomationError","Example","AutomationError","Feature","Rule","Examples","Example","Scenario","ScenarioOutline","Background","Step","AutomationError","bridge"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GherkinNode, Feature, Background, Rule, Scenario, Example, ScenarioOutline, Examples, Step, DataTable, StepType, StepKeyword } from '@autometa/gherkin';
|
|
2
2
|
import * as _autometa_scopes from '@autometa/scopes';
|
|
3
|
-
import { Scope, FeatureScope, BackgroundScope, RuleScope, ScenarioScope, ScenarioOutlineScope, StepScope } from '@autometa/scopes';
|
|
3
|
+
import { Scope, GlobalScope, FeatureScope, BackgroundScope, RuleScope, ScenarioScope, ScenarioOutlineScope, StepScope } from '@autometa/scopes';
|
|
4
4
|
|
|
5
5
|
declare abstract class GherkinCodeBridge {
|
|
6
6
|
abstract data: {
|
|
@@ -8,6 +8,13 @@ declare abstract class GherkinCodeBridge {
|
|
|
8
8
|
scope: Scope;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
+
declare class GlobalBridge extends GherkinCodeBridge {
|
|
12
|
+
readonly data: {
|
|
13
|
+
gherkin: GherkinNode;
|
|
14
|
+
scope: GlobalScope;
|
|
15
|
+
};
|
|
16
|
+
constructor(scope: GlobalScope);
|
|
17
|
+
}
|
|
11
18
|
declare class FeatureBridge extends GherkinCodeBridge {
|
|
12
19
|
data: {
|
|
13
20
|
gherkin: Feature;
|
|
@@ -133,4 +140,4 @@ declare class GherkinWalker {
|
|
|
133
140
|
static walk<TAccumulator>(walkFunction: WalkFunctionMap<TAccumulator>, childNode: GherkinNode, accumulator: TAccumulator, parentNode?: GherkinNode): TAccumulator & ({} | null);
|
|
134
141
|
}
|
|
135
142
|
|
|
136
|
-
export { BackgroundBridge, ExampleBridge, ExamplesBridge, FeatureBridge, GherkinCodeBridge, GherkinWalker, Query, RuleBridge, ScenarioBridge, ScenarioOutlineBridge, StepBridge, TestBuilder, WalkFunction, WalkFunctionMap, find, findExamplesOrChild, findRuleOrChild, findRuleTypes, findScenario, findScenarioOutlineOrChild, findTestTypes, scope };
|
|
143
|
+
export { BackgroundBridge, ExampleBridge, ExamplesBridge, FeatureBridge, GherkinCodeBridge, GherkinWalker, GlobalBridge, Query, RuleBridge, ScenarioBridge, ScenarioOutlineBridge, StepBridge, TestBuilder, WalkFunction, WalkFunctionMap, find, findExamplesOrChild, findRuleOrChild, findRuleTypes, findScenario, findScenarioOutlineOrChild, findTestTypes, scope };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GherkinNode, Feature, Background, Rule, Scenario, Example, ScenarioOutline, Examples, Step, DataTable, StepType, StepKeyword } from '@autometa/gherkin';
|
|
2
2
|
import * as _autometa_scopes from '@autometa/scopes';
|
|
3
|
-
import { Scope, FeatureScope, BackgroundScope, RuleScope, ScenarioScope, ScenarioOutlineScope, StepScope } from '@autometa/scopes';
|
|
3
|
+
import { Scope, GlobalScope, FeatureScope, BackgroundScope, RuleScope, ScenarioScope, ScenarioOutlineScope, StepScope } from '@autometa/scopes';
|
|
4
4
|
|
|
5
5
|
declare abstract class GherkinCodeBridge {
|
|
6
6
|
abstract data: {
|
|
@@ -8,6 +8,13 @@ declare abstract class GherkinCodeBridge {
|
|
|
8
8
|
scope: Scope;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
+
declare class GlobalBridge extends GherkinCodeBridge {
|
|
12
|
+
readonly data: {
|
|
13
|
+
gherkin: GherkinNode;
|
|
14
|
+
scope: GlobalScope;
|
|
15
|
+
};
|
|
16
|
+
constructor(scope: GlobalScope);
|
|
17
|
+
}
|
|
11
18
|
declare class FeatureBridge extends GherkinCodeBridge {
|
|
12
19
|
data: {
|
|
13
20
|
gherkin: Feature;
|
|
@@ -133,4 +140,4 @@ declare class GherkinWalker {
|
|
|
133
140
|
static walk<TAccumulator>(walkFunction: WalkFunctionMap<TAccumulator>, childNode: GherkinNode, accumulator: TAccumulator, parentNode?: GherkinNode): TAccumulator & ({} | null);
|
|
134
141
|
}
|
|
135
142
|
|
|
136
|
-
export { BackgroundBridge, ExampleBridge, ExamplesBridge, FeatureBridge, GherkinCodeBridge, GherkinWalker, Query, RuleBridge, ScenarioBridge, ScenarioOutlineBridge, StepBridge, TestBuilder, WalkFunction, WalkFunctionMap, find, findExamplesOrChild, findRuleOrChild, findRuleTypes, findScenario, findScenarioOutlineOrChild, findTestTypes, scope };
|
|
143
|
+
export { BackgroundBridge, ExampleBridge, ExamplesBridge, FeatureBridge, GherkinCodeBridge, GherkinWalker, GlobalBridge, Query, RuleBridge, ScenarioBridge, ScenarioOutlineBridge, StepBridge, TestBuilder, WalkFunction, WalkFunctionMap, find, findExamplesOrChild, findRuleOrChild, findRuleTypes, findScenario, findScenarioOutlineOrChild, findTestTypes, scope };
|
package/dist/index.js
CHANGED
|
@@ -48,6 +48,7 @@ __export(src_exports, {
|
|
|
48
48
|
FeatureBridge: () => FeatureBridge,
|
|
49
49
|
GherkinCodeBridge: () => GherkinCodeBridge,
|
|
50
50
|
GherkinWalker: () => GherkinWalker,
|
|
51
|
+
GlobalBridge: () => GlobalBridge,
|
|
51
52
|
Query: () => Query,
|
|
52
53
|
RuleBridge: () => RuleBridge,
|
|
53
54
|
ScenarioBridge: () => ScenarioBridge,
|
|
@@ -66,8 +67,24 @@ __export(src_exports, {
|
|
|
66
67
|
module.exports = __toCommonJS(src_exports);
|
|
67
68
|
|
|
68
69
|
// src/bridges/bridge.ts
|
|
70
|
+
var import_gherkin = require("@autometa/gherkin");
|
|
69
71
|
var GherkinCodeBridge = class {
|
|
70
72
|
};
|
|
73
|
+
var GlobalBridge = class extends GherkinCodeBridge {
|
|
74
|
+
constructor(scope2) {
|
|
75
|
+
super();
|
|
76
|
+
const nullNode = class extends import_gherkin.GherkinNode {
|
|
77
|
+
constructor() {
|
|
78
|
+
super(...arguments);
|
|
79
|
+
this.keyword = "none";
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
this.data = {
|
|
83
|
+
scope: scope2,
|
|
84
|
+
gherkin: new nullNode()
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
71
88
|
var FeatureBridge = class extends GherkinCodeBridge {
|
|
72
89
|
constructor() {
|
|
73
90
|
super(...arguments);
|
|
@@ -267,7 +284,7 @@ function findScenario(scenario, testName, from) {
|
|
|
267
284
|
}
|
|
268
285
|
|
|
269
286
|
// src/bridges/bridge-query.ts
|
|
270
|
-
var
|
|
287
|
+
var import_gherkin2 = require("@autometa/gherkin");
|
|
271
288
|
function failed(bridge) {
|
|
272
289
|
const accumulator = [];
|
|
273
290
|
if (bridge instanceof ScenarioOutlineBridge) {
|
|
@@ -310,7 +327,7 @@ function failedRule(bridge) {
|
|
|
310
327
|
return accumulator;
|
|
311
328
|
}
|
|
312
329
|
function gherkinToTestNames(node, path = "", accumulator = []) {
|
|
313
|
-
if (!("name" in node) || node instanceof
|
|
330
|
+
if (!("name" in node) || node instanceof import_gherkin2.Background) {
|
|
314
331
|
return;
|
|
315
332
|
}
|
|
316
333
|
const title = `${node.keyword}: ${node.name}`;
|
|
@@ -320,7 +337,7 @@ function gherkinToTestNames(node, path = "", accumulator = []) {
|
|
|
320
337
|
return;
|
|
321
338
|
}
|
|
322
339
|
for (const child of node.children) {
|
|
323
|
-
if (!("name" in child) || child instanceof
|
|
340
|
+
if (!("name" in child) || child instanceof import_gherkin2.Background) {
|
|
324
341
|
continue;
|
|
325
342
|
}
|
|
326
343
|
gherkinToTestNames(child, fullPath, accumulator);
|
|
@@ -335,9 +352,9 @@ var Query = {
|
|
|
335
352
|
};
|
|
336
353
|
|
|
337
354
|
// src/gherkin-walker.ts
|
|
338
|
-
var import_gherkin2 = require("@autometa/gherkin");
|
|
339
|
-
var import_errors2 = require("@autometa/errors");
|
|
340
355
|
var import_gherkin3 = require("@autometa/gherkin");
|
|
356
|
+
var import_errors2 = require("@autometa/errors");
|
|
357
|
+
var import_gherkin4 = require("@autometa/gherkin");
|
|
341
358
|
var _walkNode, walkNode_fn, _walkChildren, walkChildren_fn;
|
|
342
359
|
var GherkinWalker = class {
|
|
343
360
|
static walk(walkFunction, childNode, accumulator, parentNode) {
|
|
@@ -352,27 +369,27 @@ var GherkinWalker = class {
|
|
|
352
369
|
};
|
|
353
370
|
_walkNode = new WeakSet();
|
|
354
371
|
walkNode_fn = function(child, accumulator, walkFunction, lastNode) {
|
|
355
|
-
if (child instanceof
|
|
372
|
+
if (child instanceof import_gherkin3.Feature && walkFunction.onFeature) {
|
|
356
373
|
const acc = walkFunction.onFeature(child, accumulator, lastNode);
|
|
357
374
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
358
375
|
}
|
|
359
|
-
if (child instanceof
|
|
376
|
+
if (child instanceof import_gherkin3.Rule && walkFunction.onRule) {
|
|
360
377
|
const acc = walkFunction.onRule(child, accumulator, lastNode);
|
|
361
378
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
362
379
|
}
|
|
363
|
-
if (child instanceof
|
|
380
|
+
if (child instanceof import_gherkin3.Examples) {
|
|
364
381
|
const acc = walkFunction.onExamples?.(child, accumulator, lastNode);
|
|
365
382
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
366
383
|
}
|
|
367
|
-
if (child instanceof
|
|
384
|
+
if (child instanceof import_gherkin4.Example) {
|
|
368
385
|
const acc = walkFunction.onExample?.(child, accumulator, lastNode);
|
|
369
386
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
370
387
|
}
|
|
371
|
-
if (child instanceof
|
|
388
|
+
if (child instanceof import_gherkin3.Scenario) {
|
|
372
389
|
const acc = walkFunction.onScenario?.(child, accumulator, lastNode);
|
|
373
390
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
374
391
|
}
|
|
375
|
-
if (child instanceof
|
|
392
|
+
if (child instanceof import_gherkin3.ScenarioOutline) {
|
|
376
393
|
const acc = walkFunction.onScenarioOutline?.(
|
|
377
394
|
child,
|
|
378
395
|
accumulator,
|
|
@@ -380,11 +397,11 @@ walkNode_fn = function(child, accumulator, walkFunction, lastNode) {
|
|
|
380
397
|
);
|
|
381
398
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
382
399
|
}
|
|
383
|
-
if (child instanceof
|
|
400
|
+
if (child instanceof import_gherkin3.Background) {
|
|
384
401
|
const acc = walkFunction?.onBackground?.(child, accumulator, lastNode);
|
|
385
402
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
386
403
|
}
|
|
387
|
-
if (child instanceof
|
|
404
|
+
if (child instanceof import_gherkin3.Step) {
|
|
388
405
|
const acc = walkFunction.onStep?.(child, accumulator, lastNode);
|
|
389
406
|
return __privateMethod(this, _walkChildren, walkChildren_fn).call(this, child, acc, walkFunction);
|
|
390
407
|
}
|
|
@@ -504,7 +521,7 @@ function scope(value) {
|
|
|
504
521
|
|
|
505
522
|
// src/test-builder.ts
|
|
506
523
|
var import_bind_decorator = require("@autometa/bind-decorator");
|
|
507
|
-
var
|
|
524
|
+
var import_gherkin5 = require("@autometa/gherkin");
|
|
508
525
|
var import_errors4 = require("@autometa/errors");
|
|
509
526
|
var TestBuilder = class {
|
|
510
527
|
constructor(feature) {
|
|
@@ -560,7 +577,7 @@ var TestBuilder = class {
|
|
|
560
577
|
}
|
|
561
578
|
const titleSegments = Object.keys(gherkin.table);
|
|
562
579
|
const values = Object.values(gherkin.table);
|
|
563
|
-
const title = (0,
|
|
580
|
+
const title = (0, import_gherkin5.scenarioExampleTitle)(
|
|
564
581
|
titleSegments,
|
|
565
582
|
gherkin.name,
|
|
566
583
|
values
|
|
@@ -646,6 +663,7 @@ function getStep(accumulator, gherkin, cache, keywordType, keyword, text) {
|
|
|
646
663
|
FeatureBridge,
|
|
647
664
|
GherkinCodeBridge,
|
|
648
665
|
GherkinWalker,
|
|
666
|
+
GlobalBridge,
|
|
649
667
|
Query,
|
|
650
668
|
RuleBridge,
|
|
651
669
|
ScenarioBridge,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/bridges/bridge.ts","../src/bridges/bridge-search.ts","../src/bridges/bridge-query.ts","../src/gherkin-walker.ts","../src/scope-search.ts","../src/test-builder.ts"],"sourcesContent":["export * from './bridges'\nexport * from './test-builder'\nexport * from './scope-search'\nexport * from './gherkin-walker'","import {\n Background,\n DataTable,\n Example,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step\n} from \"@autometa/gherkin\";\nimport { BackgroundScope } from \"@autometa/scopes\";\nimport {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n ScenarioScope,\n Scope,\n StepScope\n} from \"@autometa/scopes\";\n\nexport abstract class GherkinCodeBridge {\n abstract data: { gherkin: GherkinNode; scope: Scope };\n}\nexport class FeatureBridge extends GherkinCodeBridge {\n data: { gherkin: Feature; scope: FeatureScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n rules: RuleBridge[] = [];\n steps: StepBridge[] = [];\n}\nexport class BackgroundBridge extends GherkinCodeBridge {\n data: { gherkin: Background; scope: BackgroundScope };\n steps: StepBridge[] = [];\n}\n\nexport class RuleBridge extends GherkinCodeBridge {\n data: { gherkin: Rule; scope: RuleScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class ScenarioBridge extends GherkinCodeBridge {\n data: { gherkin: Scenario; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n}\nexport class ExampleBridge extends GherkinCodeBridge {\n data: { gherkin: Example; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n}\nexport class ScenarioOutlineBridge extends GherkinCodeBridge {\n data: { gherkin: ScenarioOutline; scope: ScenarioOutlineScope };\n examples: ExamplesBridge[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class ExamplesBridge extends GherkinCodeBridge {\n data: { gherkin: Examples; scope: ScenarioOutlineScope };\n scenarios: ScenarioBridge[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class StepBridge extends GherkinCodeBridge {\n data: {\n gherkin: Step;\n scope: StepScope<string, DataTable | undefined>;\n args: unknown[];\n };\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport {\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n RuleBridge\n} from \"./bridge\";\n\nexport function find(\n bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n if (bridge instanceof FeatureBridge) {\n return findByFeature(bridge, testName);\n }\n if (bridge instanceof RuleBridge) {\n return findByRule(bridge, testName);\n }\n if (bridge instanceof ScenarioOutlineBridge) {\n return findScenarioOutlineOrChild(bridge, testName);\n }\n\n throw new AutomationError(`Could not find test matching ${testName}`);\n}\nfunction findByFeature(\n feature: FeatureBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = feature.data.scope.title(feature.data.gherkin);\n const byScenario = findTestTypes(feature.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleTypes(feature.rules, testName, title);\n if (byRule) {\n return byRule;\n }\n}\nfunction findByRule(\n rule: RuleBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = rule.data.scope.title(rule.data.gherkin);\n const byScenario = findTestTypes(rule.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleOrChild(rule, testName, title);\n if (byRule) {\n return byRule;\n }\n}\n\nexport function findTestTypes(\n scenarios: (ScenarioBridge | ScenarioOutlineBridge | ExamplesBridge)[],\n testName: string,\n from?: string\n) {\n for (const scenario of scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n const found = findScenarioOutlineOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ExamplesBridge) {\n const found = findExamplesOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ScenarioBridge) {\n const found = findScenario(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n }\n}\n\nexport function findRuleTypes(\n rules: RuleBridge[],\n testName: string,\n from?: string\n) {\n for (const rule of rules) {\n const found = findRuleOrChild(rule, testName, from);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findRuleOrChild(\n rule: RuleBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = rule;\n const title = scope.title(gherkin);\n if (testName === title) {\n return rule;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return rule;\n }\n }\n const newFrom = appendPath(from, title);\n return findTestTypes(rule.scenarios, testName, newFrom);\n}\n\nexport function findScenarioOutlineOrChild(\n outline: ScenarioOutlineBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = outline;\n const title = scope.title(gherkin);\n if (testName === title) {\n return outline;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return outline;\n }\n }\n for (const example of outline.examples) {\n const newFrom = appendPath(from, title);\n const found = findExamplesOrChild(example, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nfunction appendPath(from: string | undefined, title: string) {\n return from ? `${from} ${title}` : title;\n}\n\nexport function findExamplesOrChild(\n example: ExamplesBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = example;\n const title = scope.title(gherkin);\n if (testName === title) {\n return example;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return example;\n }\n }\n for (const scenario of example.scenarios) {\n const newFrom = appendPath(from, title);\n const found = findScenario(scenario, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findScenario(\n scenario: ScenarioBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = scenario;\n const title = scope.title(gherkin);\n if (testName === title) {\n return scenario;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return scenario;\n }\n }\n}\n","import {\n Background,\n GherkinNode} from \"@autometa/gherkin\";\nimport {\n FeatureBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge\n} from \".\";\n\nfunction failed(bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n if (bridge instanceof ScenarioOutlineBridge) {\n return failedOutline(bridge);\n }\n for (const scenario of bridge.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n if (bridge instanceof FeatureBridge) {\n accumulator.push(...failedRule(bridge));\n }\n return accumulator;\n}\n\nfunction failedOutline(bridge: ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n\n for (const example of bridge.examples) {\n for (const scenario of example.scenarios) {\n if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction failedRule(bridge: FeatureBridge) {\n const accumulator: ScenarioBridge[] = [];\n for (const rule of bridge.rules) {\n for (const scenario of rule.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction gherkinToTestNames(\n node: GherkinNode,\n path = \"\",\n accumulator: string[] = []\n) {\n if (!(\"name\" in node) || node instanceof Background) {\n return;\n }\n const title = `${node.keyword}: ${node.name}`;\n const fullPath = path ? `${path} ${title}` : title;\n accumulator.push(fullPath);\n if (!node.children) {\n return;\n }\n for (const child of node.children) {\n if (!(\"name\" in child) || child instanceof Background) {\n continue;\n }\n gherkinToTestNames(child, fullPath, accumulator);\n }\n return accumulator;\n}\n\nexport const Query = {\n find: {\n failed\n },\n testNames: gherkinToTestNames\n};\n","import {\n Background,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step\n} from \"@autometa/gherkin\";\nimport { AutomationError } from \"@autometa/errors\";\nimport { Example } from \"@autometa/gherkin\";\n\nexport type WalkFunction<T extends GherkinNode, TAccumulator, TReturn> = (\n node: T,\n accumulator: TAccumulator,\n lastNode?: GherkinNode\n) => TReturn;\n\nexport type WalkFunctionMap<TAccumulator> = {\n onFeature?: WalkFunction<Feature, TAccumulator, TAccumulator>;\n onRule?: WalkFunction<Rule, TAccumulator, TAccumulator>;\n onBackground?: WalkFunction<Background, TAccumulator, TAccumulator>;\n onScenario?: WalkFunction<Scenario, TAccumulator, TAccumulator>;\n onScenarioOutline?: WalkFunction<ScenarioOutline, TAccumulator, TAccumulator>;\n onExamples?: WalkFunction<Examples, TAccumulator, TAccumulator>;\n onExample?: WalkFunction<Example, TAccumulator, TAccumulator>;\n onStep?: WalkFunction<Step, TAccumulator, TAccumulator>;\n};\n\nexport class GherkinWalker {\n static walk<TAccumulator>(\n walkFunction: WalkFunctionMap<TAccumulator>,\n childNode: GherkinNode,\n accumulator: TAccumulator,\n parentNode?: GherkinNode\n ) {\n if (accumulator === undefined) {\n throw new AutomationError(\n `An accumulator must be defined to continue the walker from ${\n childNode.constructor.name\n }${JSON.stringify(childNode)}`\n );\n }\n this.#walkNode(childNode, accumulator, walkFunction, parentNode);\n return accumulator;\n }\n\n static #walkNode<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n walkFunction: WalkFunctionMap<TAccumulator>,\n lastNode?: GherkinNode\n ) {\n if (child instanceof Feature && walkFunction.onFeature) {\n const acc = walkFunction.onFeature(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Rule && walkFunction.onRule) {\n const acc = walkFunction.onRule(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Examples) {\n const acc = walkFunction.onExamples?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Example) {\n const acc = walkFunction.onExample?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Scenario) {\n const acc = walkFunction.onScenario?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof ScenarioOutline) {\n const acc = walkFunction.onScenarioOutline?.(\n child,\n accumulator,\n lastNode\n );\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Background) {\n const acc = walkFunction?.onBackground?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Step) {\n const acc = walkFunction.onStep?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n }\n\n static #walkChildren<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walkFunction: WalkFunctionMap<any>\n ) {\n for (const node of child.children) {\n this.walk(walkFunction, node, accumulator, child);\n }\n }\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport { StepKeyword } from \"@autometa/gherkin\";\nimport { StepType } from \"@autometa/gherkin\";\nimport {\n Scope,\n RuleScope,\n ScenarioScope,\n ScenarioOutlineScope,\n BackgroundScope\n} from \"@autometa/scopes\";\nimport { Empty_Function } from \"@autometa/scopes\";\n\nexport function scope(value: Scope) {\n return {\n findRule: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return child instanceof RuleScope && child.name === name;\n }) as RuleScope | undefined;\n if (!found) {\n const rule = new RuleScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(rule);\n return rule;\n }\n return found;\n },\n findScenario: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return (\n child instanceof ScenarioScope &&\n child.name === name &&\n !(child instanceof ScenarioOutlineScope)\n );\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findBackground: ({ name }: { name?: string }): BackgroundScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof BackgroundScope;\n }) as BackgroundScope | undefined;\n if (found && found.name !== name) {\n throw new AutomationError(\n `Could not find background matching ${name} but found ${found?.name}`\n );\n }\n if (found) {\n return found;\n }\n\n const bgScope = new BackgroundScope(\n name,\n Empty_Function,\n value.hooks,\n value.steps\n );\n value.attach(bgScope);\n return bgScope;\n },\n findScenarioOutline: (name: string): ScenarioOutlineScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof ScenarioOutlineScope && child.name === name;\n }) as ScenarioOutlineScope | undefined;\n if (!found) {\n const scenarioOutline = new ScenarioOutlineScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenarioOutline);\n return scenarioOutline;\n }\n return found;\n },\n findExample(name: string): ScenarioScope {\n const found = value.closedScopes.find((child) => {\n if (!(child instanceof ScenarioScope)) {\n return false;\n }\n return child.name === name;\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findStep: (keywordType: StepType, keyword: StepKeyword, name: string) => {\n return value.steps.find(keywordType, keyword, name);\n }\n };\n}\n","import {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n StepCache\n} from \"@autometa/scopes\";\nimport {\n BackgroundBridge,\n ExampleBridge,\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n StepBridge\n} from \"./bridges\";\nimport { GherkinWalker } from \"./gherkin-walker\";\nimport { scope } from \"./scope-search\";\nimport { Bind } from \"@autometa/bind-decorator\";\nimport {\n Example,\n Feature,\n GherkinNode,\n Scenario,\n scenarioExampleTitle\n} from \"@autometa/gherkin\";\nimport { raise } from \"@autometa/errors\";\nimport { StepKeyword, StepType } from \"@autometa/types\";\nexport class TestBuilder {\n constructor(readonly feature: Feature) {}\n @Bind\n onFeatureExecuted(featureScope: FeatureScope) {\n const bridge = new FeatureBridge();\n GherkinWalker.walk<GherkinCodeBridge>(\n {\n onFeature: (feature, accumulator) => {\n accumulator.data = { gherkin: feature, scope: featureScope };\n return accumulator;\n },\n onRule: (rule, accumulator) => {\n const ruleScope = scope(featureScope).findRule(\n rule.name\n ) as RuleScope;\n const bridge = new RuleBridge();\n bridge.data = { gherkin: rule, scope: ruleScope };\n (accumulator as FeatureBridge).rules.push(bridge);\n return bridge;\n },\n onScenario: (gherkin, accumulator) => {\n const scenarioScope = scope(accumulator.data.scope).findScenario(\n gherkin.name\n );\n const bridge = new ScenarioBridge();\n bridge.data = { gherkin, scope: scenarioScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n // if accumulator is a outline, push to examples\n\n return bridge;\n },\n onScenarioOutline: (gherkin, accumulator) => {\n const outlineScope = scope(\n accumulator.data.scope\n ).findScenarioOutline(gherkin.name);\n const bridge = new ScenarioOutlineBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n return bridge;\n },\n onExamples: (gherkin, accumulator) => {\n const outlineScope = accumulator.data.scope as ScenarioOutlineScope;\n const bridge = new ExamplesBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as ScenarioOutlineBridge).examples.push(bridge);\n return bridge;\n },\n onExample(gherkin, accumulator) {\n if (gherkin.table === undefined) {\n raise(\n `Example ${gherkin.name} has no Example Table data. A Row of data is required.`\n );\n }\n const titleSegments = Object.keys(gherkin.table);\n const values = Object.values(gherkin.table);\n const title = scenarioExampleTitle(\n titleSegments,\n gherkin.name,\n values\n );\n\n const exampleScope = scope(accumulator.data.scope).findExample(title);\n const bridge = new ExampleBridge();\n bridge.data = { gherkin, scope: exampleScope };\n const acc = accumulator as ExamplesBridge;\n acc.scenarios.push(bridge);\n return bridge;\n },\n onBackground(gherkin, accumulator) {\n const backgroundScope = scope(accumulator.data.scope).findBackground({\n name: gherkin.name\n });\n const bridge = new BackgroundBridge();\n bridge.data = { gherkin, scope: backgroundScope };\n const acc = accumulator as FeatureBridge | RuleBridge;\n acc.background = bridge;\n return bridge;\n },\n onStep: (step, accumulator) => {\n const {\n data: { scope: parentScope, gherkin }\n } = accumulator;\n const { keyword, keywordType, text } = step;\n const cache = parentScope.steps;\n const existing = getStep(\n accumulator,\n gherkin,\n cache,\n keywordType,\n keyword,\n text\n );\n const bridge = new StepBridge();\n const acc = accumulator as\n | BackgroundBridge\n | ScenarioBridge\n | RuleBridge\n | FeatureBridge;\n\n if (existing) {\n bridge.data = {\n gherkin: step,\n scope: existing.step,\n args: existing.args\n };\n } else {\n raise(`No step definition matching ${step.keyword} ${step.text}`);\n }\n\n acc.steps.push(bridge);\n return accumulator;\n }\n },\n this.feature,\n bridge\n );\n return bridge;\n }\n}\nfunction getStep(\n accumulator: GherkinCodeBridge,\n gherkin: GherkinNode,\n cache: StepCache,\n keywordType: StepType,\n keyword: StepKeyword,\n text: string\n) {\n try {\n if (accumulator instanceof ExampleBridge) {\n const scenario = gherkin as Example;\n if (scenario.table) {\n return cache.findByExample(keywordType, keyword, text, scenario.table);\n }\n }\n return cache.find(keywordType, keyword, text);\n } catch (e) {\n const cause = e as Error;\n const { title } = gherkin as Scenario;\n raise(\n `'${title}' could not find a step definition`,\n { cause }\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACsBO,IAAe,oBAAf,MAAiC;AAExC;AACO,IAAM,gBAAN,cAA4B,kBAAkB;AAAA,EAA9C;AAAA;AAGL,qBAAwD,CAAC;AACzD,iBAAsB,CAAC;AACvB,iBAAsB,CAAC;AAAA;AACzB;AACO,IAAM,mBAAN,cAA+B,kBAAkB;AAAA,EAAjD;AAAA;AAEL,iBAAsB,CAAC;AAAA;AACzB;AAEO,IAAM,aAAN,cAAyB,kBAAkB;AAAA,EAA3C;AAAA;AAGL,qBAAwD,CAAC;AACzD,iBAAsB,CAAC;AAAA;AACzB;AAEO,IAAM,iBAAN,cAA6B,kBAAkB;AAAA,EAA/C;AAAA;AAEL,iBA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AM,EAAE,SAAS,aAAa,KAAK,IAAI;AACvC,gBAAM,QAAQ,YAAY;AAC1B,gBAAM,WAAW;AAAA,YACf;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AACA,gBAAMA,UAAS,IAAI,WAAW;AAC9B,gBAAM,MAAM;AAMZ,cAAI,UAAU;AACZ,YAAAA,QAAO,OAAO;AAAA,cACZ,SAAS;AAAA,cACT,OAAO,SAAS;AAAA,cAChB,MAAM,SAAS;AAAA,YACjB;AAAA,UACF,OAAO;AACL,sCAAM,+BAA+B,KAAK,OAAO,IAAI,KAAK,IAAI,EAAE;AAAA,UAClE;AAEA,cAAI,MAAM,KAAKA,OAAM;AACrB,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA,KAAK;AAAA,MACL;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACF;AAnHE;AAAA,EADC;AAAA,GAFU,YAGX;AAoHF,SAAS,QACP,aACA,SACA,OACA,aACA,SACA,MACA;AACA,MAAI;AACF,QAAI,uBAAuB,eAAe;AACxC,YAAM,WAAW;AACjB,UAAI,SAAS,OAAO;AAClB,eAAO,MAAM,cAAc,aAAa,SAAS,MAAM,SAAS,KAAK;AAAA,MACvE;AAAA,IACF;AACA,WAAO,MAAM,KAAK,aAAa,SAAS,IAAI;AAAA,EAC9C,SAAS,GAAG;AACV,UAAM,QAAQ;AACd,UAAM,EAAE,MAAM,IAAI;AAClB;AAAA,MACE,IAAI,KAAK;AAAA,MACT,EAAE,MAAM;AAAA,IACV;AAAA,EACF;AACF;","names":["scope","import_gherkin","import_errors","import_errors","import_scopes","import_gherkin","import_errors","bridge"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/bridges/bridge.ts","../src/bridges/bridge-search.ts","../src/bridges/bridge-query.ts","../src/gherkin-walker.ts","../src/scope-search.ts","../src/test-builder.ts"],"sourcesContent":["export * from './bridges'\nexport * from './test-builder'\nexport * from './scope-search'\nexport * from './gherkin-walker'","import {\n Background,\n DataTable,\n Example,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step\n} from \"@autometa/gherkin\";\nimport { BackgroundScope, GlobalScope } from \"@autometa/scopes\";\nimport {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n ScenarioScope,\n Scope,\n StepScope\n} from \"@autometa/scopes\";\n\nexport abstract class GherkinCodeBridge {\n abstract data: { gherkin: GherkinNode; scope: Scope };\n}\nexport class GlobalBridge extends GherkinCodeBridge {\n readonly data: { gherkin: GherkinNode; scope: GlobalScope };\n constructor(scope: GlobalScope) {\n super();\n const nullNode = class extends GherkinNode {\n keyword = \"none\";\n };\n this.data = {\n scope,\n gherkin: new nullNode()\n };\n }\n}\nexport class FeatureBridge extends GherkinCodeBridge {\n data: { gherkin: Feature; scope: FeatureScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n rules: RuleBridge[] = [];\n steps: StepBridge[] = [];\n}\nexport class BackgroundBridge extends GherkinCodeBridge {\n data: { gherkin: Background; scope: BackgroundScope };\n steps: StepBridge[] = [];\n}\n\nexport class RuleBridge extends GherkinCodeBridge {\n data: { gherkin: Rule; scope: RuleScope };\n background: BackgroundBridge;\n scenarios: (ScenarioBridge | ScenarioOutlineBridge)[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class ScenarioBridge extends GherkinCodeBridge {\n data: { gherkin: Scenario; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n}\nexport class ExampleBridge extends GherkinCodeBridge {\n data: { gherkin: Example; scope: ScenarioScope };\n steps: StepBridge[] = [];\n report: {\n passed?: boolean;\n error?: Error;\n } = {};\n}\nexport class ScenarioOutlineBridge extends GherkinCodeBridge {\n data: { gherkin: ScenarioOutline; scope: ScenarioOutlineScope };\n examples: ExamplesBridge[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class ExamplesBridge extends GherkinCodeBridge {\n data: { gherkin: Examples; scope: ScenarioOutlineScope };\n scenarios: ScenarioBridge[] = [];\n steps: StepBridge[] = [];\n}\n\nexport class StepBridge extends GherkinCodeBridge {\n data: {\n gherkin: Step;\n scope: StepScope<string, DataTable | undefined>;\n args: unknown[];\n };\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport {\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n RuleBridge\n} from \"./bridge\";\n\nexport function find(\n bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n if (bridge instanceof FeatureBridge) {\n return findByFeature(bridge, testName);\n }\n if (bridge instanceof RuleBridge) {\n return findByRule(bridge, testName);\n }\n if (bridge instanceof ScenarioOutlineBridge) {\n return findScenarioOutlineOrChild(bridge, testName);\n }\n\n throw new AutomationError(`Could not find test matching ${testName}`);\n}\nfunction findByFeature(\n feature: FeatureBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = feature.data.scope.title(feature.data.gherkin);\n const byScenario = findTestTypes(feature.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleTypes(feature.rules, testName, title);\n if (byRule) {\n return byRule;\n }\n}\nfunction findByRule(\n rule: RuleBridge,\n testName: string\n): GherkinCodeBridge | undefined {\n const title = rule.data.scope.title(rule.data.gherkin);\n const byScenario = findTestTypes(rule.scenarios, testName, title);\n if (byScenario) {\n return byScenario;\n }\n const byRule = findRuleOrChild(rule, testName, title);\n if (byRule) {\n return byRule;\n }\n}\n\nexport function findTestTypes(\n scenarios: (ScenarioBridge | ScenarioOutlineBridge | ExamplesBridge)[],\n testName: string,\n from?: string\n) {\n for (const scenario of scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n const found = findScenarioOutlineOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ExamplesBridge) {\n const found = findExamplesOrChild(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n if (scenario instanceof ScenarioBridge) {\n const found = findScenario(scenario, testName, from);\n if (found) {\n return found;\n }\n }\n }\n}\n\nexport function findRuleTypes(\n rules: RuleBridge[],\n testName: string,\n from?: string\n) {\n for (const rule of rules) {\n const found = findRuleOrChild(rule, testName, from);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findRuleOrChild(\n rule: RuleBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = rule;\n const title = scope.title(gherkin);\n if (testName === title) {\n return rule;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return rule;\n }\n }\n const newFrom = appendPath(from, title);\n return findTestTypes(rule.scenarios, testName, newFrom);\n}\n\nexport function findScenarioOutlineOrChild(\n outline: ScenarioOutlineBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = outline;\n const title = scope.title(gherkin);\n if (testName === title) {\n return outline;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return outline;\n }\n }\n for (const example of outline.examples) {\n const newFrom = appendPath(from, title);\n const found = findExamplesOrChild(example, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nfunction appendPath(from: string | undefined, title: string) {\n return from ? `${from} ${title}` : title;\n}\n\nexport function findExamplesOrChild(\n example: ExamplesBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = example;\n const title = scope.title(gherkin);\n if (testName === title) {\n return example;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return example;\n }\n }\n for (const scenario of example.scenarios) {\n const newFrom = appendPath(from, title);\n const found = findScenario(scenario, testName, newFrom);\n if (found) {\n return found;\n }\n }\n}\n\nexport function findScenario(\n scenario: ScenarioBridge,\n testName: string,\n from?: string\n) {\n const {\n data: { scope, gherkin }\n } = scenario;\n const title = scope.title(gherkin);\n if (testName === title) {\n return scenario;\n }\n if (from) {\n const fullTitle = `${from} ${title}`;\n if (fullTitle === testName) {\n return scenario;\n }\n }\n}\n","import {\n Background,\n GherkinNode} from \"@autometa/gherkin\";\nimport {\n FeatureBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge\n} from \".\";\n\nfunction failed(bridge: FeatureBridge | RuleBridge | ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n if (bridge instanceof ScenarioOutlineBridge) {\n return failedOutline(bridge);\n }\n for (const scenario of bridge.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n if (bridge instanceof FeatureBridge) {\n accumulator.push(...failedRule(bridge));\n }\n return accumulator;\n}\n\nfunction failedOutline(bridge: ScenarioOutlineBridge) {\n const accumulator: ScenarioBridge[] = [];\n\n for (const example of bridge.examples) {\n for (const scenario of example.scenarios) {\n if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction failedRule(bridge: FeatureBridge) {\n const accumulator: ScenarioBridge[] = [];\n for (const rule of bridge.rules) {\n for (const scenario of rule.scenarios) {\n if (scenario instanceof ScenarioOutlineBridge) {\n accumulator.push(...failedOutline(scenario));\n } else if (!scenario.report.passed) {\n accumulator.push(scenario);\n }\n }\n }\n return accumulator;\n}\n\nfunction gherkinToTestNames(\n node: GherkinNode,\n path = \"\",\n accumulator: string[] = []\n) {\n if (!(\"name\" in node) || node instanceof Background) {\n return;\n }\n const title = `${node.keyword}: ${node.name}`;\n const fullPath = path ? `${path} ${title}` : title;\n accumulator.push(fullPath);\n if (!node.children) {\n return;\n }\n for (const child of node.children) {\n if (!(\"name\" in child) || child instanceof Background) {\n continue;\n }\n gherkinToTestNames(child, fullPath, accumulator);\n }\n return accumulator;\n}\n\nexport const Query = {\n find: {\n failed\n },\n testNames: gherkinToTestNames\n};\n","import {\n Background,\n Examples,\n Feature,\n GherkinNode,\n Rule,\n Scenario,\n ScenarioOutline,\n Step\n} from \"@autometa/gherkin\";\nimport { AutomationError } from \"@autometa/errors\";\nimport { Example } from \"@autometa/gherkin\";\n\nexport type WalkFunction<T extends GherkinNode, TAccumulator, TReturn> = (\n node: T,\n accumulator: TAccumulator,\n lastNode?: GherkinNode\n) => TReturn;\n\nexport type WalkFunctionMap<TAccumulator> = {\n onFeature?: WalkFunction<Feature, TAccumulator, TAccumulator>;\n onRule?: WalkFunction<Rule, TAccumulator, TAccumulator>;\n onBackground?: WalkFunction<Background, TAccumulator, TAccumulator>;\n onScenario?: WalkFunction<Scenario, TAccumulator, TAccumulator>;\n onScenarioOutline?: WalkFunction<ScenarioOutline, TAccumulator, TAccumulator>;\n onExamples?: WalkFunction<Examples, TAccumulator, TAccumulator>;\n onExample?: WalkFunction<Example, TAccumulator, TAccumulator>;\n onStep?: WalkFunction<Step, TAccumulator, TAccumulator>;\n};\n\nexport class GherkinWalker {\n static walk<TAccumulator>(\n walkFunction: WalkFunctionMap<TAccumulator>,\n childNode: GherkinNode,\n accumulator: TAccumulator,\n parentNode?: GherkinNode\n ) {\n if (accumulator === undefined) {\n throw new AutomationError(\n `An accumulator must be defined to continue the walker from ${\n childNode.constructor.name\n }${JSON.stringify(childNode)}`\n );\n }\n this.#walkNode(childNode, accumulator, walkFunction, parentNode);\n return accumulator;\n }\n\n static #walkNode<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n walkFunction: WalkFunctionMap<TAccumulator>,\n lastNode?: GherkinNode\n ) {\n if (child instanceof Feature && walkFunction.onFeature) {\n const acc = walkFunction.onFeature(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Rule && walkFunction.onRule) {\n const acc = walkFunction.onRule(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Examples) {\n const acc = walkFunction.onExamples?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Example) {\n const acc = walkFunction.onExample?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Scenario) {\n const acc = walkFunction.onScenario?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof ScenarioOutline) {\n const acc = walkFunction.onScenarioOutline?.(\n child,\n accumulator,\n lastNode\n );\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Background) {\n const acc = walkFunction?.onBackground?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n\n if (child instanceof Step) {\n const acc = walkFunction.onStep?.(child, accumulator, lastNode);\n return this.#walkChildren(child, acc, walkFunction);\n }\n }\n\n static #walkChildren<TAccumulator>(\n child: GherkinNode,\n accumulator: TAccumulator,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n walkFunction: WalkFunctionMap<any>\n ) {\n for (const node of child.children) {\n this.walk(walkFunction, node, accumulator, child);\n }\n }\n}\n","import { AutomationError } from \"@autometa/errors\";\nimport { StepKeyword } from \"@autometa/gherkin\";\nimport { StepType } from \"@autometa/gherkin\";\nimport {\n Scope,\n RuleScope,\n ScenarioScope,\n ScenarioOutlineScope,\n BackgroundScope\n} from \"@autometa/scopes\";\nimport { Empty_Function } from \"@autometa/scopes\";\n\nexport function scope(value: Scope) {\n return {\n findRule: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return child instanceof RuleScope && child.name === name;\n }) as RuleScope | undefined;\n if (!found) {\n const rule = new RuleScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(rule);\n return rule;\n }\n return found;\n },\n findScenario: (name: string) => {\n const found = value.closedScopes.find((child) => {\n return (\n child instanceof ScenarioScope &&\n child.name === name &&\n !(child instanceof ScenarioOutlineScope)\n );\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findBackground: ({ name }: { name?: string }): BackgroundScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof BackgroundScope;\n }) as BackgroundScope | undefined;\n if (found && found.name !== name) {\n throw new AutomationError(\n `Could not find background matching ${name} but found ${found?.name}`\n );\n }\n if (found) {\n return found;\n }\n\n const bgScope = new BackgroundScope(\n name,\n Empty_Function,\n value.hooks,\n value.steps\n );\n value.attach(bgScope);\n return bgScope;\n },\n findScenarioOutline: (name: string): ScenarioOutlineScope => {\n const found = value.closedScopes.find((child) => {\n return child instanceof ScenarioOutlineScope && child.name === name;\n }) as ScenarioOutlineScope | undefined;\n if (!found) {\n const scenarioOutline = new ScenarioOutlineScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenarioOutline);\n return scenarioOutline;\n }\n return found;\n },\n findExample(name: string): ScenarioScope {\n const found = value.closedScopes.find((child) => {\n if (!(child instanceof ScenarioScope)) {\n return false;\n }\n return child.name === name;\n }) as ScenarioScope;\n if (!found) {\n const scenario = new ScenarioScope(\n name,\n Empty_Function,\n undefined,\n value.hooks,\n value.steps\n );\n value.attach(scenario);\n return scenario;\n }\n return found;\n },\n findStep: (keywordType: StepType, keyword: StepKeyword, name: string) => {\n return value.steps.find(keywordType, keyword, name);\n }\n };\n}\n","import {\n FeatureScope,\n RuleScope,\n ScenarioOutlineScope,\n StepCache\n} from \"@autometa/scopes\";\nimport {\n BackgroundBridge,\n ExampleBridge,\n ExamplesBridge,\n FeatureBridge,\n GherkinCodeBridge,\n RuleBridge,\n ScenarioBridge,\n ScenarioOutlineBridge,\n StepBridge\n} from \"./bridges\";\nimport { GherkinWalker } from \"./gherkin-walker\";\nimport { scope } from \"./scope-search\";\nimport { Bind } from \"@autometa/bind-decorator\";\nimport {\n Example,\n Feature,\n GherkinNode,\n Scenario,\n scenarioExampleTitle\n} from \"@autometa/gherkin\";\nimport { raise } from \"@autometa/errors\";\nimport { StepKeyword, StepType } from \"@autometa/types\";\nexport class TestBuilder {\n constructor(readonly feature: Feature) {}\n @Bind\n onFeatureExecuted(featureScope: FeatureScope) {\n const bridge = new FeatureBridge();\n GherkinWalker.walk<GherkinCodeBridge>(\n {\n onFeature: (feature, accumulator) => {\n accumulator.data = { gherkin: feature, scope: featureScope };\n return accumulator;\n },\n onRule: (rule, accumulator) => {\n const ruleScope = scope(featureScope).findRule(\n rule.name\n ) as RuleScope;\n const bridge = new RuleBridge();\n bridge.data = { gherkin: rule, scope: ruleScope };\n (accumulator as FeatureBridge).rules.push(bridge);\n return bridge;\n },\n onScenario: (gherkin, accumulator) => {\n const scenarioScope = scope(accumulator.data.scope).findScenario(\n gherkin.name\n );\n const bridge = new ScenarioBridge();\n bridge.data = { gherkin, scope: scenarioScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n // if accumulator is a outline, push to examples\n\n return bridge;\n },\n onScenarioOutline: (gherkin, accumulator) => {\n const outlineScope = scope(\n accumulator.data.scope\n ).findScenarioOutline(gherkin.name);\n const bridge = new ScenarioOutlineBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as FeatureBridge | RuleBridge).scenarios.push(bridge);\n return bridge;\n },\n onExamples: (gherkin, accumulator) => {\n const outlineScope = accumulator.data.scope as ScenarioOutlineScope;\n const bridge = new ExamplesBridge();\n bridge.data = { gherkin, scope: outlineScope };\n (accumulator as ScenarioOutlineBridge).examples.push(bridge);\n return bridge;\n },\n onExample(gherkin, accumulator) {\n if (gherkin.table === undefined) {\n raise(\n `Example ${gherkin.name} has no Example Table data. A Row of data is required.`\n );\n }\n const titleSegments = Object.keys(gherkin.table);\n const values = Object.values(gherkin.table);\n const title = scenarioExampleTitle(\n titleSegments,\n gherkin.name,\n values\n );\n\n const exampleScope = scope(accumulator.data.scope).findExample(title);\n const bridge = new ExampleBridge();\n bridge.data = { gherkin, scope: exampleScope };\n const acc = accumulator as ExamplesBridge;\n acc.scenarios.push(bridge);\n return bridge;\n },\n onBackground(gherkin, accumulator) {\n const backgroundScope = scope(accumulator.data.scope).findBackground({\n name: gherkin.name\n });\n const bridge = new BackgroundBridge();\n bridge.data = { gherkin, scope: backgroundScope };\n const acc = accumulator as FeatureBridge | RuleBridge;\n acc.background = bridge;\n return bridge;\n },\n onStep: (step, accumulator) => {\n const {\n data: { scope: parentScope, gherkin }\n } = accumulator;\n const { keyword, keywordType, text } = step;\n const cache = parentScope.steps;\n const existing = getStep(\n accumulator,\n gherkin,\n cache,\n keywordType,\n keyword,\n text\n );\n const bridge = new StepBridge();\n const acc = accumulator as\n | BackgroundBridge\n | ScenarioBridge\n | RuleBridge\n | FeatureBridge;\n\n if (existing) {\n bridge.data = {\n gherkin: step,\n scope: existing.step,\n args: existing.args\n };\n } else {\n raise(`No step definition matching ${step.keyword} ${step.text}`);\n }\n\n acc.steps.push(bridge);\n return accumulator;\n }\n },\n this.feature,\n bridge\n );\n return bridge;\n }\n}\nfunction getStep(\n accumulator: GherkinCodeBridge,\n gherkin: GherkinNode,\n cache: StepCache,\n keywordType: StepType,\n keyword: StepKeyword,\n text: string\n) {\n try {\n if (accumulator instanceof ExampleBridge) {\n const scenario = gherkin as Example;\n if (scenario.table) {\n return cache.findByExample(keywordType, keyword, text, scenario.table);\n }\n }\n return cache.find(keywordType, keyword, text);\n } catch (e) {\n const cause = e as Error;\n const { title } = gherkin as Scenario;\n raise(\n `'${title}' could not find a step definition`,\n { cause }\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAWO;AAWA,IAAe,oBAAf,MAAiC;AAExC;AACO,IAAM,eAAN,cAA2B,kBAAkB;AAAA,EAElD,YAAYA,QAAoB;AAC9B,UAAM;AACN,UAAM,WAAW,cAAc,2BAAY;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AAO;AAClB,eAAO,MAAM,cAAc,aAAa,SAAS,MAAM,SAAS,KAAK;AAAA,MACvE;AAAA,IACF;AACA,WAAO,MAAM,KAAK,aAAa,SAAS,IAAI;AAAA,EAC9C,SAAS,GAAG;AACV,UAAM,QAAQ;AACd,UAAM,EAAE,MAAM,IAAI;AAClB;AAAA,MACE,IAAI,KAAK;AAAA,MACT,EAAE,MAAM;AAAA,IACV;AAAA,EACF;AACF;","names":["scope","scope","import_gherkin","import_gherkin","import_errors","import_errors","import_scopes","import_gherkin","import_errors","bridge"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autometa/test-builder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "internal library for autometa",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"tsup": "^7.2.0",
|
|
27
27
|
"typescript": "^4.9.5",
|
|
28
28
|
"vitest": "0.33.0",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"tsconfig": "0.7.0",
|
|
30
|
+
"eslint-config-custom": "0.6.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@cucumber/cucumber-expressions": "^16.1.2",
|
|
34
34
|
"zod": "^3.21.4",
|
|
35
35
|
"@autometa/app": "^0.1.3",
|
|
36
|
+
"@autometa/asserters": "^0.1.1",
|
|
36
37
|
"@autometa/bind-decorator": "^0.5.0",
|
|
37
38
|
"@autometa/dto-builder": "^0.10.0",
|
|
38
|
-
"@autometa/asserters": "^0.1.1",
|
|
39
39
|
"@autometa/errors": "^0.1.1",
|
|
40
|
-
"@autometa/gherkin": "^0.4.1",
|
|
41
40
|
"@autometa/phrases": "^0.1.3",
|
|
42
|
-
"@autometa/scopes": "^0.2.
|
|
43
|
-
"@autometa/types": "^0.4.0"
|
|
41
|
+
"@autometa/scopes": "^0.2.4",
|
|
42
|
+
"@autometa/types": "^0.4.0",
|
|
43
|
+
"@autometa/gherkin": "^0.4.2"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"test": "vitest run --passWithNoTests",
|