racejar 1.3.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-dts/step-definitions.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/jest/index.d.ts +1 -1
- package/dist/playwright/index.d.ts +1 -1
- package/dist/vitest/index.d.ts +1 -1
- package/package.json +12 -18
- package/dist/_chunks-cjs/compile-feature.cjs +0 -101
- package/dist/_chunks-cjs/compile-feature.cjs.map +0 -1
- package/dist/_chunks-dts/step-definitions.d.cts +0 -44
- package/dist/index.cjs +0 -36
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -44
- package/dist/jest/index.cjs +0 -29
- package/dist/jest/index.cjs.map +0 -1
- package/dist/jest/index.d.cts +0 -17
- package/dist/playwright/index.cjs +0 -39
- package/dist/playwright/index.cjs.map +0 -1
- package/dist/playwright/index.d.cts +0 -25
- package/dist/vitest/index.cjs +0 -29
- package/dist/vitest/index.cjs.map +0 -1
- package/dist/vitest/index.d.cts +0 -17
|
@@ -41,4 +41,4 @@ declare function When<TContext extends Record<string, any> = object, TParamA = u
|
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
43
|
declare function Then<TContext extends Record<string, any> = object, TParamA = undefined, TParamB = undefined, TParamC = undefined>(text: string, callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>): StepDefinition<TContext, TParamA, TParamB, TParamC>;
|
|
44
|
-
export {
|
|
44
|
+
export { When as a, Hook as c, Then as i, HookCallback as l, StepDefinition as n, After as o, StepDefinitionCallback as r, Before as s, Given as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as When, c as Hook, i as Then, l as HookCallback, n as StepDefinition, o as After, r as StepDefinitionCallback, s as Before, t as Given } from "./_chunks-dts/step-definitions.js";
|
|
2
2
|
import { ParameterType, ParameterType as ParameterType$1, RegExps } from "@cucumber/cucumber-expressions";
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
package/dist/jest/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Hook, StepDefinition } from "../_chunks-dts/step-definitions.js";
|
|
1
|
+
import { c as Hook, n as StepDefinition } from "../_chunks-dts/step-definitions.js";
|
|
2
2
|
import { ParameterType } from "@cucumber/cucumber-expressions";
|
|
3
3
|
import { PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions } from "@playwright/test";
|
|
4
4
|
type PlaywrightOptions = PlaywrightTestArgs & PlaywrightTestOptions & PlaywrightWorkerArgs & PlaywrightWorkerOptions;
|
package/dist/vitest/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "racejar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A testing framework agnostic Gherkin driver",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cucumber",
|
|
@@ -25,32 +25,23 @@
|
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
27
|
"source": "./src/index.ts",
|
|
28
|
-
"import": "./dist/index.js",
|
|
29
|
-
"require": "./dist/index.cjs",
|
|
30
28
|
"default": "./dist/index.js"
|
|
31
29
|
},
|
|
32
30
|
"./jest": {
|
|
33
31
|
"source": "./src/jest/index.ts",
|
|
34
|
-
"import": "./dist/jest/index.js",
|
|
35
|
-
"require": "./dist/jest/index.cjs",
|
|
36
32
|
"default": "./dist/jest/index.js"
|
|
37
33
|
},
|
|
38
34
|
"./playwright": {
|
|
39
35
|
"source": "./src/playwright/index.ts",
|
|
40
|
-
"import": "./dist/playwright/index.js",
|
|
41
|
-
"require": "./dist/playwright/index.cjs",
|
|
42
36
|
"default": "./dist/playwright/index.js"
|
|
43
37
|
},
|
|
44
38
|
"./vitest": {
|
|
45
39
|
"source": "./src/vitest/index.ts",
|
|
46
|
-
"import": "./dist/vitest/index.js",
|
|
47
|
-
"require": "./dist/vitest/index.cjs",
|
|
48
40
|
"default": "./dist/vitest/index.js"
|
|
49
41
|
},
|
|
50
42
|
"./package.json": "./package.json"
|
|
51
43
|
},
|
|
52
|
-
"main": "./dist/index.
|
|
53
|
-
"module": "./dist/index.js",
|
|
44
|
+
"main": "./dist/index.js",
|
|
54
45
|
"types": "./dist/index.d.ts",
|
|
55
46
|
"files": [
|
|
56
47
|
"dist",
|
|
@@ -58,20 +49,23 @@
|
|
|
58
49
|
],
|
|
59
50
|
"dependencies": {
|
|
60
51
|
"@cucumber/cucumber-expressions": "^18.0.1",
|
|
61
|
-
"@cucumber/gherkin": "^
|
|
62
|
-
"@cucumber/messages": "^
|
|
52
|
+
"@cucumber/gherkin": "^36.0.0",
|
|
53
|
+
"@cucumber/messages": "^30.1.0"
|
|
63
54
|
},
|
|
64
55
|
"devDependencies": {
|
|
65
|
-
"@jest/globals": "^30.
|
|
56
|
+
"@jest/globals": "^30.2.0",
|
|
66
57
|
"@playwright/test": "^1.56.1",
|
|
67
|
-
"@sanity/pkg-utils": "^
|
|
58
|
+
"@sanity/pkg-utils": "^9.0.0",
|
|
68
59
|
"typescript": "5.9.3",
|
|
69
|
-
"vitest": "^
|
|
60
|
+
"vitest": "^4.0.5"
|
|
70
61
|
},
|
|
71
62
|
"peerDependencies": {
|
|
72
|
-
"@jest/globals": "^30.
|
|
63
|
+
"@jest/globals": "^30.2.0",
|
|
73
64
|
"@playwright/test": "^1.56.1",
|
|
74
|
-
"vitest": "^
|
|
65
|
+
"vitest": "^4.0.5"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=20.19 <22 || >=22.12"
|
|
75
69
|
},
|
|
76
70
|
"scripts": {
|
|
77
71
|
"build": "pkg-utils build --strict --check --clean",
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var cucumberExpressions = require("@cucumber/cucumber-expressions"), Gherkin = require("@cucumber/gherkin"), Messages = require("@cucumber/messages");
|
|
3
|
-
function _interopNamespaceCompat(e) {
|
|
4
|
-
if (e && typeof e == "object" && "default" in e) return e;
|
|
5
|
-
var n = /* @__PURE__ */ Object.create(null);
|
|
6
|
-
return e && Object.keys(e).forEach(function(k) {
|
|
7
|
-
if (k !== "default") {
|
|
8
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
9
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
10
|
-
enumerable: !0,
|
|
11
|
-
get: function() {
|
|
12
|
-
return e[k];
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}), n.default = e, Object.freeze(n);
|
|
17
|
-
}
|
|
18
|
-
var Gherkin__namespace = /* @__PURE__ */ _interopNamespaceCompat(Gherkin), Messages__namespace = /* @__PURE__ */ _interopNamespaceCompat(Messages);
|
|
19
|
-
function compileFeature({
|
|
20
|
-
featureText,
|
|
21
|
-
hooks,
|
|
22
|
-
stepDefinitions,
|
|
23
|
-
parameterTypes
|
|
24
|
-
}) {
|
|
25
|
-
const uuidFn = Messages__namespace.IdGenerator.uuid(), builder = new Gherkin__namespace.AstBuilder(uuidFn), matcher = new Gherkin__namespace.GherkinClassicTokenMatcher(), gherkinDocument = new Gherkin__namespace.Parser(builder, matcher).parse(featureText), pickles = Gherkin__namespace.compile(
|
|
26
|
-
gherkinDocument,
|
|
27
|
-
(gherkinDocument.feature?.name ?? "").replace(" ", "-"),
|
|
28
|
-
uuidFn
|
|
29
|
-
), parameterTypeRegistry = new cucumberExpressions.ParameterTypeRegistry();
|
|
30
|
-
if (parameterTypes && parameterTypes.forEach((parameterType) => {
|
|
31
|
-
parameterTypeRegistry.defineParameterType(parameterType);
|
|
32
|
-
}), !gherkinDocument.feature)
|
|
33
|
-
throw new Error("No feature found");
|
|
34
|
-
const stepImplementations = stepDefinitions.map((stepDefinition) => {
|
|
35
|
-
const expression = new cucumberExpressions.CucumberExpression(
|
|
36
|
-
stepDefinition.text,
|
|
37
|
-
parameterTypeRegistry
|
|
38
|
-
);
|
|
39
|
-
return {
|
|
40
|
-
type: stepDefinition.type,
|
|
41
|
-
text: stepDefinition.text,
|
|
42
|
-
expression,
|
|
43
|
-
callback: stepDefinition.callback
|
|
44
|
-
};
|
|
45
|
-
}), skippedFeature = gherkinDocument.feature.tags.some(
|
|
46
|
-
(tag) => tag.name === "@skip"
|
|
47
|
-
), onlyFeature = gherkinDocument.feature.tags.some(
|
|
48
|
-
(tag) => tag.name === "@only"
|
|
49
|
-
);
|
|
50
|
-
if (skippedFeature && onlyFeature)
|
|
51
|
-
throw new Error("Feature cannot have both @skip and @only tags");
|
|
52
|
-
let context = {};
|
|
53
|
-
const scenarios = pickles.map((pickle) => {
|
|
54
|
-
const skippedPickle = pickle.tags.some((tag) => tag.name === "@skip"), onlyPickle = pickle.tags.some((tag) => tag.name === "@only");
|
|
55
|
-
context = {};
|
|
56
|
-
const steps = pickle.steps.map((step) => {
|
|
57
|
-
const matchingSteps = stepImplementations.filter((stepImplementation) => stepImplementation.type === step.type).flatMap((stepImplementation) => {
|
|
58
|
-
const args2 = stepImplementation.expression.match(step.text);
|
|
59
|
-
return args2 ? [
|
|
60
|
-
{
|
|
61
|
-
...stepImplementation,
|
|
62
|
-
args: args2
|
|
63
|
-
}
|
|
64
|
-
] : [];
|
|
65
|
-
}), matchingStep = matchingSteps[0];
|
|
66
|
-
if (!matchingStep)
|
|
67
|
-
throw new Error(`No implementation found for step: ${step.text}`);
|
|
68
|
-
if (matchingSteps.length > 1)
|
|
69
|
-
throw new Error(`Multiple implementations found for step: ${step.text}`);
|
|
70
|
-
const args = matchingStep.args.map((arg) => arg.getValue(matchingStep));
|
|
71
|
-
return step.argument?.dataTable && args.push(
|
|
72
|
-
step.argument.dataTable.rows.map(
|
|
73
|
-
(row) => row.cells.map((cell) => cell.value)
|
|
74
|
-
)
|
|
75
|
-
), step.argument?.docString && args.push(step.argument.docString.content), (stepContext) => matchingStep.callback(
|
|
76
|
-
Object.assign(context, stepContext),
|
|
77
|
-
args[0],
|
|
78
|
-
args[1],
|
|
79
|
-
args[2]
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
return {
|
|
83
|
-
name: pickle.name,
|
|
84
|
-
tag: skippedFeature || skippedPickle ? "skip" : onlyPickle ? "only" : void 0,
|
|
85
|
-
steps
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
return {
|
|
89
|
-
tag: skippedFeature ? "skip" : onlyFeature ? "only" : void 0,
|
|
90
|
-
name: gherkinDocument.feature.name,
|
|
91
|
-
scenarios,
|
|
92
|
-
beforeHooks: (hooks ?? []).filter((hook) => hook.type === "Before").map(
|
|
93
|
-
(hook) => (stepContext) => hook.callback(Object.assign(context, stepContext))
|
|
94
|
-
),
|
|
95
|
-
afterHooks: (hooks ?? []).filter((hook) => hook.type === "After").map(
|
|
96
|
-
(hook) => (stepContext) => hook.callback(Object.assign(context, stepContext))
|
|
97
|
-
)
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
exports.compileFeature = compileFeature;
|
|
101
|
-
//# sourceMappingURL=compile-feature.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-feature.cjs","sources":["../../src/compile-feature.ts"],"sourcesContent":["import type {ParameterType} from '@cucumber/cucumber-expressions'\nimport {\n CucumberExpression,\n ParameterTypeRegistry,\n} from '@cucumber/cucumber-expressions'\nimport * as Gherkin from '@cucumber/gherkin'\nimport * as Messages from '@cucumber/messages'\nimport type {Hook} from './hooks'\nimport type {StepDefinition} from './step-definitions'\n\n/**\n * @public\n */\nexport type CompiledFeature<TStepContext extends Record<string, any> = object> =\n {\n name: string\n tag: 'only' | 'skip' | undefined\n scenarios: Array<{\n name: string\n tag: 'only' | 'skip' | undefined\n steps: Array<(stepContext?: TStepContext) => Promise<void> | void>\n }>\n beforeHooks: Array<(stepContext?: TStepContext) => Promise<void> | void>\n afterHooks: Array<(stepContext?: TStepContext) => Promise<void> | void>\n }\n\n/**\n * @public\n */\nexport function compileFeature<\n TContext extends Record<string, any> = object,\n TStepContext extends Record<string, any> = object,\n>({\n featureText,\n hooks,\n stepDefinitions,\n parameterTypes,\n}: {\n featureText: string\n hooks?: Array<Hook<TStepContext>>\n stepDefinitions: Array<StepDefinition<TContext, any, any, any>>\n parameterTypes?: Array<ParameterType<unknown>>\n}): CompiledFeature<TStepContext> {\n const uuidFn = Messages.IdGenerator.uuid()\n const builder = new Gherkin.AstBuilder(uuidFn)\n const matcher = new Gherkin.GherkinClassicTokenMatcher()\n const parser = new Gherkin.Parser(builder, matcher)\n\n const gherkinDocument = parser.parse(featureText)\n const pickles = Gherkin.compile(\n gherkinDocument,\n (gherkinDocument.feature?.name ?? '').replace(' ', '-'),\n uuidFn,\n )\n\n const parameterTypeRegistry = new ParameterTypeRegistry()\n if (parameterTypes) {\n parameterTypes.forEach((parameterType) => {\n parameterTypeRegistry.defineParameterType(parameterType)\n })\n }\n\n if (!gherkinDocument.feature) {\n throw new Error('No feature found')\n }\n\n const stepImplementations = stepDefinitions.map((stepDefinition) => {\n const expression = new CucumberExpression(\n stepDefinition.text,\n parameterTypeRegistry,\n )\n\n return {\n type: stepDefinition.type,\n text: stepDefinition.text,\n expression,\n callback: stepDefinition.callback,\n }\n })\n\n const skippedFeature = gherkinDocument.feature.tags.some(\n (tag) => tag.name === '@skip',\n )\n const onlyFeature = gherkinDocument.feature.tags.some(\n (tag) => tag.name === '@only',\n )\n\n if (skippedFeature && onlyFeature) {\n throw new Error('Feature cannot have both @skip and @only tags')\n }\n\n let context = {} as TContext\n\n const scenarios = pickles.map((pickle) => {\n const skippedPickle = pickle.tags.some((tag) => tag.name === '@skip')\n const onlyPickle = pickle.tags.some((tag) => tag.name === '@only')\n context = {} as TContext\n\n const steps = pickle.steps.map((step) => {\n const matchingSteps = stepImplementations\n .filter((stepImplementation) => stepImplementation.type === step.type)\n .flatMap((stepImplementation) => {\n const args = stepImplementation.expression.match(step.text)\n\n if (args) {\n return [\n {\n ...stepImplementation,\n args,\n },\n ]\n }\n\n return []\n })\n\n const matchingStep = matchingSteps[0]\n\n if (!matchingStep) {\n throw new Error(`No implementation found for step: ${step.text}`)\n }\n\n if (matchingSteps.length > 1) {\n throw new Error(`Multiple implementations found for step: ${step.text}`)\n }\n\n const args = matchingStep.args.map((arg) => arg.getValue(matchingStep))\n if (step.argument?.dataTable) {\n args.push(\n step.argument.dataTable.rows.map((row) =>\n row.cells.map((cell) => cell.value),\n ),\n )\n }\n if (step.argument?.docString) {\n args.push(step.argument.docString.content)\n }\n\n return (stepContext: TStepContext | undefined) =>\n matchingStep.callback(\n Object.assign(context, stepContext),\n args[0],\n args[1],\n args[2],\n )\n })\n\n return {\n name: pickle.name,\n tag: skippedFeature\n ? ('skip' as const)\n : skippedPickle\n ? ('skip' as const)\n : onlyPickle\n ? ('only' as const)\n : undefined,\n steps,\n }\n })\n\n return {\n tag: skippedFeature ? 'skip' : onlyFeature ? 'only' : undefined,\n name: gherkinDocument.feature.name,\n scenarios,\n beforeHooks: (hooks ?? [])\n .filter((hook) => hook.type === 'Before')\n .map(\n (hook) => (stepContext: TStepContext | undefined) =>\n hook.callback(Object.assign(context, stepContext)),\n ),\n afterHooks: (hooks ?? [])\n .filter((hook) => hook.type === 'After')\n .map(\n (hook) => (stepContext: TStepContext | undefined) =>\n hook.callback(Object.assign(context, stepContext)),\n ),\n }\n}\n"],"names":["Messages","Gherkin","ParameterTypeRegistry","CucumberExpression","args"],"mappings":"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"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
4
|
-
type Hook<TContext extends Record<string, any> = object> = {
|
|
5
|
-
type: 'Before' | 'After';
|
|
6
|
-
callback: HookCallback<TContext>;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
type HookCallback<TContext extends Record<string, any> = object> = (context: TContext) => Promise<void> | void;
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
declare function Before<TContext extends Record<string, any> = object>(callback: HookCallback<TContext>): Hook<TContext>;
|
|
16
|
-
/**
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
declare function After<TContext extends Record<string, any> = object>(callback: HookCallback<TContext>): Hook<TContext>;
|
|
20
|
-
/**
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
type StepDefinitionCallback<TContext extends Record<string, any> = object, TParamA = undefined, TParamB = undefined, TParamC = undefined> = TParamA extends undefined ? (context: TContext) => Promise<void> | void : TParamB extends undefined ? (context: TContext, paramA: TParamA) => Promise<void> | void : TParamC extends undefined ? (context: TContext, paramA: TParamA, paramB: TParamB) => Promise<void> | void : (context: TContext, paramA: TParamA, paramB: TParamB, paramC: TParamC) => Promise<void> | void;
|
|
24
|
-
/**
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
type StepDefinition<TContext extends Record<string, any> = object, TParamA = undefined, TParamB = undefined, TParamC = undefined> = {
|
|
28
|
-
type: 'Context' | 'Action' | 'Outcome';
|
|
29
|
-
text: string;
|
|
30
|
-
callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
declare function Given<TContext extends Record<string, any> = object, TParamA = undefined, TParamB = undefined, TParamC = undefined>(text: string, callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>): StepDefinition<TContext, TParamA, TParamB, TParamC>;
|
|
36
|
-
/**
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
declare function When<TContext extends Record<string, any> = object, TParamA = undefined, TParamB = undefined, TParamC = undefined>(text: string, callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>): StepDefinition<TContext, TParamA, TParamB, TParamC>;
|
|
40
|
-
/**
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
declare function Then<TContext extends Record<string, any> = object, TParamA = undefined, TParamB = undefined, TParamC = undefined>(text: string, callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>): StepDefinition<TContext, TParamA, TParamB, TParamC>;
|
|
44
|
-
export { After, Before, Given, Hook, HookCallback, StepDefinition, StepDefinitionCallback, Then, When };
|
package/dist/index.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var compileFeature = require("./_chunks-cjs/compile-feature.cjs"), cucumberExpressions = require("@cucumber/cucumber-expressions");
|
|
4
|
-
function createParameterType(config) {
|
|
5
|
-
return new cucumberExpressions.ParameterType(
|
|
6
|
-
config.name,
|
|
7
|
-
config.matcher,
|
|
8
|
-
config.type ?? String,
|
|
9
|
-
config.transform,
|
|
10
|
-
!1,
|
|
11
|
-
!0
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
function Given(text, callback) {
|
|
15
|
-
return { type: "Context", text, callback };
|
|
16
|
-
}
|
|
17
|
-
function When(text, callback) {
|
|
18
|
-
return { type: "Action", text, callback };
|
|
19
|
-
}
|
|
20
|
-
function Then(text, callback) {
|
|
21
|
-
return { type: "Outcome", text, callback };
|
|
22
|
-
}
|
|
23
|
-
function Before(callback) {
|
|
24
|
-
return { type: "Before", callback };
|
|
25
|
-
}
|
|
26
|
-
function After(callback) {
|
|
27
|
-
return { type: "After", callback };
|
|
28
|
-
}
|
|
29
|
-
exports.compileFeature = compileFeature.compileFeature;
|
|
30
|
-
exports.After = After;
|
|
31
|
-
exports.Before = Before;
|
|
32
|
-
exports.Given = Given;
|
|
33
|
-
exports.Then = Then;
|
|
34
|
-
exports.When = When;
|
|
35
|
-
exports.createParameterType = createParameterType;
|
|
36
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/create-parameter-type.ts","../src/step-definitions.ts","../src/hooks.ts"],"sourcesContent":["import {ParameterType, type RegExps} from '@cucumber/cucumber-expressions'\n\n/**\n * @public\n */\nexport type ParameterTypeConfig<TType = string> = {\n readonly name: string\n matcher: RegExps\n type?: (...args: unknown[]) => TType\n transform?: (...match: string[]) => TType\n}\n\nexport type {ParameterType}\n\n/**\n * @public\n */\nexport function createParameterType<TType = string>(\n config: ParameterTypeConfig<TType>,\n): ParameterType<TType> {\n return new ParameterType(\n config.name,\n config.matcher,\n config.type ?? String,\n config.transform,\n false,\n true,\n )\n}\n","/**\n * @public\n */\nexport type StepDefinitionCallback<\n TContext extends Record<string, any> = object,\n TParamA = undefined,\n TParamB = undefined,\n TParamC = undefined,\n> = TParamA extends undefined\n ? (context: TContext) => Promise<void> | void\n : TParamB extends undefined\n ? (context: TContext, paramA: TParamA) => Promise<void> | void\n : TParamC extends undefined\n ? (\n context: TContext,\n paramA: TParamA,\n paramB: TParamB,\n ) => Promise<void> | void\n : (\n context: TContext,\n paramA: TParamA,\n paramB: TParamB,\n paramC: TParamC,\n ) => Promise<void> | void\n\n/**\n * @public\n */\nexport type StepDefinition<\n TContext extends Record<string, any> = object,\n TParamA = undefined,\n TParamB = undefined,\n TParamC = undefined,\n> = {\n type: 'Context' | 'Action' | 'Outcome'\n text: string\n callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>\n}\n\n/**\n * @public\n */\nexport function Given<\n TContext extends Record<string, any> = object,\n TParamA = undefined,\n TParamB = undefined,\n TParamC = undefined,\n>(\n text: string,\n callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>,\n): StepDefinition<TContext, TParamA, TParamB, TParamC> {\n return {type: 'Context', text, callback}\n}\n\n/**\n * @public\n */\nexport function When<\n TContext extends Record<string, any> = object,\n TParamA = undefined,\n TParamB = undefined,\n TParamC = undefined,\n>(\n text: string,\n callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>,\n): StepDefinition<TContext, TParamA, TParamB, TParamC> {\n return {type: 'Action', text, callback}\n}\n\n/**\n * @public\n */\nexport function Then<\n TContext extends Record<string, any> = object,\n TParamA = undefined,\n TParamB = undefined,\n TParamC = undefined,\n>(\n text: string,\n callback: StepDefinitionCallback<TContext, TParamA, TParamB, TParamC>,\n): StepDefinition<TContext, TParamA, TParamB, TParamC> {\n return {type: 'Outcome', text, callback}\n}\n","/**\n * @public\n */\nexport type Hook<TContext extends Record<string, any> = object> = {\n type: 'Before' | 'After'\n callback: HookCallback<TContext>\n}\n\n/**\n * @public\n */\nexport type HookCallback<TContext extends Record<string, any> = object> = (\n context: TContext,\n) => Promise<void> | void\n\n/**\n * @public\n */\nexport function Before<TContext extends Record<string, any> = object>(\n callback: HookCallback<TContext>,\n): Hook<TContext> {\n return {type: 'Before', callback}\n}\n\n/**\n * @public\n */\nexport function After<TContext extends Record<string, any> = object>(\n callback: HookCallback<TContext>,\n): Hook<TContext> {\n return {type: 'After', callback}\n}\n"],"names":["ParameterType"],"mappings":";;;AAiBO,SAAS,oBACd,QACsB;AACtB,SAAO,IAAIA,oBAAAA;AAAAA,IACT,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO,QAAQ;AAAA,IACf,OAAO;AAAA,IACP;AAAA,IACA;AAAA,EAAA;AAEJ;ACcO,SAAS,MAMd,MACA,UACqD;AACrD,SAAO,EAAC,MAAM,WAAW,MAAM,SAAA;AACjC;AAKO,SAAS,KAMd,MACA,UACqD;AACrD,SAAO,EAAC,MAAM,UAAU,MAAM,SAAA;AAChC;AAKO,SAAS,KAMd,MACA,UACqD;AACrD,SAAO,EAAC,MAAM,WAAW,MAAM,SAAA;AACjC;AChEO,SAAS,OACd,UACgB;AAChB,SAAO,EAAC,MAAM,UAAU,SAAA;AAC1B;AAKO,SAAS,MACd,UACgB;AAChB,SAAO,EAAC,MAAM,SAAS,SAAA;AACzB;;;;;;;;"}
|
package/dist/index.d.cts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { After, Before, Given, Hook, HookCallback, StepDefinition, StepDefinitionCallback, Then, When } from "./_chunks-dts/step-definitions.cjs";
|
|
2
|
-
import { ParameterType, ParameterType as ParameterType$1, RegExps } from "@cucumber/cucumber-expressions";
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
type CompiledFeature<TStepContext extends Record<string, any> = object> = {
|
|
7
|
-
name: string;
|
|
8
|
-
tag: 'only' | 'skip' | undefined;
|
|
9
|
-
scenarios: Array<{
|
|
10
|
-
name: string;
|
|
11
|
-
tag: 'only' | 'skip' | undefined;
|
|
12
|
-
steps: Array<(stepContext?: TStepContext) => Promise<void> | void>;
|
|
13
|
-
}>;
|
|
14
|
-
beforeHooks: Array<(stepContext?: TStepContext) => Promise<void> | void>;
|
|
15
|
-
afterHooks: Array<(stepContext?: TStepContext) => Promise<void> | void>;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
declare function compileFeature<TContext extends Record<string, any> = object, TStepContext extends Record<string, any> = object>({
|
|
21
|
-
featureText,
|
|
22
|
-
hooks,
|
|
23
|
-
stepDefinitions,
|
|
24
|
-
parameterTypes
|
|
25
|
-
}: {
|
|
26
|
-
featureText: string;
|
|
27
|
-
hooks?: Array<Hook<TStepContext>>;
|
|
28
|
-
stepDefinitions: Array<StepDefinition<TContext, any, any, any>>;
|
|
29
|
-
parameterTypes?: Array<ParameterType$1<unknown>>;
|
|
30
|
-
}): CompiledFeature<TStepContext>;
|
|
31
|
-
/**
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
type ParameterTypeConfig<TType = string> = {
|
|
35
|
-
readonly name: string;
|
|
36
|
-
matcher: RegExps;
|
|
37
|
-
type?: (...args: unknown[]) => TType;
|
|
38
|
-
transform?: (...match: string[]) => TType;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
declare function createParameterType<TType = string>(config: ParameterTypeConfig<TType>): ParameterType<TType>;
|
|
44
|
-
export { After, Before, CompiledFeature, Given, Hook, HookCallback, type ParameterType, ParameterTypeConfig, StepDefinition, StepDefinitionCallback, Then, When, compileFeature, createParameterType };
|
package/dist/jest/index.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var globals = require("@jest/globals"), compileFeature = require("../_chunks-cjs/compile-feature.cjs");
|
|
4
|
-
function Feature({
|
|
5
|
-
featureText,
|
|
6
|
-
hooks,
|
|
7
|
-
stepDefinitions,
|
|
8
|
-
parameterTypes
|
|
9
|
-
}) {
|
|
10
|
-
const feature = compileFeature.compileFeature({
|
|
11
|
-
featureText,
|
|
12
|
-
hooks: hooks ?? [],
|
|
13
|
-
stepDefinitions,
|
|
14
|
-
parameterTypes: parameterTypes ?? []
|
|
15
|
-
});
|
|
16
|
-
(feature.tag === "only" ? globals.describe.only : feature.tag === "skip" ? globals.describe.skip : globals.describe)(feature.name, () => {
|
|
17
|
-
for (const before of feature.beforeHooks)
|
|
18
|
-
globals.beforeEach(before);
|
|
19
|
-
for (const after of feature.afterHooks)
|
|
20
|
-
globals.afterEach(after);
|
|
21
|
-
for (const scenario of feature.scenarios)
|
|
22
|
-
(scenario.tag === "only" ? globals.test.only : scenario.tag === "skip" ? globals.test.skip : globals.test)(scenario.name, async () => {
|
|
23
|
-
for (const step of scenario.steps)
|
|
24
|
-
await step();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
exports.Feature = Feature;
|
|
29
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/jest/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/jest/jest-gherkin-driver.ts"],"sourcesContent":["import type {ParameterType} from '@cucumber/cucumber-expressions'\nimport {afterEach, beforeEach, describe, test} from '@jest/globals'\nimport {compileFeature} from '../compile-feature'\nimport type {Hook} from '../hooks'\nimport type {StepDefinition} from '../step-definitions'\n\n/**\n * @public\n */\nexport function Feature<TContext extends Record<string, any> = object>({\n featureText,\n hooks,\n stepDefinitions,\n parameterTypes,\n}: {\n featureText: string\n hooks: Array<Hook<TContext>>\n stepDefinitions: Array<StepDefinition<TContext, any, any, any>>\n parameterTypes?: Array<ParameterType<unknown>>\n}) {\n const feature = compileFeature({\n featureText,\n hooks: hooks ?? [],\n stepDefinitions,\n parameterTypes: parameterTypes ?? [],\n })\n\n const describeFn =\n feature.tag === 'only'\n ? describe.only\n : feature.tag === 'skip'\n ? describe.skip\n : describe\n\n describeFn(feature.name, () => {\n for (const before of feature.beforeHooks) {\n beforeEach(before)\n }\n\n for (const after of feature.afterHooks) {\n afterEach(after)\n }\n\n for (const scenario of feature.scenarios) {\n const testFn =\n scenario.tag === 'only'\n ? test.only\n : scenario.tag === 'skip'\n ? test.skip\n : test\n\n testFn(scenario.name, async () => {\n for (const step of scenario.steps) {\n await step()\n }\n })\n }\n })\n}\n"],"names":["compileFeature","describe","beforeEach","afterEach","test"],"mappings":";;;AASO,SAAS,QAAuD;AAAA,EACrE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,QAAM,UAAUA,eAAAA,eAAe;AAAA,IAC7B;AAAA,IACA,OAAO,SAAS,CAAA;AAAA,IAChB;AAAA,IACA,gBAAgB,kBAAkB,CAAA;AAAA,EAAC,CACpC;AASD,GANE,QAAQ,QAAQ,SACZC,QAAAA,SAAS,OACT,QAAQ,QAAQ,SACdA,QAAAA,SAAS,OACTA,QAAAA,UAEG,QAAQ,MAAM,MAAM;AAC7B,eAAW,UAAU,QAAQ;AAC3BC,cAAAA,WAAW,MAAM;AAGnB,eAAW,SAAS,QAAQ;AAC1BC,cAAAA,UAAU,KAAK;AAGjB,eAAW,YAAY,QAAQ;AAQ7B,OANE,SAAS,QAAQ,SACbC,QAAAA,KAAK,OACL,SAAS,QAAQ,SACfA,QAAAA,KAAK,OACLA,QAAAA,MAED,SAAS,MAAM,YAAY;AAChC,mBAAW,QAAQ,SAAS;AAC1B,gBAAM,KAAA;AAAA,MAEV,CAAC;AAAA,EAEL,CAAC;AACH;;"}
|
package/dist/jest/index.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Hook, StepDefinition } from "../_chunks-dts/step-definitions.cjs";
|
|
2
|
-
import { ParameterType } from "@cucumber/cucumber-expressions";
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
declare function Feature<TContext extends Record<string, any> = object>({
|
|
7
|
-
featureText,
|
|
8
|
-
hooks,
|
|
9
|
-
stepDefinitions,
|
|
10
|
-
parameterTypes
|
|
11
|
-
}: {
|
|
12
|
-
featureText: string;
|
|
13
|
-
hooks: Array<Hook<TContext>>;
|
|
14
|
-
stepDefinitions: Array<StepDefinition<TContext, any, any, any>>;
|
|
15
|
-
parameterTypes?: Array<ParameterType<unknown>>;
|
|
16
|
-
}): void;
|
|
17
|
-
export { Feature };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var test = require("@playwright/test"), compileFeature = require("../_chunks-cjs/compile-feature.cjs");
|
|
4
|
-
function Feature({
|
|
5
|
-
featureText,
|
|
6
|
-
hooks,
|
|
7
|
-
stepDefinitions,
|
|
8
|
-
parameterTypes
|
|
9
|
-
}) {
|
|
10
|
-
const feature = compileFeature.compileFeature({
|
|
11
|
-
featureText,
|
|
12
|
-
hooks: hooks ?? [],
|
|
13
|
-
stepDefinitions,
|
|
14
|
-
parameterTypes: parameterTypes ?? []
|
|
15
|
-
});
|
|
16
|
-
(feature.tag === "only" ? test.test.describe.only : feature.tag === "skip" ? test.test.describe.skip : test.test.describe)(feature.name, () => {
|
|
17
|
-
for (const before of feature.beforeHooks)
|
|
18
|
-
test.test.beforeEach(async (playwrightOptions) => {
|
|
19
|
-
await before({
|
|
20
|
-
playwright: playwrightOptions
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
for (const after of feature.afterHooks)
|
|
24
|
-
test.test.afterEach(async (playwrightOptions) => {
|
|
25
|
-
await after({
|
|
26
|
-
playwright: playwrightOptions
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
for (const scenario of feature.scenarios)
|
|
30
|
-
(scenario.tag === "only" ? test.test.only : scenario.tag === "skip" ? test.test.skip : test.test)(scenario.name, async (playwrightOptions) => {
|
|
31
|
-
for (const step of scenario.steps)
|
|
32
|
-
await step({
|
|
33
|
-
playwright: playwrightOptions
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
exports.Feature = Feature;
|
|
39
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/playwright/playwright-gherkin-driver.ts"],"sourcesContent":["import type {ParameterType} from '@cucumber/cucumber-expressions'\nimport {\n test,\n type PlaywrightTestArgs,\n type PlaywrightTestOptions,\n type PlaywrightWorkerArgs,\n type PlaywrightWorkerOptions,\n} from '@playwright/test'\nimport {compileFeature} from '../compile-feature'\nimport type {Hook} from '../hooks'\nimport type {StepDefinition} from '../step-definitions'\n\ntype PlaywrightOptions = PlaywrightTestArgs &\n PlaywrightTestOptions &\n PlaywrightWorkerArgs &\n PlaywrightWorkerOptions\n\n/**\n * @public\n */\nexport type PlaywrightContext = Record<'string', any> & {\n playwright: PlaywrightOptions\n}\n\n/**\n * @public\n */\nexport function Feature<\n TContext extends PlaywrightContext = PlaywrightContext,\n>({\n featureText,\n hooks,\n stepDefinitions,\n parameterTypes,\n}: {\n featureText: string\n hooks?: Array<Hook<TContext>>\n stepDefinitions: Array<StepDefinition<TContext, any, any, any>>\n parameterTypes?: Array<ParameterType<unknown>>\n}) {\n const feature = compileFeature({\n featureText,\n hooks: hooks ?? [],\n stepDefinitions,\n parameterTypes: parameterTypes ?? [],\n })\n\n const describeFn =\n feature.tag === 'only'\n ? test.describe.only\n : feature.tag === 'skip'\n ? test.describe.skip\n : test.describe\n\n describeFn(feature.name, () => {\n for (const before of feature.beforeHooks) {\n test.beforeEach(async (playwrightOptions) => {\n await before({\n playwright: playwrightOptions,\n } as TContext)\n })\n }\n\n for (const after of feature.afterHooks) {\n test.afterEach(async (playwrightOptions) => {\n await after({\n playwright: playwrightOptions,\n } as TContext)\n })\n }\n\n for (const scenario of feature.scenarios) {\n const testFn =\n scenario.tag === 'only'\n ? test.only\n : scenario.tag === 'skip'\n ? test.skip\n : test\n\n testFn(scenario.name, async (playwrightOptions) => {\n for (const step of scenario.steps) {\n await step({\n playwright: playwrightOptions,\n } as TContext)\n }\n })\n }\n })\n}\n"],"names":["compileFeature","test"],"mappings":";;;AA2BO,SAAS,QAEd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,QAAM,UAAUA,eAAAA,eAAe;AAAA,IAC7B;AAAA,IACA,OAAO,SAAS,CAAA;AAAA,IAChB;AAAA,IACA,gBAAgB,kBAAkB,CAAA;AAAA,EAAC,CACpC;AASD,GANE,QAAQ,QAAQ,SACZC,KAAAA,KAAK,SAAS,OACd,QAAQ,QAAQ,SACdA,KAAAA,KAAK,SAAS,OACdA,KAAAA,KAAK,UAEF,QAAQ,MAAM,MAAM;AAC7B,eAAW,UAAU,QAAQ;AAC3BA,gBAAK,WAAW,OAAO,sBAAsB;AAC3C,cAAM,OAAO;AAAA,UACX,YAAY;AAAA,QAAA,CACD;AAAA,MACf,CAAC;AAGH,eAAW,SAAS,QAAQ;AAC1BA,gBAAK,UAAU,OAAO,sBAAsB;AAC1C,cAAM,MAAM;AAAA,UACV,YAAY;AAAA,QAAA,CACD;AAAA,MACf,CAAC;AAGH,eAAW,YAAY,QAAQ;AAQ7B,OANE,SAAS,QAAQ,SACbA,KAAAA,KAAK,OACL,SAAS,QAAQ,SACfA,KAAAA,KAAK,OACLA,KAAAA,MAED,SAAS,MAAM,OAAO,sBAAsB;AACjD,mBAAW,QAAQ,SAAS;AAC1B,gBAAM,KAAK;AAAA,YACT,YAAY;AAAA,UAAA,CACD;AAAA,MAEjB,CAAC;AAAA,EAEL,CAAC;AACH;;"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Hook, StepDefinition } from "../_chunks-dts/step-definitions.cjs";
|
|
2
|
-
import { ParameterType } from "@cucumber/cucumber-expressions";
|
|
3
|
-
import { PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions } from "@playwright/test";
|
|
4
|
-
type PlaywrightOptions = PlaywrightTestArgs & PlaywrightTestOptions & PlaywrightWorkerArgs & PlaywrightWorkerOptions;
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
type PlaywrightContext = Record<'string', any> & {
|
|
9
|
-
playwright: PlaywrightOptions;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
declare function Feature<TContext extends PlaywrightContext = PlaywrightContext>({
|
|
15
|
-
featureText,
|
|
16
|
-
hooks,
|
|
17
|
-
stepDefinitions,
|
|
18
|
-
parameterTypes
|
|
19
|
-
}: {
|
|
20
|
-
featureText: string;
|
|
21
|
-
hooks?: Array<Hook<TContext>>;
|
|
22
|
-
stepDefinitions: Array<StepDefinition<TContext, any, any, any>>;
|
|
23
|
-
parameterTypes?: Array<ParameterType<unknown>>;
|
|
24
|
-
}): void;
|
|
25
|
-
export { Feature, PlaywrightContext };
|
package/dist/vitest/index.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var vitest = require("vitest"), compileFeature = require("../_chunks-cjs/compile-feature.cjs");
|
|
4
|
-
function Feature({
|
|
5
|
-
featureText,
|
|
6
|
-
hooks,
|
|
7
|
-
stepDefinitions,
|
|
8
|
-
parameterTypes
|
|
9
|
-
}) {
|
|
10
|
-
const feature = compileFeature.compileFeature({
|
|
11
|
-
featureText,
|
|
12
|
-
hooks: hooks ?? [],
|
|
13
|
-
stepDefinitions,
|
|
14
|
-
parameterTypes: parameterTypes ?? []
|
|
15
|
-
});
|
|
16
|
-
(feature.tag === "only" ? vitest.describe.only : feature.tag === "skip" ? vitest.describe.skip : vitest.describe)(feature.name, () => {
|
|
17
|
-
for (const before of feature.beforeHooks)
|
|
18
|
-
vitest.beforeEach(before);
|
|
19
|
-
for (const after of feature.afterHooks)
|
|
20
|
-
vitest.afterEach(after);
|
|
21
|
-
for (const scenario of feature.scenarios)
|
|
22
|
-
(scenario.tag === "only" ? vitest.test.only : scenario.tag === "skip" ? vitest.test.skip : vitest.test)(scenario.name, async () => {
|
|
23
|
-
for (const step of scenario.steps)
|
|
24
|
-
await step();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
exports.Feature = Feature;
|
|
29
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/vitest/vitest-gherkin-driver.ts"],"sourcesContent":["import type {ParameterType} from '@cucumber/cucumber-expressions'\nimport {afterEach, beforeEach, describe, test} from 'vitest'\nimport {compileFeature} from '../compile-feature'\nimport type {Hook} from '../hooks'\nimport type {StepDefinition} from '../step-definitions'\n\n/**\n * @public\n */\nexport function Feature<TContext extends Record<string, any> = object>({\n featureText,\n hooks,\n stepDefinitions,\n parameterTypes,\n}: {\n featureText: string\n hooks?: Array<Hook<TContext>>\n stepDefinitions: Array<StepDefinition<TContext, any, any, any>>\n parameterTypes?: Array<ParameterType<unknown>>\n}) {\n const feature = compileFeature({\n featureText,\n hooks: hooks ?? [],\n stepDefinitions,\n parameterTypes: parameterTypes ?? [],\n })\n\n const describeFn =\n feature.tag === 'only'\n ? describe.only\n : feature.tag === 'skip'\n ? describe.skip\n : describe\n\n describeFn(feature.name, () => {\n for (const before of feature.beforeHooks) {\n beforeEach(before)\n }\n\n for (const after of feature.afterHooks) {\n afterEach(after)\n }\n\n for (const scenario of feature.scenarios) {\n const testFn =\n scenario.tag === 'only'\n ? test.only\n : scenario.tag === 'skip'\n ? test.skip\n : test\n\n testFn(scenario.name, async () => {\n for (const step of scenario.steps) {\n await step()\n }\n })\n }\n })\n}\n"],"names":["compileFeature","describe","beforeEach","afterEach","test"],"mappings":";;;AASO,SAAS,QAAuD;AAAA,EACrE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,QAAM,UAAUA,eAAAA,eAAe;AAAA,IAC7B;AAAA,IACA,OAAO,SAAS,CAAA;AAAA,IAChB;AAAA,IACA,gBAAgB,kBAAkB,CAAA;AAAA,EAAC,CACpC;AASD,GANE,QAAQ,QAAQ,SACZC,OAAAA,SAAS,OACT,QAAQ,QAAQ,SACdA,OAAAA,SAAS,OACTA,OAAAA,UAEG,QAAQ,MAAM,MAAM;AAC7B,eAAW,UAAU,QAAQ;AAC3BC,aAAAA,WAAW,MAAM;AAGnB,eAAW,SAAS,QAAQ;AAC1BC,aAAAA,UAAU,KAAK;AAGjB,eAAW,YAAY,QAAQ;AAQ7B,OANE,SAAS,QAAQ,SACbC,OAAAA,KAAK,OACL,SAAS,QAAQ,SACfA,OAAAA,KAAK,OACLA,OAAAA,MAED,SAAS,MAAM,YAAY;AAChC,mBAAW,QAAQ,SAAS;AAC1B,gBAAM,KAAA;AAAA,MAEV,CAAC;AAAA,EAEL,CAAC;AACH;;"}
|
package/dist/vitest/index.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Hook, StepDefinition } from "../_chunks-dts/step-definitions.cjs";
|
|
2
|
-
import { ParameterType } from "@cucumber/cucumber-expressions";
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
declare function Feature<TContext extends Record<string, any> = object>({
|
|
7
|
-
featureText,
|
|
8
|
-
hooks,
|
|
9
|
-
stepDefinitions,
|
|
10
|
-
parameterTypes
|
|
11
|
-
}: {
|
|
12
|
-
featureText: string;
|
|
13
|
-
hooks?: Array<Hook<TContext>>;
|
|
14
|
-
stepDefinitions: Array<StepDefinition<TContext, any, any, any>>;
|
|
15
|
-
parameterTypes?: Array<ParameterType<unknown>>;
|
|
16
|
-
}): void;
|
|
17
|
-
export { Feature };
|