effect-bdd 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +465 -0
- package/dist/Bdd.d.ts +285 -0
- package/dist/Bdd.d.ts.map +1 -0
- package/dist/Bdd.js +304 -0
- package/dist/Bdd.js.map +1 -0
- package/dist/Errors.d.ts +65 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Errors.js +58 -0
- package/dist/Errors.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +7 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +147 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cli/errors.d.ts +30 -0
- package/dist/internal/cli/errors.d.ts.map +1 -0
- package/dist/internal/cli/errors.js +8 -0
- package/dist/internal/cli/errors.js.map +1 -0
- package/dist/internal/cli/glob.d.ts +13 -0
- package/dist/internal/cli/glob.d.ts.map +1 -0
- package/dist/internal/cli/glob.js +29 -0
- package/dist/internal/cli/glob.js.map +1 -0
- package/dist/internal/cli/loaders.d.ts +13 -0
- package/dist/internal/cli/loaders.d.ts.map +1 -0
- package/dist/internal/cli/loaders.js +44 -0
- package/dist/internal/cli/loaders.js.map +1 -0
- package/dist/internal/cli/models.d.ts +102 -0
- package/dist/internal/cli/models.d.ts.map +1 -0
- package/dist/internal/cli/models.js +2 -0
- package/dist/internal/cli/models.js.map +1 -0
- package/dist/internal/cli/moduleLoader.d.ts +14 -0
- package/dist/internal/cli/moduleLoader.d.ts.map +1 -0
- package/dist/internal/cli/moduleLoader.js +39 -0
- package/dist/internal/cli/moduleLoader.js.map +1 -0
- package/dist/internal/cli/reporter.d.ts +22 -0
- package/dist/internal/cli/reporter.d.ts.map +1 -0
- package/dist/internal/cli/reporter.js +227 -0
- package/dist/internal/cli/reporter.js.map +1 -0
- package/dist/internal/cli/runner.d.ts +14 -0
- package/dist/internal/cli/runner.d.ts.map +1 -0
- package/dist/internal/cli/runner.js +178 -0
- package/dist/internal/cli/runner.js.map +1 -0
- package/dist/internal/cli/tagExpression.d.ts +7 -0
- package/dist/internal/cli/tagExpression.d.ts.map +1 -0
- package/dist/internal/cli/tagExpression.js +127 -0
- package/dist/internal/cli/tagExpression.js.map +1 -0
- package/dist/internal/cucumberCompiler.d.ts +5 -0
- package/dist/internal/cucumberCompiler.d.ts.map +1 -0
- package/dist/internal/cucumberCompiler.js +49 -0
- package/dist/internal/cucumberCompiler.js.map +1 -0
- package/dist/internal/expression.d.ts +18 -0
- package/dist/internal/expression.d.ts.map +1 -0
- package/dist/internal/expression.js +59 -0
- package/dist/internal/expression.js.map +1 -0
- package/dist/internal/matching.d.ts +30 -0
- package/dist/internal/matching.d.ts.map +1 -0
- package/dist/internal/matching.js +37 -0
- package/dist/internal/matching.js.map +1 -0
- package/dist/internal/parser.d.ts +54 -0
- package/dist/internal/parser.d.ts.map +1 -0
- package/dist/internal/parser.js +93 -0
- package/dist/internal/parser.js.map +1 -0
- package/dist/internal/runner.d.ts +77 -0
- package/dist/internal/runner.d.ts.map +1 -0
- package/dist/internal/runner.js +117 -0
- package/dist/internal/runner.js.map +1 -0
- package/dist/main.d.ts +23 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +104 -0
- package/dist/main.js.map +1 -0
- package/package.json +102 -0
- package/src/Bdd.ts +575 -0
- package/src/Errors.ts +60 -0
- package/src/bin.ts +10 -0
- package/src/index.ts +155 -0
- package/src/internal/cli/errors.ts +20 -0
- package/src/internal/cli/glob.ts +37 -0
- package/src/internal/cli/loaders.ts +100 -0
- package/src/internal/cli/models.ts +118 -0
- package/src/internal/cli/moduleLoader.ts +41 -0
- package/src/internal/cli/reporter.ts +367 -0
- package/src/internal/cli/runner.ts +336 -0
- package/src/internal/cli/tagExpression.ts +173 -0
- package/src/internal/cucumberCompiler.ts +58 -0
- package/src/internal/expression.ts +103 -0
- package/src/internal/matching.ts +81 -0
- package/src/internal/parser.ts +155 -0
- package/src/internal/runner.ts +373 -0
- package/src/main.ts +169 -0
package/dist/Bdd.d.ts
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 4.0.0
|
|
3
|
+
*/
|
|
4
|
+
import type * as Effect from "effect/Effect";
|
|
5
|
+
import { type Pipeable } from "effect/Pipeable";
|
|
6
|
+
import type * as Schema from "effect/Schema";
|
|
7
|
+
import { MatchError, ParseError, StepError } from "./Errors.ts";
|
|
8
|
+
import * as expression from "./internal/expression.ts";
|
|
9
|
+
import * as parser from "./internal/parser.ts";
|
|
10
|
+
import * as runner from "./internal/runner.ts";
|
|
11
|
+
/**
|
|
12
|
+
* Error type returned by `Bdd.run`.
|
|
13
|
+
*
|
|
14
|
+
* @category errors
|
|
15
|
+
* @since 4.0.0
|
|
16
|
+
*/
|
|
17
|
+
export type RunError = ParseError | MatchError | StepError;
|
|
18
|
+
/**
|
|
19
|
+
* Service used to compile Gherkin source into executable scenarios.
|
|
20
|
+
*
|
|
21
|
+
* **Details**
|
|
22
|
+
*
|
|
23
|
+
* The built-in `Cucumber` layer uses Cucumber's parser and Pickle compiler.
|
|
24
|
+
* Custom implementations must preserve the compiled step, argument, tag, and
|
|
25
|
+
* source-location semantics expected by the runner.
|
|
26
|
+
*
|
|
27
|
+
* @category services
|
|
28
|
+
* @since 4.0.0
|
|
29
|
+
*/
|
|
30
|
+
export declare const GherkinCompiler: typeof parser.GherkinCompiler & {
|
|
31
|
+
Cucumber: import("effect/Layer").Layer<parser.GherkinCompiler, never, never>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Service used to compile Gherkin source into executable scenarios.
|
|
35
|
+
*
|
|
36
|
+
* **Details**
|
|
37
|
+
*
|
|
38
|
+
* The built-in `Cucumber` layer uses Cucumber's parser and Pickle compiler.
|
|
39
|
+
* Custom implementations must preserve the compiled step, argument, tag, and
|
|
40
|
+
* source-location semantics expected by the runner.
|
|
41
|
+
*
|
|
42
|
+
* @category services
|
|
43
|
+
* @since 4.0.0
|
|
44
|
+
*/
|
|
45
|
+
export type GherkinCompiler = parser.GherkinCompiler;
|
|
46
|
+
/**
|
|
47
|
+
* Advanced keyword metadata attached to a transition.
|
|
48
|
+
*
|
|
49
|
+
* @category models
|
|
50
|
+
* @since 4.0.0
|
|
51
|
+
*/
|
|
52
|
+
export type StepKind = "Step" | "Given" | "When" | "Then";
|
|
53
|
+
/**
|
|
54
|
+
* A named capture decoded from step text with a Schema.
|
|
55
|
+
*
|
|
56
|
+
* @category utility types
|
|
57
|
+
* @since 4.0.0
|
|
58
|
+
*/
|
|
59
|
+
export type Capture<Name extends string, A> = expression.Capture<Name, A>;
|
|
60
|
+
/**
|
|
61
|
+
* Advanced type helper that maps capture definitions to decoded values.
|
|
62
|
+
*
|
|
63
|
+
* @category utility types
|
|
64
|
+
* @since 4.0.0
|
|
65
|
+
*/
|
|
66
|
+
export type CapturesOf<Captures extends ReadonlyArray<Capture<string, unknown>>> = {
|
|
67
|
+
readonly [Capture in Captures[number] as Capture["name"]]: Capture extends expression.Capture<string, infer A> ? A : never;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Advanced matcher type for a compiled step expression.
|
|
71
|
+
*
|
|
72
|
+
* @category utility types
|
|
73
|
+
* @since 4.0.0
|
|
74
|
+
*/
|
|
75
|
+
export type Expression<A> = expression.Matcher<A>;
|
|
76
|
+
/**
|
|
77
|
+
* A decoded DataTable argument.
|
|
78
|
+
*
|
|
79
|
+
* @category models
|
|
80
|
+
* @since 4.0.0
|
|
81
|
+
*/
|
|
82
|
+
export interface TableArg<A> {
|
|
83
|
+
readonly _tag: "TableArg";
|
|
84
|
+
readonly decode: (table: runner.DataTableInput) => Effect.Effect<A, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A decoded DocString argument.
|
|
88
|
+
*
|
|
89
|
+
* @category models
|
|
90
|
+
* @since 4.0.0
|
|
91
|
+
*/
|
|
92
|
+
export interface DocStringArg<A> {
|
|
93
|
+
readonly _tag: "DocStringArg";
|
|
94
|
+
readonly decode: (docString: runner.DocStringInput) => Effect.Effect<A, unknown>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Advanced union of decoded step argument descriptors.
|
|
98
|
+
*
|
|
99
|
+
* @category models
|
|
100
|
+
* @since 4.0.0
|
|
101
|
+
*/
|
|
102
|
+
export type StepArg<A> = TableArg<A> | DocStringArg<A>;
|
|
103
|
+
/**
|
|
104
|
+
* Advanced model for a transition registered on a feature definition.
|
|
105
|
+
*
|
|
106
|
+
* @category models
|
|
107
|
+
* @since 4.0.0
|
|
108
|
+
*/
|
|
109
|
+
export interface Transition<State, E, R, Captures = unknown, Argument = unknown> {
|
|
110
|
+
readonly kind: StepKind;
|
|
111
|
+
readonly expression: Expression<Captures>;
|
|
112
|
+
readonly argument?: StepArg<Argument>;
|
|
113
|
+
readonly run: (captures: Captures, argument: Argument, state: State) => Effect.Effect<State, E, R>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Existential transition type stored by feature definitions.
|
|
117
|
+
*
|
|
118
|
+
* **Details**
|
|
119
|
+
*
|
|
120
|
+
* A feature can contain many transitions with different capture and step
|
|
121
|
+
* argument shapes. The public constructors keep those shapes typed at the
|
|
122
|
+
* handler boundary, while the runtime matcher stores transitions through this
|
|
123
|
+
* existential type.
|
|
124
|
+
*
|
|
125
|
+
* @category models
|
|
126
|
+
* @since 4.0.0
|
|
127
|
+
*/
|
|
128
|
+
export type AnyTransition<State, E, R> = Transition<State, E, R, any, any>;
|
|
129
|
+
/**
|
|
130
|
+
* A local immutable feature definition used to interpret scenarios from Gherkin source.
|
|
131
|
+
*
|
|
132
|
+
* @category models
|
|
133
|
+
* @since 4.0.0
|
|
134
|
+
*/
|
|
135
|
+
export interface Feature<State, E = never, R = never> extends Pipeable {
|
|
136
|
+
readonly _tag: "Feature";
|
|
137
|
+
readonly name: string;
|
|
138
|
+
readonly initial: State;
|
|
139
|
+
readonly transitions: ReadonlyArray<AnyTransition<State, E, R>>;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Result returned after all scenarios pass.
|
|
143
|
+
*
|
|
144
|
+
* @category models
|
|
145
|
+
* @since 4.0.0
|
|
146
|
+
*/
|
|
147
|
+
export interface Report {
|
|
148
|
+
readonly feature: string;
|
|
149
|
+
readonly scenarios: ReadonlyArray<{
|
|
150
|
+
readonly name: string;
|
|
151
|
+
readonly steps: number;
|
|
152
|
+
readonly tags: ReadonlyArray<string>;
|
|
153
|
+
}>;
|
|
154
|
+
}
|
|
155
|
+
type FeatureType<State, E, R> = Feature<State, E, R>;
|
|
156
|
+
type ReportType = Report;
|
|
157
|
+
type RunErrorType = RunError;
|
|
158
|
+
type GherkinCompilerType = GherkinCompiler;
|
|
159
|
+
type CaptureType<Name extends string, A> = Capture<Name, A>;
|
|
160
|
+
type TableArgType<A> = TableArg<A>;
|
|
161
|
+
type DocStringArgType<A> = DocStringArg<A>;
|
|
162
|
+
/**
|
|
163
|
+
* Namespace-style API for building and running BDD feature definitions.
|
|
164
|
+
*
|
|
165
|
+
* **Details**
|
|
166
|
+
*
|
|
167
|
+
* The namespace contains constructors for captures, step arguments, feature
|
|
168
|
+
* definitions, step transitions, and the Gherkin runner.
|
|
169
|
+
*
|
|
170
|
+
* **Example** (Defining and running a feature)
|
|
171
|
+
*
|
|
172
|
+
* ```ts
|
|
173
|
+
* import { Bdd } from "effect-bdd"
|
|
174
|
+
* import { Effect, Schema } from "effect"
|
|
175
|
+
*
|
|
176
|
+
* const qty = Bdd.capture("qty", Schema.FiniteFromString)
|
|
177
|
+
*
|
|
178
|
+
* const feature = Bdd.feature("Counter", { initial: 0 }).pipe(
|
|
179
|
+
* Bdd.given`zero`(() => Effect.succeed(0)),
|
|
180
|
+
* Bdd.when`increment by ${qty}`(({ qty }, state) => Effect.succeed(state + qty))
|
|
181
|
+
* )
|
|
182
|
+
*
|
|
183
|
+
* const program = Bdd.run(feature, `
|
|
184
|
+
* Feature: Counter
|
|
185
|
+
*
|
|
186
|
+
* Scenario: Increment
|
|
187
|
+
* Given zero
|
|
188
|
+
* When increment by 2
|
|
189
|
+
* `).pipe(Effect.provide(Bdd.GherkinCompiler.Cucumber))
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* @category models
|
|
193
|
+
* @since 4.0.0
|
|
194
|
+
*/
|
|
195
|
+
export declare const Bdd: {
|
|
196
|
+
ParseError: typeof ParseError;
|
|
197
|
+
MatchError: typeof MatchError;
|
|
198
|
+
StepError: typeof StepError;
|
|
199
|
+
GherkinCompiler: typeof parser.GherkinCompiler & {
|
|
200
|
+
Cucumber: import("effect/Layer").Layer<parser.GherkinCompiler, never, never>;
|
|
201
|
+
};
|
|
202
|
+
capture: <const Name extends string, A>(name: Name, schema: Schema.Codec<A, string>) => Capture<Name, A>;
|
|
203
|
+
table: <S extends Schema.Decoder<unknown, never>>(row: S) => TableArg<ReadonlyArray<S["Type"]>>;
|
|
204
|
+
docString: <S extends Schema.Decoder<unknown, never>>(schema: S) => DocStringArg<S["Type"]>;
|
|
205
|
+
feature: <State>(name: string, options: {
|
|
206
|
+
readonly initial: State;
|
|
207
|
+
}) => Feature<State>;
|
|
208
|
+
step: StepTag<"Step">;
|
|
209
|
+
given: StepTag<"Given">;
|
|
210
|
+
when: StepTag<"When">;
|
|
211
|
+
then: StepTag<"Then">;
|
|
212
|
+
run: <State, E, R>(self: Feature<State, E, R>, source: string) => Effect.Effect<Report, RunError, R | GherkinCompiler>;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Type helpers for the {@link Bdd} value namespace.
|
|
216
|
+
*
|
|
217
|
+
* @since 4.0.0
|
|
218
|
+
*/
|
|
219
|
+
export declare namespace Bdd {
|
|
220
|
+
/**
|
|
221
|
+
* A local immutable feature definition used to interpret scenarios from Gherkin source.
|
|
222
|
+
*
|
|
223
|
+
* @since 4.0.0
|
|
224
|
+
*/
|
|
225
|
+
type Feature<State, E = never, R = never> = FeatureType<State, E, R>;
|
|
226
|
+
/**
|
|
227
|
+
* Result returned after all scenarios pass.
|
|
228
|
+
*
|
|
229
|
+
* @since 4.0.0
|
|
230
|
+
*/
|
|
231
|
+
type Report = ReportType;
|
|
232
|
+
/**
|
|
233
|
+
* Error type returned by `Bdd.run`.
|
|
234
|
+
*
|
|
235
|
+
* @since 4.0.0
|
|
236
|
+
*/
|
|
237
|
+
type RunError = RunErrorType;
|
|
238
|
+
/**
|
|
239
|
+
* Service used to compile Gherkin source into executable scenarios.
|
|
240
|
+
*
|
|
241
|
+
* @since 4.0.0
|
|
242
|
+
*/
|
|
243
|
+
type GherkinCompiler = GherkinCompilerType;
|
|
244
|
+
/**
|
|
245
|
+
* A named capture decoded from step text with a Schema.
|
|
246
|
+
*
|
|
247
|
+
* @since 4.0.0
|
|
248
|
+
*/
|
|
249
|
+
type Capture<Name extends string, A> = CaptureType<Name, A>;
|
|
250
|
+
/**
|
|
251
|
+
* A decoded DataTable argument.
|
|
252
|
+
*
|
|
253
|
+
* @since 4.0.0
|
|
254
|
+
*/
|
|
255
|
+
type TableArg<A> = TableArgType<A>;
|
|
256
|
+
/**
|
|
257
|
+
* A decoded DocString argument.
|
|
258
|
+
*
|
|
259
|
+
* @since 4.0.0
|
|
260
|
+
*/
|
|
261
|
+
type DocStringArg<A> = DocStringArgType<A>;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Advanced tagged-template function type used to register transitions.
|
|
265
|
+
*
|
|
266
|
+
* @category utility types
|
|
267
|
+
* @since 4.0.0
|
|
268
|
+
*/
|
|
269
|
+
export interface StepTag<Kind extends StepKind> {
|
|
270
|
+
<const Captures extends ReadonlyArray<Capture<string, unknown>>>(strings: TemplateStringsArray, ...captures: Captures): StepBuilder<CapturesOf<Captures>, Kind>;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Advanced builder returned by a tagged-template transition.
|
|
274
|
+
*
|
|
275
|
+
* @category utility types
|
|
276
|
+
* @since 4.0.0
|
|
277
|
+
*/
|
|
278
|
+
export interface StepBuilder<Captures, Kind extends StepKind> {
|
|
279
|
+
<State, E, R>(impl: (captures: Captures, state: State) => Effect.Effect<State, E, R>): <E0, R0>(self: Feature<State, E0, R0>) => Feature<State, E | E0, R | R0>;
|
|
280
|
+
<State, Arg, E, R>(arg: StepArg<Arg>, impl: (captures: Captures, arg: Arg, state: State) => Effect.Effect<State, E, R>): <E0, R0>(self: Feature<State, E0, R0>) => Feature<State, E | E0, R | R0>;
|
|
281
|
+
readonly kind: Kind;
|
|
282
|
+
readonly expression: Expression<Captures>;
|
|
283
|
+
}
|
|
284
|
+
export {};
|
|
285
|
+
//# sourceMappingURL=Bdd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bdd.d.ts","sourceRoot":"","sources":["../src/Bdd.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,iBAAiB,CAAA;AAC9D,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,KAAK,UAAU,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAC9C,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAA;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;;CAE1B,CAAA;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,eAAe,CAAA;AAEpD;;;;;GAKG;AACH,MAAM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AK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,GACrE,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA;IAC3E,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EACf,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EACjB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,GAC/E,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAA;IAC3E,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;CAC1C"}
|
package/dist/Bdd.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { pipeArguments } from "effect/Pipeable";
|
|
2
|
+
import { MatchError, ParseError, StepError } from "./Errors.js";
|
|
3
|
+
import * as cucumberCompiler from "./internal/cucumberCompiler.js";
|
|
4
|
+
import * as expression from "./internal/expression.js";
|
|
5
|
+
import * as parser from "./internal/parser.js";
|
|
6
|
+
import * as runner from "./internal/runner.js";
|
|
7
|
+
/**
|
|
8
|
+
* Service used to compile Gherkin source into executable scenarios.
|
|
9
|
+
*
|
|
10
|
+
* **Details**
|
|
11
|
+
*
|
|
12
|
+
* The built-in `Cucumber` layer uses Cucumber's parser and Pickle compiler.
|
|
13
|
+
* Custom implementations must preserve the compiled step, argument, tag, and
|
|
14
|
+
* source-location semantics expected by the runner.
|
|
15
|
+
*
|
|
16
|
+
* @category services
|
|
17
|
+
* @since 4.0.0
|
|
18
|
+
*/
|
|
19
|
+
export const GherkinCompiler = /*#__PURE__*/Object.assign(parser.GherkinCompiler, {
|
|
20
|
+
Cucumber: cucumberCompiler.Cucumber
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Creates a named capture decoded from step text.
|
|
24
|
+
*
|
|
25
|
+
* **When to use**
|
|
26
|
+
*
|
|
27
|
+
* Use a capture when a Gherkin step contains a value that should be decoded
|
|
28
|
+
* before it reaches the step implementation.
|
|
29
|
+
*
|
|
30
|
+
* **Example** (Capturing a number)
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { Bdd } from "effect-bdd"
|
|
34
|
+
* import { Schema } from "effect"
|
|
35
|
+
*
|
|
36
|
+
* const qty = Bdd.capture("qty", Schema.FiniteFromString)
|
|
37
|
+
*
|
|
38
|
+
* const step = Bdd.when`${qty} items are added`
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @category constructors
|
|
42
|
+
* @since 4.0.0
|
|
43
|
+
*/
|
|
44
|
+
const capture_ = expression.makeCapture;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a DataTable decoder from a row Schema.
|
|
47
|
+
*
|
|
48
|
+
* **Details**
|
|
49
|
+
*
|
|
50
|
+
* The first row of the Gherkin table is interpreted as the header row. Each
|
|
51
|
+
* following row is converted into an object and decoded with the supplied
|
|
52
|
+
* Schema.
|
|
53
|
+
*
|
|
54
|
+
* **Example** (Decoding table rows)
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { Bdd } from "effect-bdd"
|
|
58
|
+
* import { Schema } from "effect"
|
|
59
|
+
*
|
|
60
|
+
* const Item = Schema.Struct({
|
|
61
|
+
* sku: Schema.String,
|
|
62
|
+
* qty: Schema.FiniteFromString
|
|
63
|
+
* })
|
|
64
|
+
*
|
|
65
|
+
* const items = Bdd.table(Item)
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @category constructors
|
|
69
|
+
* @since 4.0.0
|
|
70
|
+
*/
|
|
71
|
+
const table_ = row => ({
|
|
72
|
+
_tag: "TableArg",
|
|
73
|
+
decode: runner.decodeTable(row)
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Creates a DocString decoder from a Schema.
|
|
77
|
+
*
|
|
78
|
+
* **When to use**
|
|
79
|
+
*
|
|
80
|
+
* Use `docString` for larger step arguments, such as JSON payloads or plain
|
|
81
|
+
* text blocks, that should be decoded before the step implementation runs.
|
|
82
|
+
*
|
|
83
|
+
* **Example** (Decoding JSON)
|
|
84
|
+
*
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { Bdd } from "effect-bdd"
|
|
87
|
+
* import { Schema } from "effect"
|
|
88
|
+
*
|
|
89
|
+
* const Payload = Schema.Struct({
|
|
90
|
+
* sku: Schema.String,
|
|
91
|
+
* qty: Schema.Number
|
|
92
|
+
* })
|
|
93
|
+
*
|
|
94
|
+
* const payload = Bdd.docString(Schema.fromJsonString(Payload))
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @category constructors
|
|
98
|
+
* @since 4.0.0
|
|
99
|
+
*/
|
|
100
|
+
const docString_ = schema => ({
|
|
101
|
+
_tag: "DocStringArg",
|
|
102
|
+
decode: runner.decodeDocString(schema)
|
|
103
|
+
});
|
|
104
|
+
/**
|
|
105
|
+
* Creates a feature definition with an explicit initial state.
|
|
106
|
+
*
|
|
107
|
+
* **Details**
|
|
108
|
+
*
|
|
109
|
+
* A feature definition is an immutable state machine. Each registered step
|
|
110
|
+
* receives the current state and returns the next state in an `Effect`.
|
|
111
|
+
*
|
|
112
|
+
* **Example** (Building a feature)
|
|
113
|
+
*
|
|
114
|
+
* ```ts
|
|
115
|
+
* import { Bdd } from "effect-bdd"
|
|
116
|
+
* import { Effect } from "effect"
|
|
117
|
+
*
|
|
118
|
+
* const feature = Bdd.feature("Counter", { initial: 0 }).pipe(
|
|
119
|
+
* Bdd.given`zero`(() => Effect.succeed(0)),
|
|
120
|
+
* Bdd.when`increment`((_captures, state) => Effect.succeed(state + 1))
|
|
121
|
+
* )
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* @category constructors
|
|
125
|
+
* @since 4.0.0
|
|
126
|
+
*/
|
|
127
|
+
const feature_ = (name, options) => makeFeature(name, options.initial, []);
|
|
128
|
+
/**
|
|
129
|
+
* Tagged-template transition factory that does not attach Gherkin keyword metadata.
|
|
130
|
+
*
|
|
131
|
+
* **When to use**
|
|
132
|
+
*
|
|
133
|
+
* Use `step` for a transition that is semantically valid as any concrete
|
|
134
|
+
* Gherkin step kind. Prefer `given`, `when`, or `then` when the transition
|
|
135
|
+
* represents setup, action, or assertion specifically.
|
|
136
|
+
*
|
|
137
|
+
* @category constructors
|
|
138
|
+
* @since 4.0.0
|
|
139
|
+
*/
|
|
140
|
+
const step_ = /*#__PURE__*/makeStepTag("Step");
|
|
141
|
+
/**
|
|
142
|
+
* Tagged-template transition factory for `Given` steps.
|
|
143
|
+
*
|
|
144
|
+
* **Details**
|
|
145
|
+
*
|
|
146
|
+
* A source `Given` step only matches `given` or keyword-agnostic `step`
|
|
147
|
+
* transitions.
|
|
148
|
+
*
|
|
149
|
+
* `And` and `But` steps inherit the previous concrete Gherkin keyword before
|
|
150
|
+
* matching, so they can match a `given` transition when they follow a `Given`.
|
|
151
|
+
*
|
|
152
|
+
* @category constructors
|
|
153
|
+
* @since 4.0.0
|
|
154
|
+
*/
|
|
155
|
+
const given_ = /*#__PURE__*/makeStepTag("Given");
|
|
156
|
+
/**
|
|
157
|
+
* Tagged-template transition factory for `When` steps.
|
|
158
|
+
*
|
|
159
|
+
* **Details**
|
|
160
|
+
*
|
|
161
|
+
* A source `When` step only matches `when` or keyword-agnostic `step`
|
|
162
|
+
* transitions.
|
|
163
|
+
*
|
|
164
|
+
* `And` and `But` steps inherit the previous concrete Gherkin keyword before
|
|
165
|
+
* matching, so they can match a `when` transition when they follow a `When`.
|
|
166
|
+
*
|
|
167
|
+
* @category constructors
|
|
168
|
+
* @since 4.0.0
|
|
169
|
+
*/
|
|
170
|
+
const when_ = /*#__PURE__*/makeStepTag("When");
|
|
171
|
+
/**
|
|
172
|
+
* Tagged-template transition factory for `Then` steps.
|
|
173
|
+
*
|
|
174
|
+
* **Details**
|
|
175
|
+
*
|
|
176
|
+
* A source `Then` step only matches `then` or keyword-agnostic `step`
|
|
177
|
+
* transitions.
|
|
178
|
+
*
|
|
179
|
+
* `And` and `But` steps inherit the previous concrete Gherkin keyword before
|
|
180
|
+
* matching, so they can match a `then` transition when they follow a `Then`.
|
|
181
|
+
*
|
|
182
|
+
* @category constructors
|
|
183
|
+
* @since 4.0.0
|
|
184
|
+
*/
|
|
185
|
+
const then_ = /*#__PURE__*/makeStepTag("Then");
|
|
186
|
+
/**
|
|
187
|
+
* Runs Gherkin source against a feature definition.
|
|
188
|
+
*
|
|
189
|
+
* **Details**
|
|
190
|
+
*
|
|
191
|
+
* The feature definition name must match the Gherkin `Feature:` name. Every
|
|
192
|
+
* scenario starts from the feature's initial state. Background steps run before
|
|
193
|
+
* each scenario, then scenario steps run in source order.
|
|
194
|
+
*
|
|
195
|
+
* **Example** (Running Gherkin)
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* import { Bdd } from "effect-bdd"
|
|
199
|
+
* import { Effect } from "effect"
|
|
200
|
+
*
|
|
201
|
+
* const feature = Bdd.feature("Counter", { initial: 0 }).pipe(
|
|
202
|
+
* Bdd.given`zero`(() => Effect.succeed(0)),
|
|
203
|
+
* Bdd.when`increment`((_captures, state) => Effect.succeed(state + 1))
|
|
204
|
+
* )
|
|
205
|
+
*
|
|
206
|
+
* const program = Bdd.run(feature, `
|
|
207
|
+
* Feature: Counter
|
|
208
|
+
*
|
|
209
|
+
* Scenario: Increment
|
|
210
|
+
* Given zero
|
|
211
|
+
* When increment
|
|
212
|
+
* `).pipe(Effect.provide(Bdd.GherkinCompiler.Cucumber))
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @category running
|
|
216
|
+
* @since 4.0.0
|
|
217
|
+
*/
|
|
218
|
+
const run_ = (self, source) => runner.run(self, source);
|
|
219
|
+
/**
|
|
220
|
+
* Namespace-style API for building and running BDD feature definitions.
|
|
221
|
+
*
|
|
222
|
+
* **Details**
|
|
223
|
+
*
|
|
224
|
+
* The namespace contains constructors for captures, step arguments, feature
|
|
225
|
+
* definitions, step transitions, and the Gherkin runner.
|
|
226
|
+
*
|
|
227
|
+
* **Example** (Defining and running a feature)
|
|
228
|
+
*
|
|
229
|
+
* ```ts
|
|
230
|
+
* import { Bdd } from "effect-bdd"
|
|
231
|
+
* import { Effect, Schema } from "effect"
|
|
232
|
+
*
|
|
233
|
+
* const qty = Bdd.capture("qty", Schema.FiniteFromString)
|
|
234
|
+
*
|
|
235
|
+
* const feature = Bdd.feature("Counter", { initial: 0 }).pipe(
|
|
236
|
+
* Bdd.given`zero`(() => Effect.succeed(0)),
|
|
237
|
+
* Bdd.when`increment by ${qty}`(({ qty }, state) => Effect.succeed(state + qty))
|
|
238
|
+
* )
|
|
239
|
+
*
|
|
240
|
+
* const program = Bdd.run(feature, `
|
|
241
|
+
* Feature: Counter
|
|
242
|
+
*
|
|
243
|
+
* Scenario: Increment
|
|
244
|
+
* Given zero
|
|
245
|
+
* When increment by 2
|
|
246
|
+
* `).pipe(Effect.provide(Bdd.GherkinCompiler.Cucumber))
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @category models
|
|
250
|
+
* @since 4.0.0
|
|
251
|
+
*/
|
|
252
|
+
export const Bdd = {
|
|
253
|
+
ParseError,
|
|
254
|
+
MatchError,
|
|
255
|
+
StepError,
|
|
256
|
+
GherkinCompiler,
|
|
257
|
+
capture: capture_,
|
|
258
|
+
table: table_,
|
|
259
|
+
docString: docString_,
|
|
260
|
+
feature: feature_,
|
|
261
|
+
step: step_,
|
|
262
|
+
given: given_,
|
|
263
|
+
when: when_,
|
|
264
|
+
// oxlint-disable-next-line unicorn/no-thenable
|
|
265
|
+
then: then_,
|
|
266
|
+
run: run_
|
|
267
|
+
};
|
|
268
|
+
const makeFeature = (name, initial, transitions) => ({
|
|
269
|
+
_tag: "Feature",
|
|
270
|
+
name,
|
|
271
|
+
initial,
|
|
272
|
+
transitions,
|
|
273
|
+
pipe() {
|
|
274
|
+
return pipeArguments(this, arguments);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
function makeStepTag(kind) {
|
|
278
|
+
return (strings, ...captures) => {
|
|
279
|
+
const matcher = expression.makeMatcher(strings, captures);
|
|
280
|
+
const builder = (first, second) => self => {
|
|
281
|
+
const transition = second === undefined ? {
|
|
282
|
+
kind,
|
|
283
|
+
expression: matcher,
|
|
284
|
+
run: (captures, _argument, state) => first(captures, state)
|
|
285
|
+
} : {
|
|
286
|
+
kind,
|
|
287
|
+
expression: matcher,
|
|
288
|
+
argument: first,
|
|
289
|
+
run: (captures, argument, state) => second(captures, argument, state)
|
|
290
|
+
};
|
|
291
|
+
return makeFeature(self.name, self.initial, [...self.transitions, transition]);
|
|
292
|
+
};
|
|
293
|
+
Object.defineProperties(builder, {
|
|
294
|
+
kind: {
|
|
295
|
+
value: kind
|
|
296
|
+
},
|
|
297
|
+
expression: {
|
|
298
|
+
value: matcher
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
return builder;
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=Bdd.js.map
|
package/dist/Bdd.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bdd.js","names":["pipeArguments","MatchError","ParseError","StepError","cucumberCompiler","expression","parser","runner","GherkinCompiler","Object","assign","Cucumber","capture_","makeCapture","table_","row","_tag","decode","decodeTable","docString_","schema","decodeDocString","feature_","name","options","makeFeature","initial","step_","makeStepTag","given_","when_","then_","run_","self","source","run","Bdd","capture","table","docString","feature","step","given","when","then","transitions","pipe","arguments","kind","strings","captures","matcher","makeMatcher","builder","first","second","transition","undefined","_argument","state","argument","defineProperties","value"],"sources":["../src/Bdd.ts"],"sourcesContent":[null],"mappings":"AAIA,SAAwBA,aAAa,QAAQ,iBAAiB;AAE9D,SAASC,UAAU,EAAEC,UAAU,EAAEC,SAAS,QAAQ,aAAa;AAC/D,OAAO,KAAKC,gBAAgB,MAAM,gCAAgC;AAClE,OAAO,KAAKC,UAAU,MAAM,0BAA0B;AACtD,OAAO,KAAKC,MAAM,MAAM,sBAAsB;AAC9C,OAAO,KAAKC,MAAM,MAAM,sBAAsB;AAU9C;;;;;;;;;;;;AAYA,OAAO,MAAMC,eAAe,gBAAGC,MAAM,CAACC,MAAM,CAACJ,MAAM,CAACE,eAAe,EAAE;EACnEG,QAAQ,EAAEP,gBAAgB,CAACO;CAC5B,CAAC;AAiJF;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAMC,QAAQ,GAGUP,UAAU,CAACQ,WAAW;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMC,MAAM,GAA8CC,GAAM,KAA0C;EACxGC,IAAI,EAAE,UAAU;EAChBC,MAAM,EAAEV,MAAM,CAACW,WAAW,CAACH,GAAG;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAMI,UAAU,GAA8CC,MAAS,KAA+B;EACpGJ,IAAI,EAAE,cAAc;EACpBC,MAAM,EAAEV,MAAM,CAACc,eAAe,CAACD,MAAM;CACtC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAME,QAAQ,GAAGA,CAAQC,IAAY,EAAEC,OAEtC,KAAqBC,WAAW,CAACF,IAAI,EAAEC,OAAO,CAACE,OAAO,EAAE,EAAE,CAAC;AAE5D;;;;;;;;;;;;AAYA,MAAMC,KAAK,gBAAoBC,WA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MtB,IAAwC,IAAI;MAClG,MAAMuB,UAAU,GAA6CD,MAAM,KAAKE,SAAS,GAC/E;QACET,IAAI;QACJ3C,UAAU,EAAE8C,OAAO;QACnBhB,GAAG,EAAEA,CAACe,QAAQ,EAAEQ,SAAS,EAAEC,KAAK,KAC7BL,KAAyF,CAACJ,QAAQ,EAAES,KAAK;OAC7G,GACD;QACEX,IAAI;QACJ3C,UAAU,EAAE8C,OAAO;QACnBS,QAAQ,EAAEN,KAAyB;QACnCnB,GAAG,EAAEA,CAACe,QAAQ,EAAEU,QAAQ,EAAED,KAAK,KAC5BJ,MAI6C,CAACL,QAAQ,EAAEU,QAAQ,EAAED,KAAK;OAC3E;MACH,OAAOlC,WAAW,CAACQ,IAAI,CAACV,IAAI,EAAEU,IAAI,CAACP,OAAO,EAAE,CAAC,GAAGO,IAAI,CAACY,WAAW,EAAEW,UAAU,CAAC,CAAC;IAChF,CAAgC;IAChC/C,MAAM,CAACoD,gBAAgB,CAACR,OAAO,EAAE;MAC/BL,IAAI,EAAE;QAAEc,KAAK,EAAEd;MAAI,CAAE;MACrB3C,UAAU,EAAE;QAAEyD,KAAK,EAAEX;MAAO;KAC7B,CAAC;IACF,OAAOE,OAAO;EAChB,CAAC;AACH","ignoreList":[]}
|
package/dist/Errors.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 4.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
declare const ParseError_base: Schema.Class<ParseError, Schema.TaggedStruct<"ParseError", {
|
|
6
|
+
readonly message: Schema.String;
|
|
7
|
+
readonly line: Schema.Number;
|
|
8
|
+
readonly column: Schema.Number;
|
|
9
|
+
}>, import("effect/Cause").YieldableError>;
|
|
10
|
+
/**
|
|
11
|
+
* A syntax or structure error found while parsing Gherkin source.
|
|
12
|
+
*
|
|
13
|
+
* **Details**
|
|
14
|
+
*
|
|
15
|
+
* The error includes the source line and column where parsing failed.
|
|
16
|
+
*
|
|
17
|
+
* @category errors
|
|
18
|
+
* @since 4.0.0
|
|
19
|
+
*/
|
|
20
|
+
export declare class ParseError extends ParseError_base {
|
|
21
|
+
}
|
|
22
|
+
declare const MatchError_base: Schema.Class<MatchError, Schema.TaggedStruct<"MatchError", {
|
|
23
|
+
readonly message: Schema.String;
|
|
24
|
+
readonly scenario: Schema.String;
|
|
25
|
+
readonly step: Schema.String;
|
|
26
|
+
readonly line: Schema.Number;
|
|
27
|
+
readonly candidates: Schema.$Array<Schema.String>;
|
|
28
|
+
readonly cause: Schema.optional<Schema.Unknown>;
|
|
29
|
+
}>, import("effect/Cause").YieldableError>;
|
|
30
|
+
/**
|
|
31
|
+
* An error raised when a parsed Gherkin step cannot be matched or decoded.
|
|
32
|
+
*
|
|
33
|
+
* **Details**
|
|
34
|
+
*
|
|
35
|
+
* The `candidates` field contains the registered step expressions considered
|
|
36
|
+
* for the failing source step. When a DataTable or DocString decode fails,
|
|
37
|
+
* `cause` contains the underlying Schema error.
|
|
38
|
+
*
|
|
39
|
+
* @category errors
|
|
40
|
+
* @since 4.0.0
|
|
41
|
+
*/
|
|
42
|
+
export declare class MatchError extends MatchError_base {
|
|
43
|
+
}
|
|
44
|
+
declare const StepError_base: Schema.Class<StepError, Schema.TaggedStruct<"StepError", {
|
|
45
|
+
readonly message: Schema.String;
|
|
46
|
+
readonly scenario: Schema.String;
|
|
47
|
+
readonly step: Schema.String;
|
|
48
|
+
readonly line: Schema.Number;
|
|
49
|
+
readonly cause: Schema.Unknown;
|
|
50
|
+
}>, import("effect/Cause").YieldableError>;
|
|
51
|
+
/**
|
|
52
|
+
* An error raised when a matched step implementation fails.
|
|
53
|
+
*
|
|
54
|
+
* **Details**
|
|
55
|
+
*
|
|
56
|
+
* The `cause` field preserves the original failure from the Effect returned by
|
|
57
|
+
* the step implementation.
|
|
58
|
+
*
|
|
59
|
+
* @category errors
|
|
60
|
+
* @since 4.0.0
|
|
61
|
+
*/
|
|
62
|
+
export declare class StepError extends StepError_base {
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=Errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../src/Errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;;;;;;AAEvC;;;;;;;;;GASG;AACH,qBAAa,UAAW,SAAQ,eAI9B;CAAG;;;;;;;;;AAEL;;;;;;;;;;;GAWG;AACH,qBAAa,UAAW,SAAQ,eAO9B;CAAG;;;;;;;;AAEL;;;;;;;;;;GAUG;AACH,qBAAa,SAAU,SAAQ,cAM7B;CAAG"}
|