@step-forge/step-forge 0.0.19 → 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 +193 -134
- package/dist/step-forge.cjs.map +1 -1
- package/dist/step-forge.d.cts +187 -727
- package/dist/step-forge.d.ts +187 -727
- package/dist/step-forge.js +188 -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,233 +1,96 @@
|
|
|
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) => {
|
|
39
33
|
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>>(dependencies: {
|
|
40
34
|
given: GivenDeps;
|
|
41
35
|
}) => {
|
|
42
|
-
step: (stepFunction: (input: {
|
|
43
|
-
|
|
44
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
45
|
-
when: never;
|
|
46
|
-
then: never;
|
|
47
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
48
|
-
statement: Statement extends string ? () => string : Statement;
|
|
36
|
+
step: (stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>>) => GivenOutput<GivenState>) => {
|
|
37
|
+
statement: (...args: any[]) => string;
|
|
49
38
|
expression: string;
|
|
50
|
-
dependencies:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
when: EmptyObject;
|
|
54
|
-
then: EmptyObject;
|
|
55
|
-
};
|
|
56
|
-
stepType: "given";
|
|
57
|
-
stepFunction: (input: {
|
|
58
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
59
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
60
|
-
when: never;
|
|
61
|
-
then: never;
|
|
62
|
-
}) => 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
|
-
};
|
|
39
|
+
dependencies: FullDependencies;
|
|
40
|
+
stepType: StepType;
|
|
41
|
+
stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>>) => GivenOutput<GivenState>;
|
|
80
42
|
};
|
|
81
43
|
};
|
|
82
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) => {
|
|
83
45
|
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>>(dependencies: {
|
|
84
46
|
given: GivenDeps;
|
|
85
47
|
}) => {
|
|
86
|
-
step: (stepFunction: (input: {
|
|
87
|
-
|
|
88
|
-
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] };
|
|
89
|
-
when: never;
|
|
90
|
-
then: never;
|
|
91
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
92
|
-
statement: Statement extends string ? () => string : Statement;
|
|
48
|
+
step: (stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>>) => GivenOutput<GivenState>) => {
|
|
49
|
+
statement: (...args: any[]) => string;
|
|
93
50
|
expression: string;
|
|
94
|
-
dependencies:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
when: EmptyObject;
|
|
98
|
-
then: EmptyObject;
|
|
99
|
-
};
|
|
100
|
-
stepType: "given";
|
|
101
|
-
stepFunction: (input: {
|
|
102
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
103
|
-
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] };
|
|
104
|
-
when: never;
|
|
105
|
-
then: never;
|
|
106
|
-
}) => 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
|
-
};
|
|
51
|
+
dependencies: FullDependencies;
|
|
52
|
+
stepType: StepType;
|
|
53
|
+
stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>>) => GivenOutput<GivenState>;
|
|
124
54
|
};
|
|
125
55
|
};
|
|
126
|
-
step: (stepFunction: (input: {
|
|
127
|
-
|
|
128
|
-
given: never;
|
|
129
|
-
when: never;
|
|
130
|
-
then: never;
|
|
131
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
132
|
-
statement: Statement extends string ? () => string : Statement;
|
|
56
|
+
step: (stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never>) => GivenOutput<GivenState>) => {
|
|
57
|
+
statement: (...args: any[]) => string;
|
|
133
58
|
expression: string;
|
|
134
|
-
dependencies:
|
|
135
|
-
stepType:
|
|
136
|
-
stepFunction: (input:
|
|
137
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
138
|
-
given: never;
|
|
139
|
-
when: never;
|
|
140
|
-
then: never;
|
|
141
|
-
}) => 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
|
-
};
|
|
59
|
+
dependencies: FullDependencies;
|
|
60
|
+
stepType: StepType;
|
|
61
|
+
stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never>) => GivenOutput<GivenState>;
|
|
154
62
|
};
|
|
155
63
|
};
|
|
156
|
-
step: (stepFunction: (input: {
|
|
157
|
-
|
|
158
|
-
given: never;
|
|
159
|
-
when: never;
|
|
160
|
-
then: never;
|
|
161
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
162
|
-
statement: Statement extends string ? () => string : Statement;
|
|
64
|
+
step: (stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never>) => GivenOutput<GivenState>) => {
|
|
65
|
+
statement: (...args: any[]) => string;
|
|
163
66
|
expression: string;
|
|
164
|
-
dependencies:
|
|
165
|
-
stepType:
|
|
166
|
-
stepFunction: (input:
|
|
167
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
168
|
-
given: never;
|
|
169
|
-
when: never;
|
|
170
|
-
then: never;
|
|
171
|
-
}) => 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
|
-
};
|
|
67
|
+
dependencies: FullDependencies;
|
|
68
|
+
stepType: StepType;
|
|
69
|
+
stepFunction: (input: GivenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never>) => GivenOutput<GivenState>;
|
|
184
70
|
};
|
|
185
71
|
};
|
|
186
72
|
};
|
|
187
73
|
//#endregion
|
|
188
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>>;
|
|
189
82
|
declare const whenBuilder: <GivenState, WhenState>() => {
|
|
190
83
|
statement: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
191
84
|
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps extends RequiredOrOptional<WhenState>>(dependencies: {
|
|
192
85
|
given?: GivenDeps | undefined;
|
|
193
86
|
when?: WhenDeps | undefined;
|
|
194
87
|
}) => {
|
|
195
|
-
step: (stepFunction: (input: {
|
|
196
|
-
|
|
197
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
198
|
-
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] };
|
|
199
|
-
then: never;
|
|
200
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
201
|
-
statement: Statement extends string ? () => string : Statement;
|
|
88
|
+
step: (stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>>) => WhenOutput<WhenState>) => {
|
|
89
|
+
statement: (...args: any[]) => string;
|
|
202
90
|
expression: string;
|
|
203
|
-
dependencies:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
then: EmptyObject;
|
|
207
|
-
};
|
|
208
|
-
stepType: "when";
|
|
209
|
-
stepFunction: (input: {
|
|
210
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
211
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
212
|
-
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] };
|
|
213
|
-
then: never;
|
|
214
|
-
}) => 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
|
-
};
|
|
91
|
+
dependencies: FullDependencies;
|
|
92
|
+
stepType: StepType;
|
|
93
|
+
stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>>) => WhenOutput<WhenState>;
|
|
231
94
|
};
|
|
232
95
|
};
|
|
233
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) => {
|
|
@@ -235,107 +98,40 @@ declare const whenBuilder: <GivenState, WhenState>() => {
|
|
|
235
98
|
given?: GivenDeps | undefined;
|
|
236
99
|
when?: WhenDeps | undefined;
|
|
237
100
|
}) => {
|
|
238
|
-
step: (stepFunction: (input: {
|
|
239
|
-
|
|
240
|
-
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] };
|
|
241
|
-
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] };
|
|
242
|
-
then: never;
|
|
243
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
244
|
-
statement: Statement extends string ? () => string : Statement;
|
|
101
|
+
step: (stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>>) => WhenOutput<WhenState>) => {
|
|
102
|
+
statement: (...args: any[]) => string;
|
|
245
103
|
expression: string;
|
|
246
|
-
dependencies:
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
then: EmptyObject;
|
|
250
|
-
};
|
|
251
|
-
stepType: "when";
|
|
252
|
-
stepFunction: (input: {
|
|
253
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
254
|
-
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] };
|
|
255
|
-
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] };
|
|
256
|
-
then: never;
|
|
257
|
-
}) => 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
|
-
};
|
|
104
|
+
dependencies: FullDependencies;
|
|
105
|
+
stepType: StepType;
|
|
106
|
+
stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, Restrict<GivenState, GivenDeps>, Restrict<WhenState, WhenDeps>>) => WhenOutput<WhenState>;
|
|
274
107
|
};
|
|
275
108
|
};
|
|
276
|
-
step: (stepFunction: (input: {
|
|
277
|
-
|
|
278
|
-
given: never;
|
|
279
|
-
when: never;
|
|
280
|
-
then: never;
|
|
281
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
282
|
-
statement: Statement extends string ? () => string : Statement;
|
|
109
|
+
step: (stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never>) => WhenOutput<WhenState>) => {
|
|
110
|
+
statement: (...args: any[]) => string;
|
|
283
111
|
expression: string;
|
|
284
|
-
dependencies:
|
|
285
|
-
stepType:
|
|
286
|
-
stepFunction: (input:
|
|
287
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
288
|
-
given: never;
|
|
289
|
-
when: never;
|
|
290
|
-
then: never;
|
|
291
|
-
}) => 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
|
-
};
|
|
112
|
+
dependencies: FullDependencies;
|
|
113
|
+
stepType: StepType;
|
|
114
|
+
stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never>) => WhenOutput<WhenState>;
|
|
304
115
|
};
|
|
305
116
|
};
|
|
306
|
-
step: (stepFunction: (input: {
|
|
307
|
-
|
|
308
|
-
given: never;
|
|
309
|
-
when: never;
|
|
310
|
-
then: never;
|
|
311
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
312
|
-
statement: Statement extends string ? () => string : Statement;
|
|
117
|
+
step: (stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never>) => WhenOutput<WhenState>) => {
|
|
118
|
+
statement: (...args: any[]) => string;
|
|
313
119
|
expression: string;
|
|
314
|
-
dependencies:
|
|
315
|
-
stepType:
|
|
316
|
-
stepFunction: (input:
|
|
317
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
318
|
-
given: never;
|
|
319
|
-
when: never;
|
|
320
|
-
then: never;
|
|
321
|
-
}) => 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
|
-
};
|
|
120
|
+
dependencies: FullDependencies;
|
|
121
|
+
stepType: StepType;
|
|
122
|
+
stepFunction: (input: WhenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never>) => WhenOutput<WhenState>;
|
|
334
123
|
};
|
|
335
124
|
};
|
|
336
125
|
};
|
|
337
126
|
//#endregion
|
|
338
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>;
|
|
339
135
|
declare const thenBuilder: <GivenState, WhenState, ThenState>() => {
|
|
340
136
|
statement: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
341
137
|
dependencies: <GivenDeps extends RequiredOrOptional<GivenState>, WhenDeps extends RequiredOrOptional<WhenState>, ThenDeps extends RequiredOrOptional<ThenState>>(dependencies: {
|
|
@@ -343,42 +139,12 @@ declare const thenBuilder: <GivenState, WhenState, ThenState>() => {
|
|
|
343
139
|
when?: WhenDeps | undefined;
|
|
344
140
|
then?: ThenDeps | undefined;
|
|
345
141
|
}) => {
|
|
346
|
-
step: (stepFunction: (input: {
|
|
347
|
-
|
|
348
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
349
|
-
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] };
|
|
350
|
-
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] };
|
|
351
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
352
|
-
statement: Statement extends string ? () => string : Statement;
|
|
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;
|
|
353
144
|
expression: string;
|
|
354
|
-
dependencies:
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
then: ThenDeps;
|
|
358
|
-
};
|
|
359
|
-
stepType: "then";
|
|
360
|
-
stepFunction: (input: {
|
|
361
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
362
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
363
|
-
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] };
|
|
364
|
-
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] };
|
|
365
|
-
}) => 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
|
-
};
|
|
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>;
|
|
382
148
|
};
|
|
383
149
|
};
|
|
384
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) => {
|
|
@@ -387,171 +153,32 @@ declare const thenBuilder: <GivenState, WhenState, ThenState>() => {
|
|
|
387
153
|
when?: WhenDeps | undefined;
|
|
388
154
|
then?: ThenDeps | undefined;
|
|
389
155
|
}) => {
|
|
390
|
-
step: (stepFunction: (input: {
|
|
391
|
-
|
|
392
|
-
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] };
|
|
393
|
-
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] };
|
|
394
|
-
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] };
|
|
395
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
396
|
-
statement: Statement extends string ? () => string : Statement;
|
|
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;
|
|
397
158
|
expression: string;
|
|
398
|
-
dependencies:
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
then: ThenDeps;
|
|
402
|
-
};
|
|
403
|
-
stepType: "then";
|
|
404
|
-
stepFunction: (input: {
|
|
405
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
406
|
-
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] };
|
|
407
|
-
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] };
|
|
408
|
-
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] };
|
|
409
|
-
}) => 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
|
-
};
|
|
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>;
|
|
426
162
|
};
|
|
427
163
|
};
|
|
428
|
-
step: (stepFunction: (input: {
|
|
429
|
-
|
|
430
|
-
given: never;
|
|
431
|
-
when: never;
|
|
432
|
-
then: never;
|
|
433
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
434
|
-
statement: Statement extends string ? () => string : Statement;
|
|
164
|
+
step: (stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never, never>) => ThenOutput<ThenState>) => {
|
|
165
|
+
statement: (...args: any[]) => string;
|
|
435
166
|
expression: string;
|
|
436
|
-
dependencies:
|
|
437
|
-
stepType:
|
|
438
|
-
stepFunction: (input:
|
|
439
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
440
|
-
given: never;
|
|
441
|
-
when: never;
|
|
442
|
-
then: never;
|
|
443
|
-
}) => 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
|
-
};
|
|
167
|
+
dependencies: FullDependencies;
|
|
168
|
+
stepType: StepType;
|
|
169
|
+
stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never, never>) => ThenOutput<ThenState>;
|
|
456
170
|
};
|
|
457
171
|
};
|
|
458
|
-
step: (stepFunction: (input: {
|
|
459
|
-
|
|
460
|
-
given: never;
|
|
461
|
-
when: never;
|
|
462
|
-
then: never;
|
|
463
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
464
|
-
statement: Statement extends string ? () => string : Statement;
|
|
172
|
+
step: (stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never, never>) => ThenOutput<ThenState>) => {
|
|
173
|
+
statement: (...args: any[]) => string;
|
|
465
174
|
expression: string;
|
|
466
|
-
dependencies:
|
|
467
|
-
stepType:
|
|
468
|
-
stepFunction: (input:
|
|
469
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
470
|
-
given: never;
|
|
471
|
-
when: never;
|
|
472
|
-
then: never;
|
|
473
|
-
}) => 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
|
-
};
|
|
175
|
+
dependencies: FullDependencies;
|
|
176
|
+
stepType: StepType;
|
|
177
|
+
stepFunction: (input: ThenInput<Statement extends string ? [] : GetFunctionArgs<Statement>, never, never, never>) => ThenOutput<ThenState>;
|
|
486
178
|
};
|
|
487
179
|
};
|
|
488
180
|
};
|
|
489
181
|
//#endregion
|
|
490
|
-
//#region src/world.d.ts
|
|
491
|
-
type WorldState<State> = { readonly [K in keyof State]?: State[K] };
|
|
492
|
-
type MergeableWorldState<T> = WorldState<T> & {
|
|
493
|
-
merge: (newState: Partial<T>) => void;
|
|
494
|
-
};
|
|
495
|
-
declare class BasicWorld<Given, When, Then> {
|
|
496
|
-
private givenState;
|
|
497
|
-
private whenState;
|
|
498
|
-
private thenState;
|
|
499
|
-
get given(): MergeableWorldState<Given>;
|
|
500
|
-
get when(): MergeableWorldState<When>;
|
|
501
|
-
get then(): MergeableWorldState<Then>;
|
|
502
|
-
}
|
|
503
|
-
//#endregion
|
|
504
|
-
//#region src/analyzer/types.d.ts
|
|
505
|
-
interface StepDefinitionMeta {
|
|
506
|
-
stepType: "given" | "when" | "then";
|
|
507
|
-
expression: string;
|
|
508
|
-
dependencies: {
|
|
509
|
-
given: Record<string, "required" | "optional">;
|
|
510
|
-
when: Record<string, "required" | "optional">;
|
|
511
|
-
then: Record<string, "required" | "optional">;
|
|
512
|
-
};
|
|
513
|
-
produces: string[];
|
|
514
|
-
sourceFile: string;
|
|
515
|
-
line: number;
|
|
516
|
-
}
|
|
517
|
-
interface ParsedScenario {
|
|
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
182
|
//#region src/analyzer/stepExtractor.d.ts
|
|
556
183
|
declare function extractStepDefinitions(filePaths: string[], tsConfigPath?: string): StepDefinitionMeta[];
|
|
557
184
|
//#endregion
|
|
@@ -577,42 +204,20 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
577
204
|
}) => {
|
|
578
205
|
step: (stepFunction: (input: {
|
|
579
206
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
580
|
-
given:
|
|
207
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
581
208
|
when: never;
|
|
582
209
|
then: never;
|
|
583
210
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
584
|
-
statement:
|
|
211
|
+
statement: (...args: any[]) => string;
|
|
585
212
|
expression: string;
|
|
586
|
-
dependencies:
|
|
587
|
-
|
|
588
|
-
} & {
|
|
589
|
-
when: EmptyObject;
|
|
590
|
-
then: EmptyObject;
|
|
591
|
-
};
|
|
592
|
-
stepType: "given";
|
|
213
|
+
dependencies: FullDependencies;
|
|
214
|
+
stepType: StepType;
|
|
593
215
|
stepFunction: (input: {
|
|
594
216
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
595
|
-
given:
|
|
217
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
596
218
|
when: never;
|
|
597
219
|
then: never;
|
|
598
220
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
599
|
-
register: () => {
|
|
600
|
-
stepType: "given";
|
|
601
|
-
expression: string;
|
|
602
|
-
dependencies: {
|
|
603
|
-
given: GivenDeps;
|
|
604
|
-
} & {
|
|
605
|
-
when: EmptyObject;
|
|
606
|
-
then: EmptyObject;
|
|
607
|
-
};
|
|
608
|
-
statement: Statement extends string ? () => string : Statement;
|
|
609
|
-
stepFunction: (input: {
|
|
610
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
611
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
612
|
-
when: never;
|
|
613
|
-
then: never;
|
|
614
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
615
|
-
};
|
|
616
221
|
};
|
|
617
222
|
};
|
|
618
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) => {
|
|
@@ -621,42 +226,20 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
621
226
|
}) => {
|
|
622
227
|
step: (stepFunction: (input: {
|
|
623
228
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
624
|
-
given:
|
|
229
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
625
230
|
when: never;
|
|
626
231
|
then: never;
|
|
627
232
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
628
|
-
statement:
|
|
233
|
+
statement: (...args: any[]) => string;
|
|
629
234
|
expression: string;
|
|
630
|
-
dependencies:
|
|
631
|
-
|
|
632
|
-
} & {
|
|
633
|
-
when: EmptyObject;
|
|
634
|
-
then: EmptyObject;
|
|
635
|
-
};
|
|
636
|
-
stepType: "given";
|
|
235
|
+
dependencies: FullDependencies;
|
|
236
|
+
stepType: StepType;
|
|
637
237
|
stepFunction: (input: {
|
|
638
238
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
639
|
-
given:
|
|
239
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
640
240
|
when: never;
|
|
641
241
|
then: never;
|
|
642
242
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
643
|
-
register: () => {
|
|
644
|
-
stepType: "given";
|
|
645
|
-
expression: string;
|
|
646
|
-
dependencies: {
|
|
647
|
-
given: GivenDeps;
|
|
648
|
-
} & {
|
|
649
|
-
when: EmptyObject;
|
|
650
|
-
then: EmptyObject;
|
|
651
|
-
};
|
|
652
|
-
statement: Statement extends string ? () => string : Statement;
|
|
653
|
-
stepFunction: (input: {
|
|
654
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
655
|
-
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] };
|
|
656
|
-
when: never;
|
|
657
|
-
then: never;
|
|
658
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
659
|
-
};
|
|
660
243
|
};
|
|
661
244
|
};
|
|
662
245
|
step: (stepFunction: (input: {
|
|
@@ -665,28 +248,16 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
665
248
|
when: never;
|
|
666
249
|
then: never;
|
|
667
250
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
668
|
-
statement:
|
|
251
|
+
statement: (...args: any[]) => string;
|
|
669
252
|
expression: string;
|
|
670
|
-
dependencies:
|
|
671
|
-
stepType:
|
|
253
|
+
dependencies: FullDependencies;
|
|
254
|
+
stepType: StepType;
|
|
672
255
|
stepFunction: (input: {
|
|
673
256
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
674
257
|
given: never;
|
|
675
258
|
when: never;
|
|
676
259
|
then: never;
|
|
677
260
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
678
|
-
register: () => {
|
|
679
|
-
stepType: "given";
|
|
680
|
-
expression: string;
|
|
681
|
-
dependencies: EmptyDependencies;
|
|
682
|
-
statement: Statement extends string ? () => string : Statement;
|
|
683
|
-
stepFunction: (input: {
|
|
684
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
685
|
-
given: never;
|
|
686
|
-
when: never;
|
|
687
|
-
then: never;
|
|
688
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
689
|
-
};
|
|
690
261
|
};
|
|
691
262
|
};
|
|
692
263
|
step: (stepFunction: (input: {
|
|
@@ -695,28 +266,16 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
695
266
|
when: never;
|
|
696
267
|
then: never;
|
|
697
268
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>) => {
|
|
698
|
-
statement:
|
|
269
|
+
statement: (...args: any[]) => string;
|
|
699
270
|
expression: string;
|
|
700
|
-
dependencies:
|
|
701
|
-
stepType:
|
|
271
|
+
dependencies: FullDependencies;
|
|
272
|
+
stepType: StepType;
|
|
702
273
|
stepFunction: (input: {
|
|
703
274
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
704
275
|
given: never;
|
|
705
276
|
when: never;
|
|
706
277
|
then: never;
|
|
707
278
|
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
708
|
-
register: () => {
|
|
709
|
-
stepType: "given";
|
|
710
|
-
expression: string;
|
|
711
|
-
dependencies: EmptyDependencies;
|
|
712
|
-
statement: Statement extends string ? () => string : Statement;
|
|
713
|
-
stepFunction: (input: {
|
|
714
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
715
|
-
given: never;
|
|
716
|
-
when: never;
|
|
717
|
-
then: never;
|
|
718
|
-
}) => Partial<GivenState> | Promise<Partial<GivenState>>;
|
|
719
|
-
};
|
|
720
279
|
};
|
|
721
280
|
};
|
|
722
281
|
When: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
@@ -726,40 +285,20 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
726
285
|
}) => {
|
|
727
286
|
step: (stepFunction: (input: {
|
|
728
287
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
729
|
-
given:
|
|
730
|
-
when:
|
|
288
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
289
|
+
when: Restrict<WhenState, WhenDeps>;
|
|
731
290
|
then: never;
|
|
732
291
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
733
|
-
statement:
|
|
292
|
+
statement: (...args: any[]) => string;
|
|
734
293
|
expression: string;
|
|
735
|
-
dependencies:
|
|
736
|
-
|
|
737
|
-
when: WhenDeps;
|
|
738
|
-
then: EmptyObject;
|
|
739
|
-
};
|
|
740
|
-
stepType: "when";
|
|
294
|
+
dependencies: FullDependencies;
|
|
295
|
+
stepType: StepType;
|
|
741
296
|
stepFunction: (input: {
|
|
742
297
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
743
|
-
given:
|
|
744
|
-
when:
|
|
298
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
299
|
+
when: Restrict<WhenState, WhenDeps>;
|
|
745
300
|
then: never;
|
|
746
301
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
747
|
-
register: () => {
|
|
748
|
-
stepType: "when";
|
|
749
|
-
expression: string;
|
|
750
|
-
dependencies: {
|
|
751
|
-
given: GivenDeps;
|
|
752
|
-
when: WhenDeps;
|
|
753
|
-
then: EmptyObject;
|
|
754
|
-
};
|
|
755
|
-
statement: Statement extends string ? () => string : Statement;
|
|
756
|
-
stepFunction: (input: {
|
|
757
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
758
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
759
|
-
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] };
|
|
760
|
-
then: never;
|
|
761
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
762
|
-
};
|
|
763
302
|
};
|
|
764
303
|
};
|
|
765
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) => {
|
|
@@ -769,40 +308,20 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
769
308
|
}) => {
|
|
770
309
|
step: (stepFunction: (input: {
|
|
771
310
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
772
|
-
given:
|
|
773
|
-
when:
|
|
311
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
312
|
+
when: Restrict<WhenState, WhenDeps>;
|
|
774
313
|
then: never;
|
|
775
314
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
776
|
-
statement:
|
|
315
|
+
statement: (...args: any[]) => string;
|
|
777
316
|
expression: string;
|
|
778
|
-
dependencies:
|
|
779
|
-
|
|
780
|
-
when: WhenDeps;
|
|
781
|
-
then: EmptyObject;
|
|
782
|
-
};
|
|
783
|
-
stepType: "when";
|
|
317
|
+
dependencies: FullDependencies;
|
|
318
|
+
stepType: StepType;
|
|
784
319
|
stepFunction: (input: {
|
|
785
320
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
786
|
-
given:
|
|
787
|
-
when:
|
|
321
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
322
|
+
when: Restrict<WhenState, WhenDeps>;
|
|
788
323
|
then: never;
|
|
789
324
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
790
|
-
register: () => {
|
|
791
|
-
stepType: "when";
|
|
792
|
-
expression: string;
|
|
793
|
-
dependencies: {
|
|
794
|
-
given: GivenDeps;
|
|
795
|
-
when: WhenDeps;
|
|
796
|
-
then: EmptyObject;
|
|
797
|
-
};
|
|
798
|
-
statement: Statement extends string ? () => string : Statement;
|
|
799
|
-
stepFunction: (input: {
|
|
800
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
801
|
-
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] };
|
|
802
|
-
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] };
|
|
803
|
-
then: never;
|
|
804
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
805
|
-
};
|
|
806
325
|
};
|
|
807
326
|
};
|
|
808
327
|
step: (stepFunction: (input: {
|
|
@@ -811,28 +330,16 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
811
330
|
when: never;
|
|
812
331
|
then: never;
|
|
813
332
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
814
|
-
statement:
|
|
333
|
+
statement: (...args: any[]) => string;
|
|
815
334
|
expression: string;
|
|
816
|
-
dependencies:
|
|
817
|
-
stepType:
|
|
335
|
+
dependencies: FullDependencies;
|
|
336
|
+
stepType: StepType;
|
|
818
337
|
stepFunction: (input: {
|
|
819
338
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
820
339
|
given: never;
|
|
821
340
|
when: never;
|
|
822
341
|
then: never;
|
|
823
342
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
824
|
-
register: () => {
|
|
825
|
-
stepType: "when";
|
|
826
|
-
expression: string;
|
|
827
|
-
dependencies: EmptyDependencies;
|
|
828
|
-
statement: Statement extends string ? () => string : Statement;
|
|
829
|
-
stepFunction: (input: {
|
|
830
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
831
|
-
given: never;
|
|
832
|
-
when: never;
|
|
833
|
-
then: never;
|
|
834
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
835
|
-
};
|
|
836
343
|
};
|
|
837
344
|
};
|
|
838
345
|
step: (stepFunction: (input: {
|
|
@@ -841,28 +348,16 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
841
348
|
when: never;
|
|
842
349
|
then: never;
|
|
843
350
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>) => {
|
|
844
|
-
statement:
|
|
351
|
+
statement: (...args: any[]) => string;
|
|
845
352
|
expression: string;
|
|
846
|
-
dependencies:
|
|
847
|
-
stepType:
|
|
353
|
+
dependencies: FullDependencies;
|
|
354
|
+
stepType: StepType;
|
|
848
355
|
stepFunction: (input: {
|
|
849
356
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
850
357
|
given: never;
|
|
851
358
|
when: never;
|
|
852
359
|
then: never;
|
|
853
360
|
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
854
|
-
register: () => {
|
|
855
|
-
stepType: "when";
|
|
856
|
-
expression: string;
|
|
857
|
-
dependencies: EmptyDependencies;
|
|
858
|
-
statement: Statement extends string ? () => string : Statement;
|
|
859
|
-
stepFunction: (input: {
|
|
860
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
861
|
-
given: never;
|
|
862
|
-
when: never;
|
|
863
|
-
then: never;
|
|
864
|
-
}) => Partial<WhenState> | Promise<Partial<WhenState>>;
|
|
865
|
-
};
|
|
866
361
|
};
|
|
867
362
|
};
|
|
868
363
|
Then: <Statement extends ((...args: [...any]) => string) | string>(statement: Statement) => {
|
|
@@ -873,40 +368,20 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
873
368
|
}) => {
|
|
874
369
|
step: (stepFunction: (input: {
|
|
875
370
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
876
|
-
given:
|
|
877
|
-
when:
|
|
878
|
-
then:
|
|
371
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
372
|
+
when: Restrict<WhenState, WhenDeps_1>;
|
|
373
|
+
then: Restrict<ThenState, ThenDeps>;
|
|
879
374
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
880
|
-
statement:
|
|
375
|
+
statement: (...args: any[]) => string;
|
|
881
376
|
expression: string;
|
|
882
|
-
dependencies:
|
|
883
|
-
|
|
884
|
-
when: WhenDeps_1;
|
|
885
|
-
then: ThenDeps;
|
|
886
|
-
};
|
|
887
|
-
stepType: "then";
|
|
377
|
+
dependencies: FullDependencies;
|
|
378
|
+
stepType: StepType;
|
|
888
379
|
stepFunction: (input: {
|
|
889
380
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
890
|
-
given:
|
|
891
|
-
when:
|
|
892
|
-
then:
|
|
381
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
382
|
+
when: Restrict<WhenState, WhenDeps_1>;
|
|
383
|
+
then: Restrict<ThenState, ThenDeps>;
|
|
893
384
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
894
|
-
register: () => {
|
|
895
|
-
stepType: "then";
|
|
896
|
-
expression: string;
|
|
897
|
-
dependencies: {
|
|
898
|
-
given: GivenDeps;
|
|
899
|
-
when: WhenDeps_1;
|
|
900
|
-
then: ThenDeps;
|
|
901
|
-
};
|
|
902
|
-
statement: Statement extends string ? () => string : Statement;
|
|
903
|
-
stepFunction: (input: {
|
|
904
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
905
|
-
given: { [K in keyof GivenState as K extends keyof GivenDeps ? K : never]: GivenDeps[K] extends "optional" ? GivenState[K] | undefined : GivenState[K] };
|
|
906
|
-
when: { [K_1 in keyof WhenState as K_1 extends keyof WhenDeps_1 ? K_1 : never]: WhenDeps_1[K_1] extends "optional" ? WhenState[K_1] | undefined : WhenState[K_1] };
|
|
907
|
-
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] };
|
|
908
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
909
|
-
};
|
|
910
385
|
};
|
|
911
386
|
};
|
|
912
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) => {
|
|
@@ -917,40 +392,20 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
917
392
|
}) => {
|
|
918
393
|
step: (stepFunction: (input: {
|
|
919
394
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
920
|
-
given:
|
|
921
|
-
when:
|
|
922
|
-
then:
|
|
395
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
396
|
+
when: Restrict<WhenState, WhenDeps_1>;
|
|
397
|
+
then: Restrict<ThenState, ThenDeps>;
|
|
923
398
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
924
|
-
statement:
|
|
399
|
+
statement: (...args: any[]) => string;
|
|
925
400
|
expression: string;
|
|
926
|
-
dependencies:
|
|
927
|
-
|
|
928
|
-
when: WhenDeps_1;
|
|
929
|
-
then: ThenDeps;
|
|
930
|
-
};
|
|
931
|
-
stepType: "then";
|
|
401
|
+
dependencies: FullDependencies;
|
|
402
|
+
stepType: StepType;
|
|
932
403
|
stepFunction: (input: {
|
|
933
404
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
934
|
-
given:
|
|
935
|
-
when:
|
|
936
|
-
then:
|
|
405
|
+
given: Restrict<GivenState, GivenDeps>;
|
|
406
|
+
when: Restrict<WhenState, WhenDeps_1>;
|
|
407
|
+
then: Restrict<ThenState, ThenDeps>;
|
|
937
408
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
938
|
-
register: () => {
|
|
939
|
-
stepType: "then";
|
|
940
|
-
expression: string;
|
|
941
|
-
dependencies: {
|
|
942
|
-
given: GivenDeps;
|
|
943
|
-
when: WhenDeps_1;
|
|
944
|
-
then: ThenDeps;
|
|
945
|
-
};
|
|
946
|
-
statement: Statement extends string ? () => string : Statement;
|
|
947
|
-
stepFunction: (input: {
|
|
948
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
949
|
-
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] };
|
|
950
|
-
when: { [K_2 in keyof WhenState as K_2 extends keyof WhenDeps_1 ? K_2 : never]: WhenDeps_1[K_2] extends "optional" ? WhenState[K_2] | undefined : WhenState[K_2] };
|
|
951
|
-
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] };
|
|
952
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
953
|
-
};
|
|
954
409
|
};
|
|
955
410
|
};
|
|
956
411
|
step: (stepFunction: (input: {
|
|
@@ -959,28 +414,16 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
959
414
|
when: never;
|
|
960
415
|
then: never;
|
|
961
416
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
962
|
-
statement:
|
|
417
|
+
statement: (...args: any[]) => string;
|
|
963
418
|
expression: string;
|
|
964
|
-
dependencies:
|
|
965
|
-
stepType:
|
|
419
|
+
dependencies: FullDependencies;
|
|
420
|
+
stepType: StepType;
|
|
966
421
|
stepFunction: (input: {
|
|
967
422
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
968
423
|
given: never;
|
|
969
424
|
when: never;
|
|
970
425
|
then: never;
|
|
971
426
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
972
|
-
register: () => {
|
|
973
|
-
stepType: "then";
|
|
974
|
-
expression: string;
|
|
975
|
-
dependencies: EmptyDependencies;
|
|
976
|
-
statement: Statement extends string ? () => string : Statement;
|
|
977
|
-
stepFunction: (input: {
|
|
978
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
979
|
-
given: never;
|
|
980
|
-
when: never;
|
|
981
|
-
then: never;
|
|
982
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
983
|
-
};
|
|
984
427
|
};
|
|
985
428
|
};
|
|
986
429
|
step: (stepFunction: (input: {
|
|
@@ -989,32 +432,49 @@ declare const createBuilders: <GivenState, WhenState, ThenState>() => {
|
|
|
989
432
|
when: never;
|
|
990
433
|
then: never;
|
|
991
434
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>) => {
|
|
992
|
-
statement:
|
|
435
|
+
statement: (...args: any[]) => string;
|
|
993
436
|
expression: string;
|
|
994
|
-
dependencies:
|
|
995
|
-
stepType:
|
|
437
|
+
dependencies: FullDependencies;
|
|
438
|
+
stepType: StepType;
|
|
996
439
|
stepFunction: (input: {
|
|
997
440
|
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
998
441
|
given: never;
|
|
999
442
|
when: never;
|
|
1000
443
|
then: never;
|
|
1001
444
|
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
1002
|
-
register: () => {
|
|
1003
|
-
stepType: "then";
|
|
1004
|
-
expression: string;
|
|
1005
|
-
dependencies: EmptyDependencies;
|
|
1006
|
-
statement: Statement extends string ? () => string : Statement;
|
|
1007
|
-
stepFunction: (input: {
|
|
1008
|
-
variables: Statement extends string ? [] : GetFunctionArgs<Statement>;
|
|
1009
|
-
given: never;
|
|
1010
|
-
when: never;
|
|
1011
|
-
then: never;
|
|
1012
|
-
}) => void | Promise<void> | Partial<ThenState> | Promise<Partial<ThenState>>;
|
|
1013
|
-
};
|
|
1014
445
|
};
|
|
1015
446
|
};
|
|
1016
447
|
};
|
|
1017
448
|
//#endregion
|
|
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;
|
|
477
|
+
//#endregion
|
|
1018
478
|
//#region src/typeHelpers.d.ts
|
|
1019
479
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
1020
480
|
/**
|
|
@@ -1041,5 +501,5 @@ declare const analyzer: {
|
|
|
1041
501
|
defaultRules: AnalysisRule[];
|
|
1042
502
|
};
|
|
1043
503
|
//#endregion
|
|
1044
|
-
export { type AnalysisRule, type AnalyzeOptions, type AnalyzerConfig, BasicWorld, type Diagnostic, type MatchedStep, type ParsedScenario, type ParsedStep, type Parser, type StateFromDependencies, type StepDefinitionMeta, analyzer, booleanParser, createBuilders, 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 };
|
|
1045
505
|
//# sourceMappingURL=step-forge.d.ts.map
|