@step-forge/step-forge 0.0.17 → 0.0.20
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/README.md +3 -2
- package/dist/{analyzer-QH03uejK.js → analyzer-DJyJbU_V.js} +4 -105
- package/dist/analyzer-DJyJbU_V.js.map +1 -0
- package/dist/analyzer-cli.js +1 -1
- package/dist/analyzer-cli.js.map +1 -1
- package/dist/analyzer.d.ts +14 -0
- package/dist/analyzer.js +2 -1
- package/dist/gherkinParser-Dp2d7JNr.js +116 -0
- package/dist/gherkinParser-Dp2d7JNr.js.map +1 -0
- package/dist/hooks-CGYzwDOv.cjs +117 -0
- package/dist/hooks-CGYzwDOv.cjs.map +1 -0
- package/dist/hooks-CywugMQQ.js +82 -0
- package/dist/hooks-CywugMQQ.js.map +1 -0
- package/dist/hooks-Dar49TtT.d.cts +189 -0
- package/dist/hooks-Dar49TtT.d.ts +189 -0
- package/dist/runtime.cjs +168 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +69 -0
- package/dist/runtime.d.ts +69 -0
- package/dist/runtime.js +159 -0
- package/dist/runtime.js.map +1 -0
- package/dist/step-forge.cjs +203 -134
- package/dist/step-forge.cjs.map +1 -1
- package/dist/step-forge.d.cts +287 -381
- package/dist/step-forge.d.ts +287 -381
- package/dist/step-forge.js +197 -135
- package/dist/step-forge.js.map +1 -1
- package/dist/vitest.d.ts +74 -0
- package/dist/vitest.js +136 -0
- package/dist/vitest.js.map +1 -0
- package/package.json +26 -9
- package/dist/analyzer-QH03uejK.js.map +0 -1
package/dist/step-forge.d.ts
CHANGED
|
@@ -1,82 +1,223 @@
|
|
|
1
|
+
import { C as numberParser, S as intParser, _ as StepDefinitionMeta, b as Parser, d as AnalysisRule, f as AnalyzerConfig, g as ParsedStep, h as ParsedScenario, i as PlainHookFn, m as MatchedStep, o as ScenarioHookFn, p as Diagnostic, s as ScenarioInfo, v as BasicWorld, w as stringParser, x as booleanParser, y as MergeableWorld } from "./hooks-Dar49TtT.js";
|
|
2
|
+
|
|
1
3
|
//#region src/builderTypeUtils.d.ts
|
|
2
|
-
type
|
|
4
|
+
type StepType = "given" | "when" | "then";
|
|
5
|
+
/** A dependency declaration: each key of a phase's state marked required/optional. */
|
|
3
6
|
type RequiredOrOptional<T> = { [K in keyof T]?: "required" | "optional" };
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/** The dependency map for a single phase, keyed by state property name. */
|
|
8
|
+
type DepMap = Record<string, "required" | "optional">;
|
|
9
|
+
/** The fully-resolved dependency declaration passed to `addStep` at runtime. */
|
|
10
|
+
type FullDependencies = {
|
|
11
|
+
given: DepMap;
|
|
12
|
+
when: DepMap;
|
|
13
|
+
then: DepMap;
|
|
9
14
|
};
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/parsers.d.ts
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* step (e.g. `{int}`). `parse` converts the raw value Cucumber captures into
|
|
17
|
-
* the desired TypeScript type.
|
|
18
|
-
*
|
|
19
|
-
* Note: Cucumber Expressions already transform `{int}`/`{float}` captures into
|
|
20
|
-
* JS numbers before the step function runs, so `parse` receives an `unknown`
|
|
21
|
-
* and must tolerate both the pre-transformed value and a raw string.
|
|
16
|
+
* Narrows a phase's full state to only the keys named in a dependency map.
|
|
17
|
+
* Optional dependencies widen to `| undefined`; keys not present in the state
|
|
18
|
+
* are dropped. This is the shape a step function sees for `given`/`when`/`then`.
|
|
22
19
|
*/
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
gherkin: string;
|
|
26
|
-
};
|
|
27
|
-
/** Matches a quoted string (`{string}`) and passes the unquoted contents through. */
|
|
28
|
-
declare const stringParser: Parser<string>;
|
|
29
|
-
/** Matches an unquoted integer (`{int}`). */
|
|
30
|
-
declare const intParser: Parser<number>;
|
|
31
|
-
/** Matches an unquoted floating point number (`{float}`). */
|
|
32
|
-
declare const numberParser: Parser<number>;
|
|
33
|
-
/** Matches an unquoted `true`/`false` word (`{word}`) and parses it to a boolean. */
|
|
34
|
-
declare const booleanParser: Parser<boolean>;
|
|
20
|
+
type Restrict<State, Deps extends RequiredOrOptional<State>> = { [K in keyof State as K extends keyof Deps ? K : never]: Deps[K] extends "optional" ? State[K] | undefined : State[K] };
|
|
21
|
+
type GetFunctionArgs<T> = T extends ((...args: infer A) => any) ? A : never;
|
|
35
22
|
//#endregion
|
|
36
23
|
//#region src/given.d.ts
|
|
24
|
+
type GivenInput<Variables, Given> = {
|
|
25
|
+
variables: Variables;
|
|
26
|
+
given: Given;
|
|
27
|
+
when: never;
|
|
28
|
+
then: never;
|
|
29
|
+
};
|
|
30
|
+
type GivenOutput<GivenState> = Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
37
31
|
declare const givenBuilder: <GivenState>() => {
|
|
38
32
|
statement: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
33
|
+
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>>(dependencies: {
|
|
34
|
+
given: GivenDeps;
|
|
35
|
+
}) => {
|
|
36
|
+
step: (stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>>) => GivenOutput<GivenState>) => {
|
|
37
|
+
statement: (...args: any[]) => string;
|
|
38
|
+
expression: string;
|
|
39
|
+
dependencies: FullDependencies;
|
|
40
|
+
stepType: StepType;
|
|
41
|
+
stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>>) => GivenOutput<GivenState>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
parsers: <Parsers extends ((Statement extends string ? [] : GetFunctionArgs<Statement>) extends infer T ? { [K in keyof T]: Parser<(Statement extends string ? [] : GetFunctionArgs<Statement>)[K]> } : never)>(parsers: Parsers) => {
|
|
45
|
+
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>>(dependencies: {
|
|
46
|
+
given: GivenDeps;
|
|
47
|
+
}) => {
|
|
48
|
+
step: (stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>>) => GivenOutput<GivenState>) => {
|
|
49
|
+
statement: (...args: any[]) => string;
|
|
50
|
+
expression: string;
|
|
51
|
+
dependencies: FullDependencies;
|
|
52
|
+
stepType: StepType;
|
|
53
|
+
stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>>) => GivenOutput<GivenState>;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
step: (stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never>) => GivenOutput<GivenState>) => {
|
|
57
|
+
statement: (...args: any[]) => string;
|
|
58
|
+
expression: string;
|
|
59
|
+
dependencies: FullDependencies;
|
|
60
|
+
stepType: StepType;
|
|
61
|
+
stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never>) => GivenOutput<GivenState>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
step: (stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never>) => GivenOutput<GivenState>) => {
|
|
65
|
+
statement: (...args: any[]) => string;
|
|
66
|
+
expression: string;
|
|
67
|
+
dependencies: FullDependencies;
|
|
68
|
+
stepType: StepType;
|
|
69
|
+
stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never>) => GivenOutput<GivenState>;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/when.d.ts
|
|
75
|
+
type WhenInput<Variables, Given, When> = {
|
|
76
|
+
variables: Variables;
|
|
77
|
+
given: Given;
|
|
78
|
+
when: When;
|
|
79
|
+
then: never;
|
|
80
|
+
};
|
|
81
|
+
type WhenOutput<WhenState> = Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
82
|
+
declare const whenBuilder: <GivenState, WhenState>() => {
|
|
83
|
+
statement: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
84
|
+
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps extends RequiredOrOptional<WhenState>>(dependencies: {
|
|
85
|
+
given?: GivenDeps | undefined;
|
|
86
|
+
when?: WhenDeps | undefined;
|
|
87
|
+
}) => {
|
|
88
|
+
step: (stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>>) => WhenOutput<WhenState>) => {
|
|
89
|
+
statement: (...args: any[]) => string;
|
|
90
|
+
expression: string;
|
|
91
|
+
dependencies: FullDependencies;
|
|
92
|
+
stepType: StepType;
|
|
93
|
+
stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>>) => WhenOutput<WhenState>;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
parsers: <Parsers extends ((Statement extends string ? [] : GetFunctionArgs<Statement>) extends infer T ? { [K in keyof T]: Parser<(Statement extends string ? [] : GetFunctionArgs<Statement>)[K]> } : never)>(parsers: Parsers) => {
|
|
97
|
+
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps extends RequiredOrOptional<WhenState>>(dependencies: {
|
|
98
|
+
given?: GivenDeps | undefined;
|
|
99
|
+
when?: WhenDeps | undefined;
|
|
100
|
+
}) => {
|
|
101
|
+
step: (stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>>) => WhenOutput<WhenState>) => {
|
|
102
|
+
statement: (...args: any[]) => string;
|
|
103
|
+
expression: string;
|
|
104
|
+
dependencies: FullDependencies;
|
|
105
|
+
stepType: StepType;
|
|
106
|
+
stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>>) => WhenOutput<WhenState>;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
step: (stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never>) => WhenOutput<WhenState>) => {
|
|
110
|
+
statement: (...args: any[]) => string;
|
|
111
|
+
expression: string;
|
|
112
|
+
dependencies: FullDependencies;
|
|
113
|
+
stepType: StepType;
|
|
114
|
+
stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never>) => WhenOutput<WhenState>;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
step: (stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never>) => WhenOutput<WhenState>) => {
|
|
118
|
+
statement: (...args: any[]) => string;
|
|
119
|
+
expression: string;
|
|
120
|
+
dependencies: FullDependencies;
|
|
121
|
+
stepType: StepType;
|
|
122
|
+
stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never>) => WhenOutput<WhenState>;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/then.d.ts
|
|
128
|
+
type ThenInput<Variables, Given, When, Then> = {
|
|
129
|
+
variables: Variables;
|
|
130
|
+
given: Given;
|
|
131
|
+
when: When;
|
|
132
|
+
then: Then;
|
|
133
|
+
};
|
|
134
|
+
type ThenOutput<ThenState> = Partial<ThenState> | Promise<Partial<ThenState>> | void | Promise<void>;
|
|
135
|
+
declare const thenBuilder: <GivenState, WhenState, ThenState>() => {
|
|
136
|
+
statement: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
137
|
+
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps extends RequiredOrOptional<WhenState>, ThenDeps extends RequiredOrOptional<ThenState>>(dependencies: {
|
|
138
|
+
given?: GivenDeps | undefined;
|
|
139
|
+
when?: WhenDeps | undefined;
|
|
140
|
+
then?: ThenDeps | undefined;
|
|
141
|
+
}) => {
|
|
142
|
+
step: (stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>, Restrict<ThenState, ThenDeps>>) => ThenOutput<ThenState>) => {
|
|
143
|
+
statement: (...args: any[]) => string;
|
|
144
|
+
expression: string;
|
|
145
|
+
dependencies: FullDependencies;
|
|
146
|
+
stepType: StepType;
|
|
147
|
+
stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>, Restrict<ThenState, ThenDeps>>) => ThenOutput<ThenState>;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
parsers: <Parsers extends ((Statement extends string ? [] : GetFunctionArgs<Statement>) extends infer T ? { [K in keyof T]: Parser<(Statement extends string ? [] : GetFunctionArgs<Statement>)[K]> } : never)>(parsers: Parsers) => {
|
|
151
|
+
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps extends RequiredOrOptional<WhenState>, ThenDeps extends RequiredOrOptional<ThenState>>(dependencies: {
|
|
152
|
+
given?: GivenDeps | undefined;
|
|
153
|
+
when?: WhenDeps | undefined;
|
|
154
|
+
then?: ThenDeps | undefined;
|
|
155
|
+
}) => {
|
|
156
|
+
step: (stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>, Restrict<ThenState, ThenDeps>>) => ThenOutput<ThenState>) => {
|
|
157
|
+
statement: (...args: any[]) => string;
|
|
158
|
+
expression: string;
|
|
159
|
+
dependencies: FullDependencies;
|
|
160
|
+
stepType: StepType;
|
|
161
|
+
stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>, Restrict<ThenState, ThenDeps>>) => ThenOutput<ThenState>;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
step: (stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never, never>) => ThenOutput<ThenState>) => {
|
|
165
|
+
statement: (...args: any[]) => string;
|
|
166
|
+
expression: string;
|
|
167
|
+
dependencies: FullDependencies;
|
|
168
|
+
stepType: StepType;
|
|
169
|
+
stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never, never>) => ThenOutput<ThenState>;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
step: (stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never, never>) => ThenOutput<ThenState>) => {
|
|
173
|
+
statement: (...args: any[]) => string;
|
|
174
|
+
expression: string;
|
|
175
|
+
dependencies: FullDependencies;
|
|
176
|
+
stepType: StepType;
|
|
177
|
+
stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never, never>) => ThenOutput<ThenState>;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/analyzer/stepExtractor.d.ts
|
|
183
|
+
declare function extractStepDefinitions(filePaths: string[], tsConfigPath?: string): StepDefinitionMeta[];
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/analyzer/gherkinParser.d.ts
|
|
186
|
+
declare function parseFeatureFiles(filePaths: string[]): ParsedScenario[];
|
|
187
|
+
declare function parseFeatureContent(content: string, filePath: string): ParsedScenario[];
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/analyzer/stepMatcher.d.ts
|
|
190
|
+
declare function matchScenarioSteps(scenario: ParsedScenario, definitions: StepDefinitionMeta[]): MatchedStep[];
|
|
191
|
+
declare function findMatchingDefinitions(text: string, effectiveKeyword: "Given" | "When" | "Then", definitions: StepDefinitionMeta[]): StepDefinitionMeta[];
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/analyzer/index.d.ts
|
|
194
|
+
interface AnalyzeOptions {
|
|
195
|
+
rules?: AnalysisRule[];
|
|
196
|
+
}
|
|
197
|
+
declare function analyze(config: AnalyzerConfig, options?: AnalyzeOptions): Promise<Diagnostic[]>;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/init.d.ts
|
|
200
|
+
declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
201
|
+
Given: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
39
202
|
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>>(dependencies: {
|
|
40
203
|
given: GivenDeps;
|
|
41
204
|
}) => {
|
|
42
205
|
step: (stepFunction: (input: {
|
|
43
206
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
44
|
-
given:
|
|
207
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
45
208
|
when: never;
|
|
46
209
|
then: never;
|
|
47
210
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
48
|
-
statement:
|
|
211
|
+
statement: (...args: any[]) => string;
|
|
49
212
|
expression: string;
|
|
50
|
-
dependencies:
|
|
51
|
-
|
|
52
|
-
} & {
|
|
53
|
-
when: EmptyObject;
|
|
54
|
-
then: EmptyObject;
|
|
55
|
-
};
|
|
56
|
-
stepType: "given";
|
|
213
|
+
dependencies: FullDependencies;
|
|
214
|
+
stepType: StepType;
|
|
57
215
|
stepFunction: (input: {
|
|
58
216
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
59
|
-
given:
|
|
217
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
60
218
|
when: never;
|
|
61
219
|
then: never;
|
|
62
220
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
63
|
-
register: () => {
|
|
64
|
-
stepType: "given";
|
|
65
|
-
expression: string;
|
|
66
|
-
dependencies: {
|
|
67
|
-
given: GivenDeps;
|
|
68
|
-
} & {
|
|
69
|
-
when: EmptyObject;
|
|
70
|
-
then: EmptyObject;
|
|
71
|
-
};
|
|
72
|
-
statement: Statement extends string ? () => string : Statement;
|
|
73
|
-
stepFunction: (input: {
|
|
74
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
75
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
76
|
-
when: never;
|
|
77
|
-
then: never;
|
|
78
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
79
|
-
};
|
|
80
221
|
};
|
|
81
222
|
};
|
|
82
223
|
parsers: <Parsers extends ((Statement extends string ? [] : GetFunctionArgs<Statement>) extends infer T ? { [K in keyof T]: Parser<(Statement extends string ? [] : GetFunctionArgs<Statement>)[K]> } : never)>(parsers: Parsers) => {
|
|
@@ -85,42 +226,20 @@ declare const givenBuilder: <GivenState>() => {
|
|
|
85
226
|
}) => {
|
|
86
227
|
step: (stepFunction: (input: {
|
|
87
228
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
88
|
-
given:
|
|
229
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
89
230
|
when: never;
|
|
90
231
|
then: never;
|
|
91
232
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
92
|
-
statement:
|
|
233
|
+
statement: (...args: any[]) => string;
|
|
93
234
|
expression: string;
|
|
94
|
-
dependencies:
|
|
95
|
-
|
|
96
|
-
} & {
|
|
97
|
-
when: EmptyObject;
|
|
98
|
-
then: EmptyObject;
|
|
99
|
-
};
|
|
100
|
-
stepType: "given";
|
|
235
|
+
dependencies: FullDependencies;
|
|
236
|
+
stepType: StepType;
|
|
101
237
|
stepFunction: (input: {
|
|
102
238
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
103
|
-
given:
|
|
239
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
104
240
|
when: never;
|
|
105
241
|
then: never;
|
|
106
242
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
107
|
-
register: () => {
|
|
108
|
-
stepType: "given";
|
|
109
|
-
expression: string;
|
|
110
|
-
dependencies: {
|
|
111
|
-
given: GivenDeps;
|
|
112
|
-
} & {
|
|
113
|
-
when: EmptyObject;
|
|
114
|
-
then: EmptyObject;
|
|
115
|
-
};
|
|
116
|
-
statement: Statement extends string ? () => string : Statement;
|
|
117
|
-
stepFunction: (input: {
|
|
118
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
119
|
-
given: { [K_1 in keyof GivenState as K_1 extends keyof GivenDeps ? K_1 : never]: GivenDeps[K_1] extends "optional" ? GivenState[K_1] | undefined : GivenState[K_1] };
|
|
120
|
-
when: never;
|
|
121
|
-
then: never;
|
|
122
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
123
|
-
};
|
|
124
243
|
};
|
|
125
244
|
};
|
|
126
245
|
step: (stepFunction: (input: {
|
|
@@ -129,28 +248,16 @@ declare const givenBuilder: <GivenState>() => {
|
|
|
129
248
|
when: never;
|
|
130
249
|
then: never;
|
|
131
250
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
132
|
-
statement:
|
|
251
|
+
statement: (...args: any[]) => string;
|
|
133
252
|
expression: string;
|
|
134
|
-
dependencies:
|
|
135
|
-
stepType:
|
|
253
|
+
dependencies: FullDependencies;
|
|
254
|
+
stepType: StepType;
|
|
136
255
|
stepFunction: (input: {
|
|
137
256
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
138
257
|
given: never;
|
|
139
258
|
when: never;
|
|
140
259
|
then: never;
|
|
141
260
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
142
|
-
register: () => {
|
|
143
|
-
stepType: "given";
|
|
144
|
-
expression: string;
|
|
145
|
-
dependencies: EmptyDependencies;
|
|
146
|
-
statement: Statement extends string ? () => string : Statement;
|
|
147
|
-
stepFunction: (input: {
|
|
148
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
149
|
-
given: never;
|
|
150
|
-
when: never;
|
|
151
|
-
then: never;
|
|
152
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
153
|
-
};
|
|
154
261
|
};
|
|
155
262
|
};
|
|
156
263
|
step: (stepFunction: (input: {
|
|
@@ -159,75 +266,39 @@ declare const givenBuilder: <GivenState>() => {
|
|
|
159
266
|
when: never;
|
|
160
267
|
then: never;
|
|
161
268
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
162
|
-
statement:
|
|
269
|
+
statement: (...args: any[]) => string;
|
|
163
270
|
expression: string;
|
|
164
|
-
dependencies:
|
|
165
|
-
stepType:
|
|
271
|
+
dependencies: FullDependencies;
|
|
272
|
+
stepType: StepType;
|
|
166
273
|
stepFunction: (input: {
|
|
167
274
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
168
275
|
given: never;
|
|
169
276
|
when: never;
|
|
170
277
|
then: never;
|
|
171
278
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
172
|
-
register: () => {
|
|
173
|
-
stepType: "given";
|
|
174
|
-
expression: string;
|
|
175
|
-
dependencies: EmptyDependencies;
|
|
176
|
-
statement: Statement extends string ? () => string : Statement;
|
|
177
|
-
stepFunction: (input: {
|
|
178
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
179
|
-
given: never;
|
|
180
|
-
when: never;
|
|
181
|
-
then: never;
|
|
182
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
183
|
-
};
|
|
184
279
|
};
|
|
185
280
|
};
|
|
186
|
-
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region src/when.d.ts
|
|
189
|
-
declare const whenBuilder: <GivenState, WhenState>() => {
|
|
190
|
-
statement: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
281
|
+
When: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
191
282
|
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps extends RequiredOrOptional<WhenState>>(dependencies: {
|
|
192
283
|
given?: GivenDeps | undefined;
|
|
193
284
|
when?: WhenDeps | undefined;
|
|
194
285
|
}) => {
|
|
195
286
|
step: (stepFunction: (input: {
|
|
196
287
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
197
|
-
given:
|
|
198
|
-
when:
|
|
288
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
289
|
+
when: Restrict<WhenState, WhenDeps>;
|
|
199
290
|
then: never;
|
|
200
291
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
201
|
-
statement:
|
|
292
|
+
statement: (...args: any[]) => string;
|
|
202
293
|
expression: string;
|
|
203
|
-
dependencies:
|
|
204
|
-
|
|
205
|
-
when: WhenDeps;
|
|
206
|
-
then: EmptyObject;
|
|
207
|
-
};
|
|
208
|
-
stepType: "when";
|
|
294
|
+
dependencies: FullDependencies;
|
|
295
|
+
stepType: StepType;
|
|
209
296
|
stepFunction: (input: {
|
|
210
297
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
211
|
-
given:
|
|
212
|
-
when:
|
|
298
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
299
|
+
when: Restrict<WhenState, WhenDeps>;
|
|
213
300
|
then: never;
|
|
214
301
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
215
|
-
register: () => {
|
|
216
|
-
stepType: "when";
|
|
217
|
-
expression: string;
|
|
218
|
-
dependencies: {
|
|
219
|
-
given: GivenDeps;
|
|
220
|
-
when: WhenDeps;
|
|
221
|
-
then: EmptyObject;
|
|
222
|
-
};
|
|
223
|
-
statement: Statement extends string ? () => string : Statement;
|
|
224
|
-
stepFunction: (input: {
|
|
225
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
226
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
227
|
-
when: { [K_1 in keyof WhenState as K_1 extends keyof WhenDeps ? K_1 : never]: WhenDeps[K_1] extends "optional" ? WhenState[K_1] | undefined : WhenState[K_1] };
|
|
228
|
-
then: never;
|
|
229
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
230
|
-
};
|
|
231
302
|
};
|
|
232
303
|
};
|
|
233
304
|
parsers: <Parsers extends ((Statement extends string ? [] : GetFunctionArgs<Statement>) extends infer T ? { [K in keyof T]: Parser<(Statement extends string ? [] : GetFunctionArgs<Statement>)[K]> } : never)>(parsers: Parsers) => {
|
|
@@ -237,40 +308,20 @@ declare const whenBuilder: <GivenState, WhenState>() => {
|
|
|
237
308
|
}) => {
|
|
238
309
|
step: (stepFunction: (input: {
|
|
239
310
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
240
|
-
given:
|
|
241
|
-
when:
|
|
311
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
312
|
+
when: Restrict<WhenState, WhenDeps>;
|
|
242
313
|
then: never;
|
|
243
314
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
244
|
-
statement:
|
|
315
|
+
statement: (...args: any[]) => string;
|
|
245
316
|
expression: string;
|
|
246
|
-
dependencies:
|
|
247
|
-
|
|
248
|
-
when: WhenDeps;
|
|
249
|
-
then: EmptyObject;
|
|
250
|
-
};
|
|
251
|
-
stepType: "when";
|
|
317
|
+
dependencies: FullDependencies;
|
|
318
|
+
stepType: StepType;
|
|
252
319
|
stepFunction: (input: {
|
|
253
320
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
254
|
-
given:
|
|
255
|
-
when:
|
|
321
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
322
|
+
when: Restrict<WhenState, WhenDeps>;
|
|
256
323
|
then: never;
|
|
257
324
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
258
|
-
register: () => {
|
|
259
|
-
stepType: "when";
|
|
260
|
-
expression: string;
|
|
261
|
-
dependencies: {
|
|
262
|
-
given: GivenDeps;
|
|
263
|
-
when: WhenDeps;
|
|
264
|
-
then: EmptyObject;
|
|
265
|
-
};
|
|
266
|
-
statement: Statement extends string ? () => string : Statement;
|
|
267
|
-
stepFunction: (input: {
|
|
268
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
269
|
-
given: { [K_1 in keyof GivenState as K_1 extends keyof GivenDeps ? K_1 : never]: GivenDeps[K_1] extends "optional" ? GivenState[K_1] | undefined : GivenState[K_1] };
|
|
270
|
-
when: { [K_2 in keyof WhenState as K_2 extends keyof WhenDeps ? K_2 : never]: WhenDeps[K_2] extends "optional" ? WhenState[K_2] | undefined : WhenState[K_2] };
|
|
271
|
-
then: never;
|
|
272
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
273
|
-
};
|
|
274
325
|
};
|
|
275
326
|
};
|
|
276
327
|
step: (stepFunction: (input: {
|
|
@@ -279,28 +330,16 @@ declare const whenBuilder: <GivenState, WhenState>() => {
|
|
|
279
330
|
when: never;
|
|
280
331
|
then: never;
|
|
281
332
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
282
|
-
statement:
|
|
333
|
+
statement: (...args: any[]) => string;
|
|
283
334
|
expression: string;
|
|
284
|
-
dependencies:
|
|
285
|
-
stepType:
|
|
335
|
+
dependencies: FullDependencies;
|
|
336
|
+
stepType: StepType;
|
|
286
337
|
stepFunction: (input: {
|
|
287
338
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
288
339
|
given: never;
|
|
289
340
|
when: never;
|
|
290
341
|
then: never;
|
|
291
342
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
292
|
-
register: () => {
|
|
293
|
-
stepType: "when";
|
|
294
|
-
expression: string;
|
|
295
|
-
dependencies: EmptyDependencies;
|
|
296
|
-
statement: Statement extends string ? () => string : Statement;
|
|
297
|
-
stepFunction: (input: {
|
|
298
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
299
|
-
given: never;
|
|
300
|
-
when: never;
|
|
301
|
-
then: never;
|
|
302
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
303
|
-
};
|
|
304
343
|
};
|
|
305
344
|
};
|
|
306
345
|
step: (stepFunction: (input: {
|
|
@@ -309,120 +348,64 @@ declare const whenBuilder: <GivenState, WhenState>() => {
|
|
|
309
348
|
when: never;
|
|
310
349
|
then: never;
|
|
311
350
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
312
|
-
statement:
|
|
351
|
+
statement: (...args: any[]) => string;
|
|
313
352
|
expression: string;
|
|
314
|
-
dependencies:
|
|
315
|
-
stepType:
|
|
353
|
+
dependencies: FullDependencies;
|
|
354
|
+
stepType: StepType;
|
|
316
355
|
stepFunction: (input: {
|
|
317
356
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
318
357
|
given: never;
|
|
319
358
|
when: never;
|
|
320
359
|
then: never;
|
|
321
360
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
322
|
-
register: () => {
|
|
323
|
-
stepType: "when";
|
|
324
|
-
expression: string;
|
|
325
|
-
dependencies: EmptyDependencies;
|
|
326
|
-
statement: Statement extends string ? () => string : Statement;
|
|
327
|
-
stepFunction: (input: {
|
|
328
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
329
|
-
given: never;
|
|
330
|
-
when: never;
|
|
331
|
-
then: never;
|
|
332
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
333
|
-
};
|
|
334
361
|
};
|
|
335
362
|
};
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
//#region src/then.d.ts
|
|
339
|
-
declare const thenBuilder: <GivenState, WhenState, ThenState>() => {
|
|
340
|
-
statement: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
341
|
-
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps extends RequiredOrOptional<WhenState>, ThenDeps extends RequiredOrOptional<ThenState>>(dependencies: {
|
|
363
|
+
Then: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
364
|
+
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps_1 extends RequiredOrOptional<WhenState>, ThenDeps extends RequiredOrOptional<ThenState>>(dependencies: {
|
|
342
365
|
given?: GivenDeps | undefined;
|
|
343
|
-
when?:
|
|
366
|
+
when?: WhenDeps_1 | undefined;
|
|
344
367
|
then?: ThenDeps | undefined;
|
|
345
368
|
}) => {
|
|
346
369
|
step: (stepFunction: (input: {
|
|
347
370
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
348
|
-
given:
|
|
349
|
-
when:
|
|
350
|
-
then:
|
|
371
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
372
|
+
when: Restrict<WhenState, WhenDeps_1>;
|
|
373
|
+
then: Restrict<ThenState, ThenDeps>;
|
|
351
374
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
352
|
-
statement:
|
|
375
|
+
statement: (...args: any[]) => string;
|
|
353
376
|
expression: string;
|
|
354
|
-
dependencies:
|
|
355
|
-
|
|
356
|
-
when: WhenDeps;
|
|
357
|
-
then: ThenDeps;
|
|
358
|
-
};
|
|
359
|
-
stepType: "then";
|
|
377
|
+
dependencies: FullDependencies;
|
|
378
|
+
stepType: StepType;
|
|
360
379
|
stepFunction: (input: {
|
|
361
380
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
362
|
-
given:
|
|
363
|
-
when:
|
|
364
|
-
then:
|
|
381
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
382
|
+
when: Restrict<WhenState, WhenDeps_1>;
|
|
383
|
+
then: Restrict<ThenState, ThenDeps>;
|
|
365
384
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
366
|
-
register: () => {
|
|
367
|
-
stepType: "then";
|
|
368
|
-
expression: string;
|
|
369
|
-
dependencies: {
|
|
370
|
-
given: GivenDeps;
|
|
371
|
-
when: WhenDeps;
|
|
372
|
-
then: ThenDeps;
|
|
373
|
-
};
|
|
374
|
-
statement: Statement extends string ? () => string : Statement;
|
|
375
|
-
stepFunction: (input: {
|
|
376
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
377
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
378
|
-
when: { [K_1 in keyof WhenState as K_1 extends keyof WhenDeps ? K_1 : never]: WhenDeps[K_1] extends "optional" ? WhenState[K_1] | undefined : WhenState[K_1] };
|
|
379
|
-
then: { [K_2 in keyof ThenState as K_2 extends keyof ThenDeps ? K_2 : never]: ThenDeps[K_2] extends "optional" ? ThenState[K_2] | undefined : ThenState[K_2] };
|
|
380
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
381
|
-
};
|
|
382
385
|
};
|
|
383
386
|
};
|
|
384
387
|
parsers: <Parsers extends ((Statement extends string ? [] : GetFunctionArgs<Statement>) extends infer T ? { [K in keyof T]: Parser<(Statement extends string ? [] : GetFunctionArgs<Statement>)[K]> } : never)>(parsers: Parsers) => {
|
|
385
|
-
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>,
|
|
388
|
+
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps_1 extends RequiredOrOptional<WhenState>, ThenDeps extends RequiredOrOptional<ThenState>>(dependencies: {
|
|
386
389
|
given?: GivenDeps | undefined;
|
|
387
|
-
when?:
|
|
390
|
+
when?: WhenDeps_1 | undefined;
|
|
388
391
|
then?: ThenDeps | undefined;
|
|
389
392
|
}) => {
|
|
390
393
|
step: (stepFunction: (input: {
|
|
391
394
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
392
|
-
given:
|
|
393
|
-
when:
|
|
394
|
-
then:
|
|
395
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
396
|
+
when: Restrict<WhenState, WhenDeps_1>;
|
|
397
|
+
then: Restrict<ThenState, ThenDeps>;
|
|
395
398
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
396
|
-
statement:
|
|
399
|
+
statement: (...args: any[]) => string;
|
|
397
400
|
expression: string;
|
|
398
|
-
dependencies:
|
|
399
|
-
|
|
400
|
-
when: WhenDeps;
|
|
401
|
-
then: ThenDeps;
|
|
402
|
-
};
|
|
403
|
-
stepType: "then";
|
|
401
|
+
dependencies: FullDependencies;
|
|
402
|
+
stepType: StepType;
|
|
404
403
|
stepFunction: (input: {
|
|
405
404
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
406
|
-
given:
|
|
407
|
-
when:
|
|
408
|
-
then:
|
|
405
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
406
|
+
when: Restrict<WhenState, WhenDeps_1>;
|
|
407
|
+
then: Restrict<ThenState, ThenDeps>;
|
|
409
408
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
410
|
-
register: () => {
|
|
411
|
-
stepType: "then";
|
|
412
|
-
expression: string;
|
|
413
|
-
dependencies: {
|
|
414
|
-
given: GivenDeps;
|
|
415
|
-
when: WhenDeps;
|
|
416
|
-
then: ThenDeps;
|
|
417
|
-
};
|
|
418
|
-
statement: Statement extends string ? () => string : Statement;
|
|
419
|
-
stepFunction: (input: {
|
|
420
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
421
|
-
given: { [K_1 in keyof GivenState as K_1 extends keyof GivenDeps ? K_1 : never]: GivenDeps[K_1] extends "optional" ? GivenState[K_1] | undefined : GivenState[K_1] };
|
|
422
|
-
when: { [K_2 in keyof WhenState as K_2 extends keyof WhenDeps ? K_2 : never]: WhenDeps[K_2] extends "optional" ? WhenState[K_2] | undefined : WhenState[K_2] };
|
|
423
|
-
then: { [K_3 in keyof ThenState as K_3 extends keyof ThenDeps ? K_3 : never]: ThenDeps[K_3] extends "optional" ? ThenState[K_3] | undefined : ThenState[K_3] };
|
|
424
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
425
|
-
};
|
|
426
409
|
};
|
|
427
410
|
};
|
|
428
411
|
step: (stepFunction: (input: {
|
|
@@ -431,28 +414,16 @@ declare const thenBuilder: <GivenState, WhenState, ThenState>() => {
|
|
|
431
414
|
when: never;
|
|
432
415
|
then: never;
|
|
433
416
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
434
|
-
statement:
|
|
417
|
+
statement: (...args: any[]) => string;
|
|
435
418
|
expression: string;
|
|
436
|
-
dependencies:
|
|
437
|
-
stepType:
|
|
419
|
+
dependencies: FullDependencies;
|
|
420
|
+
stepType: StepType;
|
|
438
421
|
stepFunction: (input: {
|
|
439
422
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
440
423
|
given: never;
|
|
441
424
|
when: never;
|
|
442
425
|
then: never;
|
|
443
426
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
444
|
-
register: () => {
|
|
445
|
-
stepType: "then";
|
|
446
|
-
expression: string;
|
|
447
|
-
dependencies: EmptyDependencies;
|
|
448
|
-
statement: Statement extends string ? () => string : Statement;
|
|
449
|
-
stepFunction: (input: {
|
|
450
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
451
|
-
given: never;
|
|
452
|
-
when: never;
|
|
453
|
-
then: never;
|
|
454
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
455
|
-
};
|
|
456
427
|
};
|
|
457
428
|
};
|
|
458
429
|
step: (stepFunction: (input: {
|
|
@@ -461,113 +432,48 @@ declare const thenBuilder: <GivenState, WhenState, ThenState>() => {
|
|
|
461
432
|
when: never;
|
|
462
433
|
then: never;
|
|
463
434
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
464
|
-
statement:
|
|
435
|
+
statement: (...args: any[]) => string;
|
|
465
436
|
expression: string;
|
|
466
|
-
dependencies:
|
|
467
|
-
stepType:
|
|
437
|
+
dependencies: FullDependencies;
|
|
438
|
+
stepType: StepType;
|
|
468
439
|
stepFunction: (input: {
|
|
469
440
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
470
441
|
given: never;
|
|
471
442
|
when: never;
|
|
472
443
|
then: never;
|
|
473
444
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
474
|
-
register: () => {
|
|
475
|
-
stepType: "then";
|
|
476
|
-
expression: string;
|
|
477
|
-
dependencies: EmptyDependencies;
|
|
478
|
-
statement: Statement extends string ? () => string : Statement;
|
|
479
|
-
stepFunction: (input: {
|
|
480
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
481
|
-
given: never;
|
|
482
|
-
when: never;
|
|
483
|
-
then: never;
|
|
484
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
485
|
-
};
|
|
486
445
|
};
|
|
487
446
|
};
|
|
488
447
|
};
|
|
489
448
|
//#endregion
|
|
490
|
-
//#region src/
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
name: string;
|
|
519
|
-
file: string;
|
|
520
|
-
steps: ParsedStep[];
|
|
521
|
-
}
|
|
522
|
-
interface ParsedStep {
|
|
523
|
-
keyword: "Given" | "When" | "Then" | "And" | "But";
|
|
524
|
-
effectiveKeyword: "Given" | "When" | "Then";
|
|
525
|
-
text: string;
|
|
526
|
-
line: number;
|
|
527
|
-
column: number;
|
|
528
|
-
}
|
|
529
|
-
interface MatchedStep extends ParsedStep {
|
|
530
|
-
definitions: StepDefinitionMeta[];
|
|
531
|
-
}
|
|
532
|
-
interface Diagnostic {
|
|
533
|
-
file: string;
|
|
534
|
-
range: {
|
|
535
|
-
startLine: number;
|
|
536
|
-
startColumn: number;
|
|
537
|
-
endLine: number;
|
|
538
|
-
endColumn: number;
|
|
539
|
-
};
|
|
540
|
-
severity: "error" | "warning" | "info";
|
|
541
|
-
message: string;
|
|
542
|
-
rule: string;
|
|
543
|
-
source: "step-forge";
|
|
544
|
-
}
|
|
545
|
-
interface AnalysisRule {
|
|
546
|
-
name: string;
|
|
547
|
-
check(scenario: ParsedScenario, matchedSteps: MatchedStep[]): Diagnostic[];
|
|
548
|
-
}
|
|
549
|
-
interface AnalyzerConfig {
|
|
550
|
-
stepFiles: string[];
|
|
551
|
-
featureFiles: string[];
|
|
552
|
-
tsConfigPath?: string;
|
|
553
|
-
}
|
|
554
|
-
//#endregion
|
|
555
|
-
//#region src/analyzer/stepExtractor.d.ts
|
|
556
|
-
declare function extractStepDefinitions(filePaths: string[], tsConfigPath?: string): StepDefinitionMeta[];
|
|
557
|
-
//#endregion
|
|
558
|
-
//#region src/analyzer/gherkinParser.d.ts
|
|
559
|
-
declare function parseFeatureFiles(filePaths: string[]): ParsedScenario[];
|
|
560
|
-
declare function parseFeatureContent(content: string, filePath: string): ParsedScenario[];
|
|
561
|
-
//#endregion
|
|
562
|
-
//#region src/analyzer/stepMatcher.d.ts
|
|
563
|
-
declare function matchScenarioSteps(scenario: ParsedScenario, definitions: StepDefinitionMeta[]): MatchedStep[];
|
|
564
|
-
declare function findMatchingDefinitions(text: string, effectiveKeyword: "Given" | "When" | "Then", definitions: StepDefinitionMeta[]): StepDefinitionMeta[];
|
|
565
|
-
//#endregion
|
|
566
|
-
//#region src/analyzer/index.d.ts
|
|
567
|
-
interface AnalyzeOptions {
|
|
568
|
-
rules?: AnalysisRule[];
|
|
569
|
-
}
|
|
570
|
-
declare function analyze(config: AnalyzerConfig, options?: AnalyzeOptions): Promise<Diagnostic[]>;
|
|
449
|
+
//#region src/hooks.d.ts
|
|
450
|
+
/**
|
|
451
|
+
* Run before every scenario, with access to that scenario's fresh world. For
|
|
452
|
+
* side effects only (reset a mock, seed an external system) — return values are
|
|
453
|
+
* ignored; seed test *state* with given steps so the dependency graph stays the
|
|
454
|
+
* single source of truth.
|
|
455
|
+
*/
|
|
456
|
+
declare function beforeScenario<World extends MergeableWorld<any, any, any> = MergeableWorld<any, any, any>>(fn: (context: {
|
|
457
|
+
world: World;
|
|
458
|
+
scenario: ScenarioInfo;
|
|
459
|
+
}) => void | Promise<void>): void;
|
|
460
|
+
/**
|
|
461
|
+
* Run after every scenario (even when a step failed), with access to that
|
|
462
|
+
* scenario's world. Runs in reverse registration order so teardown unwinds
|
|
463
|
+
* setup. For cleanup side effects only.
|
|
464
|
+
*/
|
|
465
|
+
declare function afterScenario<World extends MergeableWorld<any, any, any> = MergeableWorld<any, any, any>>(fn: (context: {
|
|
466
|
+
world: World;
|
|
467
|
+
scenario: ScenarioInfo;
|
|
468
|
+
}) => void | Promise<void>): void;
|
|
469
|
+
/** Run once at the start of each feature file. No world exists at this boundary. */
|
|
470
|
+
declare function beforeFeature(fn: PlainHookFn): void;
|
|
471
|
+
/** Run once at the end of each feature file (reverse registration order). */
|
|
472
|
+
declare function afterFeature(fn: PlainHookFn): void;
|
|
473
|
+
/** Run once before the entire test run, across all feature files. */
|
|
474
|
+
declare function beforeAll(fn: PlainHookFn): void;
|
|
475
|
+
/** Run once after the entire test run (reverse registration order). */
|
|
476
|
+
declare function afterAll(fn: PlainHookFn): void;
|
|
571
477
|
//#endregion
|
|
572
478
|
//#region src/typeHelpers.d.ts
|
|
573
479
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
@@ -595,5 +501,5 @@ declare const analyzer: {
|
|
|
595
501
|
defaultRules: AnalysisRule[];
|
|
596
502
|
};
|
|
597
503
|
//#endregion
|
|
598
|
-
export { type AnalysisRule, type AnalyzeOptions, type AnalyzerConfig, BasicWorld, type Diagnostic, type MatchedStep, type ParsedScenario, type ParsedStep, type Parser, type StateFromDependencies, type StepDefinitionMeta, analyzer, booleanParser, givenBuilder, intParser, numberParser, stringParser, thenBuilder, whenBuilder };
|
|
504
|
+
export { type AnalysisRule, type AnalyzeOptions, type AnalyzerConfig, BasicWorld, type Diagnostic, type MatchedStep, type ParsedScenario, type ParsedStep, type Parser, type PlainHookFn, type ScenarioHookFn, type ScenarioInfo, type StateFromDependencies, type StepDefinitionMeta, afterAll, afterFeature, afterScenario, analyzer, beforeAll, beforeFeature, beforeScenario, booleanParser, createBuilders, givenBuilder, intParser, numberParser, stringParser, thenBuilder, whenBuilder };
|
|
599
505
|
//# sourceMappingURL=step-forge.d.ts.map
|