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/Errors.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 4.0.0
|
|
3
|
+
*/
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
/**
|
|
6
|
+
* A syntax or structure error found while parsing Gherkin source.
|
|
7
|
+
*
|
|
8
|
+
* **Details**
|
|
9
|
+
*
|
|
10
|
+
* The error includes the source line and column where parsing failed.
|
|
11
|
+
*
|
|
12
|
+
* @category errors
|
|
13
|
+
* @since 4.0.0
|
|
14
|
+
*/
|
|
15
|
+
export class ParseError extends /*#__PURE__*/Schema.TaggedErrorClass()("ParseError", {
|
|
16
|
+
message: Schema.String,
|
|
17
|
+
line: Schema.Number,
|
|
18
|
+
column: Schema.Number
|
|
19
|
+
}) {}
|
|
20
|
+
/**
|
|
21
|
+
* An error raised when a parsed Gherkin step cannot be matched or decoded.
|
|
22
|
+
*
|
|
23
|
+
* **Details**
|
|
24
|
+
*
|
|
25
|
+
* The `candidates` field contains the registered step expressions considered
|
|
26
|
+
* for the failing source step. When a DataTable or DocString decode fails,
|
|
27
|
+
* `cause` contains the underlying Schema error.
|
|
28
|
+
*
|
|
29
|
+
* @category errors
|
|
30
|
+
* @since 4.0.0
|
|
31
|
+
*/
|
|
32
|
+
export class MatchError extends /*#__PURE__*/Schema.TaggedErrorClass()("MatchError", {
|
|
33
|
+
message: Schema.String,
|
|
34
|
+
scenario: Schema.String,
|
|
35
|
+
step: Schema.String,
|
|
36
|
+
line: Schema.Number,
|
|
37
|
+
candidates: /*#__PURE__*/Schema.Array(Schema.String),
|
|
38
|
+
cause: /*#__PURE__*/Schema.optional(Schema.Unknown)
|
|
39
|
+
}) {}
|
|
40
|
+
/**
|
|
41
|
+
* An error raised when a matched step implementation fails.
|
|
42
|
+
*
|
|
43
|
+
* **Details**
|
|
44
|
+
*
|
|
45
|
+
* The `cause` field preserves the original failure from the Effect returned by
|
|
46
|
+
* the step implementation.
|
|
47
|
+
*
|
|
48
|
+
* @category errors
|
|
49
|
+
* @since 4.0.0
|
|
50
|
+
*/
|
|
51
|
+
export class StepError extends /*#__PURE__*/Schema.TaggedErrorClass()("StepError", {
|
|
52
|
+
message: Schema.String,
|
|
53
|
+
scenario: Schema.String,
|
|
54
|
+
step: Schema.String,
|
|
55
|
+
line: Schema.Number,
|
|
56
|
+
cause: Schema.Unknown
|
|
57
|
+
}) {}
|
|
58
|
+
//# sourceMappingURL=Errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.js","names":["Schema","ParseError","TaggedErrorClass","message","String","line","Number","column","MatchError","scenario","step","candidates","Array","cause","optional","Unknown","StepError"],"sources":["../src/Errors.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,MAAM,MAAM,eAAe;AAEvC;;;;;;;;;;AAUA,OAAM,MAAOC,UAAW,sBAAQD,MAAM,CAACE,gBAAgB,EAAc,CAAC,YAAY,EAAE;EAClFC,OAAO,EAAEH,MAAM,CAACI,MAAM;EACtBC,IAAI,EAAEL,MAAM,CAACM,MAAM;EACnBC,MAAM,EAAEP,MAAM,CAACM;CAChB,CAAC;AAEF;;;;;;;;;;;;AAYA,OAAM,MAAOE,UAAW,sBAAQR,MAAM,CAACE,gBAAgB,EAAc,CAAC,YAAY,EAAE;EAClFC,OAAO,EAAEH,MAAM,CAACI,MAAM;EACtBK,QAAQ,EAAET,MAAM,CAACI,MAAM;EACvBM,IAAI,EAAEV,MAAM,CAACI,MAAM;EACnBC,IAAI,EAAEL,MAAM,CAACM,MAAM;EACnBK,UAAU,eAAEX,MAAM,CAACY,KAAK,CAACZ,MAAM,CAACI,MAAM,CAAC;EACvCS,KAAK,eAAEb,MAAM,CAACc,QAAQ,CAACd,MAAM,CAACe,OAAO;CACtC,CAAC;AAEF;;;;;;;;;;;AAWA,OAAM,MAAOC,SAAU,sBAAQhB,MAAM,CAACE,gBAAgB,EAAa,CAAC,WAAW,EAAE;EAC/EC,OAAO,EAAEH,MAAM,CAACI,MAAM;EACtBK,QAAQ,EAAET,MAAM,CAACI,MAAM;EACvBM,IAAI,EAAEV,MAAM,CAACI,MAAM;EACnBC,IAAI,EAAEL,MAAM,CAACM,MAAM;EACnBO,KAAK,EAAEb,MAAM,CAACe;CACf,CAAC","ignoreList":[]}
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
|
3
|
+
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { run } from "./main.js";
|
|
6
|
+
run.pipe(Effect.provide(NodeServices.layer), NodeRuntime.runMain);
|
|
7
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","names":["NodeRuntime","NodeServices","Effect","run","pipe","provide","layer","runMain"],"sources":["../src/bin.ts"],"sourcesContent":[null],"mappings":";AACA,OAAO,KAAKA,WAAW,MAAM,mCAAmC;AAChE,OAAO,KAAKC,YAAY,MAAM,oCAAoC;AAClE,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,GAAG,QAAQ,WAAW;AAE/BA,GAAG,CAACC,IAAI,CACNF,MAAM,CAACG,OAAO,CAACJ,YAAY,CAACK,KAAK,CAAC,EAClCN,WAAW,CAACO,OAAO,CACpB","ignoreList":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Capture as Capture_, DocStringArg as DocStringArg_, Feature as Feature_, GherkinCompiler as GherkinCompiler_, Report as Report_, RunError as RunError_, TableArg as TableArg_ } from "./Bdd.ts";
|
|
2
|
+
import { MatchError as matchError, ParseError as parseError, StepError as stepError } from "./Errors.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Namespace-style API for building and running BDD feature definitions.
|
|
5
|
+
*
|
|
6
|
+
* @category re-exports
|
|
7
|
+
* @since 4.0.0
|
|
8
|
+
*/
|
|
9
|
+
export declare const Bdd: {
|
|
10
|
+
ParseError: typeof parseError;
|
|
11
|
+
MatchError: typeof matchError;
|
|
12
|
+
StepError: typeof stepError;
|
|
13
|
+
GherkinCompiler: typeof import("./internal/parser.ts").GherkinCompiler & {
|
|
14
|
+
Cucumber: import("effect/Layer").Layer<import("./internal/parser.ts").GherkinCompiler, never, never>;
|
|
15
|
+
};
|
|
16
|
+
capture: <const Name extends string, A>(name: Name, schema: import("effect/Schema").Codec<A, string>) => Capture_<Name, A>;
|
|
17
|
+
table: <S extends import("effect/Schema").Decoder<unknown, never>>(row: S) => TableArg_<ReadonlyArray<S["Type"]>>;
|
|
18
|
+
docString: <S extends import("effect/Schema").Decoder<unknown, never>>(schema: S) => DocStringArg_<S["Type"]>;
|
|
19
|
+
feature: <State>(name: string, options: {
|
|
20
|
+
readonly initial: State;
|
|
21
|
+
}) => Feature_<State>;
|
|
22
|
+
step: import("./Bdd.ts").StepTag<"Step">;
|
|
23
|
+
given: import("./Bdd.ts").StepTag<"Given">;
|
|
24
|
+
when: import("./Bdd.ts").StepTag<"When">;
|
|
25
|
+
then: import("./Bdd.ts").StepTag<"Then">;
|
|
26
|
+
run: <State, E, R>(self: Feature_<State, E, R>, source: string) => import("effect/Effect").Effect<Report_, RunError_, R | GherkinCompiler_>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Type helpers for the {@link Bdd} value namespace.
|
|
30
|
+
*
|
|
31
|
+
* @since 4.0.0
|
|
32
|
+
*/
|
|
33
|
+
export declare namespace Bdd {
|
|
34
|
+
/**
|
|
35
|
+
* A local immutable feature definition used to interpret scenarios from Gherkin source.
|
|
36
|
+
*
|
|
37
|
+
* @since 4.0.0
|
|
38
|
+
*/
|
|
39
|
+
type Feature<State, E = never, R = never> = Feature_<State, E, R>;
|
|
40
|
+
/**
|
|
41
|
+
* Result returned after all scenarios pass.
|
|
42
|
+
*
|
|
43
|
+
* @since 4.0.0
|
|
44
|
+
*/
|
|
45
|
+
type Report = Report_;
|
|
46
|
+
/**
|
|
47
|
+
* Error type returned by `Bdd.run`.
|
|
48
|
+
*
|
|
49
|
+
* @since 4.0.0
|
|
50
|
+
*/
|
|
51
|
+
type RunError = RunError_;
|
|
52
|
+
/**
|
|
53
|
+
* Service used to compile Gherkin source into executable scenarios.
|
|
54
|
+
*
|
|
55
|
+
* @since 4.0.0
|
|
56
|
+
*/
|
|
57
|
+
type GherkinCompiler = GherkinCompiler_;
|
|
58
|
+
/**
|
|
59
|
+
* A named capture decoded from step text with a Schema.
|
|
60
|
+
*
|
|
61
|
+
* @since 4.0.0
|
|
62
|
+
*/
|
|
63
|
+
type Capture<Name extends string, A> = Capture_<Name, A>;
|
|
64
|
+
/**
|
|
65
|
+
* A decoded DataTable argument.
|
|
66
|
+
*
|
|
67
|
+
* @since 4.0.0
|
|
68
|
+
*/
|
|
69
|
+
type TableArg<A> = TableArg_<A>;
|
|
70
|
+
/**
|
|
71
|
+
* A decoded DocString argument.
|
|
72
|
+
*
|
|
73
|
+
* @since 4.0.0
|
|
74
|
+
*/
|
|
75
|
+
type DocStringArg<A> = DocStringArg_<A>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Error raised when a Gherkin step cannot be matched or decoded.
|
|
79
|
+
*
|
|
80
|
+
* @category re-exports
|
|
81
|
+
* @since 4.0.0
|
|
82
|
+
*/
|
|
83
|
+
export declare const MatchError: typeof matchError;
|
|
84
|
+
/**
|
|
85
|
+
* Error raised when Gherkin source cannot be parsed.
|
|
86
|
+
*
|
|
87
|
+
* @category re-exports
|
|
88
|
+
* @since 4.0.0
|
|
89
|
+
*/
|
|
90
|
+
export declare const ParseError: typeof parseError;
|
|
91
|
+
/**
|
|
92
|
+
* Error raised when a matched step implementation fails.
|
|
93
|
+
*
|
|
94
|
+
* @category re-exports
|
|
95
|
+
* @since 4.0.0
|
|
96
|
+
*/
|
|
97
|
+
export declare const StepError: typeof stepError;
|
|
98
|
+
/**
|
|
99
|
+
* A named capture decoded from step text with a Schema.
|
|
100
|
+
*
|
|
101
|
+
* @category re-exports
|
|
102
|
+
* @since 4.0.0
|
|
103
|
+
*/
|
|
104
|
+
export type Capture<Name extends string, A> = Capture_<Name, A>;
|
|
105
|
+
/**
|
|
106
|
+
* A decoded DocString argument.
|
|
107
|
+
*
|
|
108
|
+
* @category re-exports
|
|
109
|
+
* @since 4.0.0
|
|
110
|
+
*/
|
|
111
|
+
export type DocStringArg<A> = DocStringArg_<A>;
|
|
112
|
+
/**
|
|
113
|
+
* A local immutable feature definition used to interpret scenarios from Gherkin source.
|
|
114
|
+
*
|
|
115
|
+
* @category re-exports
|
|
116
|
+
* @since 4.0.0
|
|
117
|
+
*/
|
|
118
|
+
export type Feature<State, E = never, R = never> = Feature_<State, E, R>;
|
|
119
|
+
/**
|
|
120
|
+
* Result returned after all scenarios pass.
|
|
121
|
+
*
|
|
122
|
+
* @category re-exports
|
|
123
|
+
* @since 4.0.0
|
|
124
|
+
*/
|
|
125
|
+
export type Report = Report_;
|
|
126
|
+
/**
|
|
127
|
+
* Error type returned by `Bdd.run`.
|
|
128
|
+
*
|
|
129
|
+
* @category re-exports
|
|
130
|
+
* @since 4.0.0
|
|
131
|
+
*/
|
|
132
|
+
export type RunError = RunError_;
|
|
133
|
+
/**
|
|
134
|
+
* Service used to compile Gherkin source into executable scenarios.
|
|
135
|
+
*
|
|
136
|
+
* @category re-exports
|
|
137
|
+
* @since 4.0.0
|
|
138
|
+
*/
|
|
139
|
+
export type GherkinCompiler = GherkinCompiler_;
|
|
140
|
+
/**
|
|
141
|
+
* A decoded DataTable argument.
|
|
142
|
+
*
|
|
143
|
+
* @category re-exports
|
|
144
|
+
* @since 4.0.0
|
|
145
|
+
*/
|
|
146
|
+
export type TableArg<A> = TableArg_<A>;
|
|
147
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,IAAI,QAAQ,EACnB,YAAY,IAAI,aAAa,EAC7B,OAAO,IAAI,QAAQ,EACnB,eAAe,IAAI,gBAAgB,EACnC,MAAM,IAAI,OAAO,EACjB,QAAQ,IAAI,SAAS,EACrB,QAAQ,IAAI,SAAS,EACtB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,UAAU,IAAI,UAAU,EAAE,UAAU,IAAI,UAAU,EAAE,SAAS,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAExG;;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;CAAM,CAAA;AAEtB;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B;;;;OAIG;IACH,KAAY,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAExE;;;;OAIG;IACH,KAAY,MAAM,GAAG,OAAO,CAAA;IAE5B;;;;OAIG;IACH,KAAY,QAAQ,GAAG,SAAS,CAAA;IAEhC;;;;OAIG;IACH,KAAY,eAAe,GAAG,gBAAgB,CAAA;IAE9C;;;;OAIG;IACH,KAAY,OAAO,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IAE/D;;;;OAIG;IACH,KAAY,QAAQ,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAA;IAEtC;;;;OAIG;IACH,KAAY,YAAY,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;CAC/C;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,mBAAa,CAAA;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,mBAAa,CAAA;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,kBAAY,CAAA;AAElC;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AAExE;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAA;AAEhC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Bdd as bdd } from "./Bdd.js";
|
|
2
|
+
import { MatchError as matchError, ParseError as parseError, StepError as stepError } from "./Errors.js";
|
|
3
|
+
/**
|
|
4
|
+
* Namespace-style API for building and running BDD feature definitions.
|
|
5
|
+
*
|
|
6
|
+
* @category re-exports
|
|
7
|
+
* @since 4.0.0
|
|
8
|
+
*/
|
|
9
|
+
export const Bdd = bdd;
|
|
10
|
+
/**
|
|
11
|
+
* Error raised when a Gherkin step cannot be matched or decoded.
|
|
12
|
+
*
|
|
13
|
+
* @category re-exports
|
|
14
|
+
* @since 4.0.0
|
|
15
|
+
*/
|
|
16
|
+
export const MatchError = matchError;
|
|
17
|
+
/**
|
|
18
|
+
* Error raised when Gherkin source cannot be parsed.
|
|
19
|
+
*
|
|
20
|
+
* @category re-exports
|
|
21
|
+
* @since 4.0.0
|
|
22
|
+
*/
|
|
23
|
+
export const ParseError = parseError;
|
|
24
|
+
/**
|
|
25
|
+
* Error raised when a matched step implementation fails.
|
|
26
|
+
*
|
|
27
|
+
* @category re-exports
|
|
28
|
+
* @since 4.0.0
|
|
29
|
+
*/
|
|
30
|
+
export const StepError = stepError;
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Bdd","bdd","MatchError","matchError","ParseError","parseError","StepError","stepError"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAG,IAAIC,GAAG,QAAQ,UAAU;AAUrC,SAASC,UAAU,IAAIC,UAAU,EAAEC,UAAU,IAAIC,UAAU,EAAEC,SAAS,IAAIC,SAAS,QAAQ,aAAa;AAExG;;;;;;AAMA,OAAO,MAAMP,GAAG,GAAGC,GAAG;AA0DtB;;;;;;AAMA,OAAO,MAAMC,UAAU,GAAGC,UAAU;AAEpC;;;;;;AAMA,OAAO,MAAMC,UAAU,GAAGC,UAAU;AAEpC;;;;;;AAMA,OAAO,MAAMC,SAAS,GAAGC,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare const DiscoveryError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2
|
+
readonly _tag: "DiscoveryError";
|
|
3
|
+
} & Readonly<A>;
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare class DiscoveryError extends DiscoveryError_base<{
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly cause?: unknown;
|
|
8
|
+
}> {
|
|
9
|
+
}
|
|
10
|
+
declare const ModuleLoadError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
11
|
+
readonly _tag: "ModuleLoadError";
|
|
12
|
+
} & Readonly<A>;
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare class ModuleLoadError extends ModuleLoadError_base<{
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly message: string;
|
|
17
|
+
readonly cause?: unknown;
|
|
18
|
+
}> {
|
|
19
|
+
}
|
|
20
|
+
declare const ReporterError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
21
|
+
readonly _tag: "ReporterError";
|
|
22
|
+
} & Readonly<A>;
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare class ReporterError extends ReporterError_base<{
|
|
25
|
+
readonly message: string;
|
|
26
|
+
readonly cause?: unknown;
|
|
27
|
+
}> {
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/internal/cli/errors.ts"],"names":[],"mappings":";;;AAEA,gBAAgB;AAChB,qBAAa,cAAe,SAAQ,oBAAmC;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CACzB,CAAC;CAAG;;;;AAEL,gBAAgB;AAChB,qBAAa,eAAgB,SAAQ,qBAAoC;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CACzB,CAAC;CAAG;;;;AAEL,gBAAgB;AAChB,qBAAa,aAAc,SAAQ,mBAAkC;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CACzB,CAAC;CAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
/** @internal */
|
|
3
|
+
export class DiscoveryError extends /*#__PURE__*/Data.TaggedError("DiscoveryError") {}
|
|
4
|
+
/** @internal */
|
|
5
|
+
export class ModuleLoadError extends /*#__PURE__*/Data.TaggedError("ModuleLoadError") {}
|
|
6
|
+
/** @internal */
|
|
7
|
+
export class ReporterError extends /*#__PURE__*/Data.TaggedError("ReporterError") {}
|
|
8
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","names":["Data","DiscoveryError","TaggedError","ModuleLoadError","ReporterError"],"sources":["../../../src/internal/cli/errors.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,IAAI,MAAM,aAAa;AAEnC;AACA,OAAM,MAAOC,cAAe,sBAAQD,IAAI,CAACE,WAAW,CAAC,gBAAgB,CAGnE;AAEF;AACA,OAAM,MAAOC,eAAgB,sBAAQH,IAAI,CAACE,WAAW,CAAC,iBAAiB,CAIrE;AAEF;AACA,OAAM,MAAOE,aAAc,sBAAQJ,IAAI,CAACE,WAAW,CAAC,eAAe,CAGjE","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import { DiscoveryError } from "./errors.ts";
|
|
5
|
+
declare const GlobResolver_base: Context.ServiceClass<GlobResolver, "effect-bdd/cli/GlobResolver", {
|
|
6
|
+
readonly resolve: (patterns: ReadonlyArray<string>) => Effect.Effect<ReadonlyArray<string>, DiscoveryError>;
|
|
7
|
+
}>;
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare class GlobResolver extends GlobResolver_base {
|
|
10
|
+
static readonly Live: Layer.Layer<GlobResolver, never, never>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/internal/cli/glob.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;;sBAcxB,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;;AAF7G,gBAAgB;AAChB,qBAAa,YAAa,SAAQ,iBAEC;IACjC,MAAM,CAAC,QAAQ,CAAC,IAAI,0CAElB;CACH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as Arr from "effect/Array";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { pipe } from "effect/Function";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as Order from "effect/Order";
|
|
7
|
+
import { glob } from "glob";
|
|
8
|
+
import { DiscoveryError } from "./errors.js";
|
|
9
|
+
const resolve = /*#__PURE__*/Effect.fnUntraced(function* (patterns) {
|
|
10
|
+
const paths = yield* Effect.forEach(patterns, resolvePattern);
|
|
11
|
+
return pipe(paths, Arr.flatten, Arr.dedupe, Arr.sort(Order.String));
|
|
12
|
+
});
|
|
13
|
+
/** @internal */
|
|
14
|
+
export class GlobResolver extends /*#__PURE__*/Context.Service()("effect-bdd/cli/GlobResolver") {
|
|
15
|
+
static Live = /*#__PURE__*/Layer.succeed(GlobResolver, {
|
|
16
|
+
resolve
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const resolvePattern = pattern => Effect.tryPromise({
|
|
20
|
+
try: () => glob(pattern, {
|
|
21
|
+
absolute: true,
|
|
22
|
+
nodir: true
|
|
23
|
+
}),
|
|
24
|
+
catch: cause => new DiscoveryError({
|
|
25
|
+
message: `Could not resolve glob pattern "${pattern}"`,
|
|
26
|
+
cause
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=glob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.js","names":["Arr","Context","Effect","pipe","Layer","Order","glob","DiscoveryError","resolve","fnUntraced","patterns","paths","forEach","resolvePattern","flatten","dedupe","sort","String","GlobResolver","Service","Live","succeed","pattern","tryPromise","try","absolute","nodir","catch","cause","message"],"sources":["../../../src/internal/cli/glob.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,SAASC,IAAI,QAAQ,MAAM;AAC3B,SAASC,cAAc,QAAQ,aAAa;AAE5C,MAAMC,OAAO,gBAAGN,MAAM,CAACO,UAAU,CAAC,WAAUC,QAA+B;EACzE,MAAMC,KAAK,GAAG,OAAOT,MAAM,CAACU,OAAO,CAACF,QAAQ,EAAEG,cAAc,CAAC;EAC7D,OAAOV,IAAI,CACTQ,KAAK,EACLX,GAAG,CAACc,OAAO,EACXd,GAAG,CAACe,MAAM,EACVf,GAAG,CAACgB,IAAI,CAACX,KAAK,CAACY,MAAM,CAAC,CACvB;AACH,CAAC,CAAC;AAEF;AACA,OAAM,MAAOC,YAAa,sBAAQjB,OAAO,CAACkB,OAAO,EAE7C,CAAC,6BAA6B,CAAC;EACjC,OAAgBC,IAAI,gBAAGhB,KAAK,CAACiB,OAAO,CAACH,YAAY,EAAE;IACjDV;GACD,CAAC;;AAGJ,MAAMK,cAAc,GAAIS,OAAe,IACrCpB,MAAM,CAACqB,UAAU,CAAC;EAChBC,GAAG,EAAEA,CAAA,KAAMlB,IAAI,CAACgB,OAAO,EAAE;IAAEG,QAAQ,EAAE,IAAI;IAAEC,KAAK,EAAE;EAAI,CAAE,CAAC;EACzDC,KAAK,EAAGC,KAAK,IACX,IAAIrB,cAAc,CAAC;IACjBsB,OAAO,EAAE,mCAAmCP,OAAO,GAAG;IACtDM;GACD;CACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as FileSystem from "effect/FileSystem";
|
|
3
|
+
import type * as Path from "effect/Path";
|
|
4
|
+
import type * as Bdd from "../../Bdd.ts";
|
|
5
|
+
import { DiscoveryError, type ModuleLoadError } from "./errors.ts";
|
|
6
|
+
import { GlobResolver } from "./glob.ts";
|
|
7
|
+
import type { FeatureSource } from "./models.ts";
|
|
8
|
+
import { ModuleLoader } from "./moduleLoader.ts";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const loadFeatureSources: (patterns: ReadonlyArray<string>) => Effect.Effect<ReadonlyArray<FeatureSource>, DiscoveryError, FileSystem.FileSystem | GlobResolver>;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const loadFeatureDefinitions: (patterns: ReadonlyArray<string>) => Effect.Effect<ReadonlyArray<Bdd.Feature<unknown, unknown, never>>, DiscoveryError | ModuleLoadError, GlobResolver | ModuleLoader | Path.Path>;
|
|
13
|
+
//# sourceMappingURL=loaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../../src/internal/cli/loaders.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,KAAK,IAAI,MAAM,aAAa,CAAA;AAExC,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,gBAAgB;AAChB,eAAO,MAAM,kBAAkB,EAAE,CAC/B,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,KAC5B,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,cAAc,EAAE,UAAU,CAAC,UAAU,GAAG,YAAY,CAqBjG,CAAA;AAEJ,gBAAgB;AAChB,eAAO,MAAM,sBAAsB,EAAE,CACnC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,KAC5B,MAAM,CAAC,MAAM,CAChB,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,EACnD,cAAc,GAAG,eAAe,EAChC,YAAY,GAAG,YAAY,GAAG,IAAI,CAAC,IAAI,CAgBvC,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Arr from "effect/Array";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as FileSystem from "effect/FileSystem";
|
|
4
|
+
import { pipe } from "effect/Function";
|
|
5
|
+
import * as Record_ from "effect/Record";
|
|
6
|
+
import { DiscoveryError } from "./errors.js";
|
|
7
|
+
import { GlobResolver } from "./glob.js";
|
|
8
|
+
import { ModuleLoader } from "./moduleLoader.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const loadFeatureSources = /*#__PURE__*/Effect.fnUntraced(function* (patterns) {
|
|
11
|
+
const fs = yield* FileSystem.FileSystem;
|
|
12
|
+
const glob = yield* GlobResolver;
|
|
13
|
+
const paths = yield* nonEmptyPaths(yield* glob.resolve(patterns), "No feature files matched --features");
|
|
14
|
+
return yield* Effect.forEach(paths, path => pipe(fs.readFileString(path), Effect.map(source => ({
|
|
15
|
+
path,
|
|
16
|
+
source
|
|
17
|
+
})), Effect.mapError(cause => new DiscoveryError({
|
|
18
|
+
message: `Could not read feature file "${path}"`,
|
|
19
|
+
cause
|
|
20
|
+
}))));
|
|
21
|
+
});
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const loadFeatureDefinitions = /*#__PURE__*/Effect.fnUntraced(function* (patterns) {
|
|
24
|
+
const glob = yield* GlobResolver;
|
|
25
|
+
const loader = yield* ModuleLoader;
|
|
26
|
+
const paths = yield* nonEmptyPaths(yield* glob.resolve(patterns), "No step definition modules matched --steps");
|
|
27
|
+
const definitions = yield* Effect.forEach(paths, path => pipe(loader.load(path), Effect.map(extractFeatureDefinitions)));
|
|
28
|
+
return yield* nonEmptyDefinitions(Arr.flatten(definitions));
|
|
29
|
+
});
|
|
30
|
+
const nonEmptyPaths = (paths, message) => paths.length === 0 ? Effect.fail(new DiscoveryError({
|
|
31
|
+
message
|
|
32
|
+
})) : Effect.succeed(paths);
|
|
33
|
+
const nonEmptyDefinitions = definitions => definitions.length === 0 ? Effect.fail(new DiscoveryError({
|
|
34
|
+
message: "No Bdd.Feature exports found in matched step definition modules"
|
|
35
|
+
})) : Effect.succeed(definitions);
|
|
36
|
+
const extractFeatureDefinitions = module => pipe(Record_.values(module), Arr.filter(isFeatureDefinition));
|
|
37
|
+
const isFeatureDefinition = value => {
|
|
38
|
+
if (typeof value !== "object" || value === null) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
const candidate = value;
|
|
42
|
+
return candidate._tag === "Feature" && "initial" in candidate && typeof candidate.name === "string" && Array.isArray(candidate.transitions);
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=loaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders.js","names":["Arr","Effect","FileSystem","pipe","Record_","DiscoveryError","GlobResolver","ModuleLoader","loadFeatureSources","fnUntraced","patterns","fs","glob","paths","nonEmptyPaths","resolve","forEach","path","readFileString","map","source","mapError","cause","message","loadFeatureDefinitions","loader","definitions","load","extractFeatureDefinitions","nonEmptyDefinitions","flatten","length","fail","succeed","module","values","filter","isFeatureDefinition","value","candidate","_tag","name","Array","isArray","transitions"],"sources":["../../../src/internal/cli/loaders.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,SAASC,IAAI,QAAQ,iBAAiB;AAEtC,OAAO,KAAKC,OAAO,MAAM,eAAe;AAExC,SAASC,cAAc,QAA8B,aAAa;AAClE,SAASC,YAAY,QAAQ,WAAW;AAExC,SAASC,YAAY,QAAQ,mBAAmB;AAEhD;AACA,OAAO,MAAMC,kBAAkB,gBAE0EP,MAAM,CAC5GQ,UAAU,CAAC,WACVC,QAA+B;EAE/B,MAAMC,EAAE,GAAG,OAAOT,UAAU,CAACA,UAAU;EACvC,MAAMU,IAAI,GAAG,OAAON,YAAY;EAChC,MAAMO,KAAK,GAAG,OAAOC,aAAa,CAChC,OAAOF,IAAI,CAACG,OAAO,CAACL,QAAQ,CAAC,EAC7B,qCAAqC,CACtC;EACD,OAAO,OAAOT,MAAM,CAACe,OAAO,CAACH,KAAK,EAAGI,IAAI,IACvCd,IAAI,CACFQ,EAAE,CAACO,cAAc,CAACD,IAAI,CAAC,EACvBhB,MA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M,CAACgC,OAAO,CAACP,WAAW,CAAC;AAEjC,MAAME,yBAAyB,GAC7BM,MAA+B,IAE/B/B,IAAI,CACFC,OAAO,CAAC+B,MAAM,CAACD,MAAM,CAAC,EACtBlC,GAAG,CAACoC,MAAM,CAACC,mBAAmB,CAAC,CAChC;AAEH,MAAMA,mBAAmB,GAAIC,KAAc,IAAmD;EAC5F,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,EAAE;IAC/C,OAAO,KAAK;EACd;EACA,MAAMC,SAAS,GAAGD,KAKjB;EACD,OAAOC,SAAS,CAACC,IAAI,KAAK,SAAS,IACjC,SAAS,IAAID,SAAS,IACtB,OAAOA,SAAS,CAACE,IAAI,KAAK,QAAQ,IAClCC,KAAK,CAACC,OAAO,CAACJ,SAAS,CAACK,WAAW,CAAC;AACxC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { PickleStep } from "@cucumber/messages";
|
|
2
|
+
import type * as Bdd from "../../Bdd.ts";
|
|
3
|
+
import type * as Parser from "../parser.ts";
|
|
4
|
+
import type * as CoreRunner from "../runner.ts";
|
|
5
|
+
/** @internal */
|
|
6
|
+
export interface FeatureSource {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly source: string;
|
|
9
|
+
}
|
|
10
|
+
/** @internal */
|
|
11
|
+
export interface ScenarioTask {
|
|
12
|
+
readonly featurePath: string;
|
|
13
|
+
readonly core: CoreRunner.ScenarioTask<unknown, unknown, never>;
|
|
14
|
+
}
|
|
15
|
+
/** @internal */
|
|
16
|
+
export type ScenarioOutcome = {
|
|
17
|
+
readonly _tag: "Passed";
|
|
18
|
+
readonly steps: number;
|
|
19
|
+
} | {
|
|
20
|
+
readonly _tag: "Failed";
|
|
21
|
+
readonly error: Bdd.RunError;
|
|
22
|
+
};
|
|
23
|
+
/** @internal */
|
|
24
|
+
export interface ScenarioResult {
|
|
25
|
+
readonly task: ScenarioTask;
|
|
26
|
+
readonly outcome: ScenarioOutcome;
|
|
27
|
+
readonly durationMillis: number;
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
export interface RunSummary {
|
|
31
|
+
readonly features: number;
|
|
32
|
+
readonly total: number;
|
|
33
|
+
readonly passed: number;
|
|
34
|
+
readonly failed: number;
|
|
35
|
+
readonly durationMillis: number;
|
|
36
|
+
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type CliDiagnostic = {
|
|
39
|
+
readonly _tag: "UnmatchedFeature";
|
|
40
|
+
readonly featurePath: string;
|
|
41
|
+
readonly featureName: string;
|
|
42
|
+
readonly line: number;
|
|
43
|
+
readonly message: string;
|
|
44
|
+
} | {
|
|
45
|
+
readonly _tag: "UnmatchedStep";
|
|
46
|
+
readonly featurePath: string;
|
|
47
|
+
readonly featureName: string;
|
|
48
|
+
readonly scenarioName: string;
|
|
49
|
+
readonly scenarioLine: number;
|
|
50
|
+
readonly step: PickleStep;
|
|
51
|
+
readonly source: Parser.SourceIndex;
|
|
52
|
+
readonly reason: "NoMatch" | "WrongKeyword" | "MultipleMatches";
|
|
53
|
+
readonly candidates: ReadonlyArray<string>;
|
|
54
|
+
readonly message: string;
|
|
55
|
+
} | {
|
|
56
|
+
readonly _tag: "UnmatchedScenario";
|
|
57
|
+
readonly featurePath: string;
|
|
58
|
+
readonly featureName: string;
|
|
59
|
+
readonly scenarioName: string;
|
|
60
|
+
readonly scenarioLine: number;
|
|
61
|
+
readonly message: string;
|
|
62
|
+
} | {
|
|
63
|
+
readonly _tag: "UnusedFeatureDefinition";
|
|
64
|
+
readonly featureName: string;
|
|
65
|
+
readonly message: string;
|
|
66
|
+
} | {
|
|
67
|
+
readonly _tag: "UnusedStepDefinition";
|
|
68
|
+
readonly featureName: string;
|
|
69
|
+
readonly expression: string;
|
|
70
|
+
readonly kind: string;
|
|
71
|
+
readonly message: string;
|
|
72
|
+
};
|
|
73
|
+
/** @internal */
|
|
74
|
+
export interface CliRunResult {
|
|
75
|
+
readonly results: ReadonlyArray<ScenarioResult>;
|
|
76
|
+
readonly diagnostics: ReadonlyArray<CliDiagnostic>;
|
|
77
|
+
readonly summary: RunSummary;
|
|
78
|
+
}
|
|
79
|
+
/** @internal */
|
|
80
|
+
export interface CliFilters {
|
|
81
|
+
readonly tags: ReadonlyArray<string>;
|
|
82
|
+
readonly names: ReadonlyArray<string>;
|
|
83
|
+
readonly failFast: boolean;
|
|
84
|
+
}
|
|
85
|
+
/** @internal */
|
|
86
|
+
export interface CliOptions {
|
|
87
|
+
readonly features: ReadonlyArray<string>;
|
|
88
|
+
readonly steps: ReadonlyArray<string>;
|
|
89
|
+
readonly reporters: ReadonlyArray<ReporterName>;
|
|
90
|
+
readonly outputFiles: {
|
|
91
|
+
readonly text?: string;
|
|
92
|
+
readonly html?: string;
|
|
93
|
+
readonly json?: string;
|
|
94
|
+
readonly junit?: string;
|
|
95
|
+
};
|
|
96
|
+
readonly verbose: boolean;
|
|
97
|
+
readonly filters: CliFilters;
|
|
98
|
+
readonly parallel: number;
|
|
99
|
+
}
|
|
100
|
+
/** @internal */
|
|
101
|
+
export type ReporterName = "text" | "html" | "json" | "junit";
|
|
102
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/internal/cli/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,KAAK,UAAU,MAAM,cAAc,CAAA;AAE/C,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,gBAAgB;AAChB,MAAM,WAAW,YAAY;IAC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E,UAAU,CAAA;CAC7B;AAED,gBAAgB;AAChB,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACpC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAC3B;AAED,gBAAgB;AAChB,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACxC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;IAC/C,QAAQ,CAAC,WAAW,EAAE;QACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KACxB,CAAA;IACD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAED,gBAAgB;AAChB,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","names":[],"sources":["../../../src/internal/cli/models.ts"],"sourcesContent":[null],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Path from "effect/Path";
|
|
5
|
+
import { ModuleLoadError } from "./errors.ts";
|
|
6
|
+
declare const ModuleLoader_base: Context.ServiceClass<ModuleLoader, "effect-bdd/cli/ModuleLoader", {
|
|
7
|
+
readonly load: (path: string) => Effect.Effect<Record<string, unknown>, ModuleLoadError, Path.Path>;
|
|
8
|
+
}>;
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare class ModuleLoader extends ModuleLoader_base {
|
|
11
|
+
static readonly Live: Layer.Layer<ModuleLoader, never, never>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=moduleLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleLoader.d.ts","sourceRoot":"","sources":["../../../src/internal/cli/moduleLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;;mBAa5B,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC;;AAFrG,gBAAgB;AAChB,qBAAa,YAAa,SAAQ,iBAEC;IACjC,MAAM,CAAC,QAAQ,CAAC,IAAI,0CAElB;CACH"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = this && this.__rewriteRelativeImportExtension || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import * as Context from "effect/Context";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Layer from "effect/Layer";
|
|
12
|
+
import * as Path from "effect/Path";
|
|
13
|
+
import { pathToFileURL } from "node:url";
|
|
14
|
+
import { ModuleLoadError } from "./errors.js";
|
|
15
|
+
const load = /*#__PURE__*/Effect.fnUntraced(function* (path) {
|
|
16
|
+
const pathService = yield* Path.Path;
|
|
17
|
+
const resolved = pathService.resolve(path);
|
|
18
|
+
return yield* Effect.tryPromise({
|
|
19
|
+
try: () => import(__rewriteRelativeImportExtension(pathToFileURL(resolved).href)),
|
|
20
|
+
catch: cause => moduleLoadError(resolved, cause)
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
/** @internal */
|
|
24
|
+
export class ModuleLoader extends /*#__PURE__*/Context.Service()("effect-bdd/cli/ModuleLoader") {
|
|
25
|
+
static Live = /*#__PURE__*/Layer.succeed(ModuleLoader, {
|
|
26
|
+
load
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const moduleLoadError = (path, cause) => {
|
|
30
|
+
const reason = causeMessage(cause);
|
|
31
|
+
const isTsLoaderFailure = reason.includes("Unknown file extension") && reason.includes(".ts");
|
|
32
|
+
return new ModuleLoadError({
|
|
33
|
+
path,
|
|
34
|
+
message: isTsLoaderFailure ? `Could not load TypeScript step module "${path}". Register a TypeScript loader when running on Node, for example: node --import tsx ./node_modules/.bin/effect-bdd` : `Could not load step module "${path}": ${reason}`,
|
|
35
|
+
cause
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const causeMessage = cause => typeof cause === "object" && cause !== null && "message" in cause && typeof cause.message === "string" ? cause.message : String(cause);
|
|
39
|
+
//# sourceMappingURL=moduleLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleLoader.js","names":["Context","Effect","Layer","Path","pathToFileURL","ModuleLoadError","load","fnUntraced","path","pathService","resolved","resolve","tryPromise","try","__rewriteRelativeImportExtension","href","catch","cause","moduleLoadError","ModuleLoader","Service","Live","succeed","reason","causeMessage","isTsLoaderFailure","includes","message","String"],"sources":["../../../src/internal/cli/moduleLoader.ts"],"sourcesContent":[null],"mappings":";;;;;;;;AAAA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,SAASC,aAAa,QAAQ,UAAU;AACxC,SAASC,eAAe,QAAQ,aAAa;AAE7C,MAAMC,IAAI,gBAAGL,MAAM,CAACM,UAAU,CAAC,WAAUC,IAAY;EACnD,MAAMC,WAAW,GAAG,OAAON,IAAI,CAACA,IAAI;EACpC,MAAMO,QAAQ,GAAGD,WAAW,CAACE,OAAO,CAACH,IAAI,CAAC;EAC1C,OAAO,OAAOP,MAAM,CAACW,UAAU,CAAC;IAC9BC,GAAG,EAAEA,CAAA,KAAM,MAAM,CAAAC,gCAAA,CAACV,aAAa,CAACM,QAAQ,CAAC,CAACK,IAAI,EAAqC;IACnFC,KAAK,EAAGC,KAAK,IAAKC,eAAe,CAACR,QAAQ,EAAEO,KAAK;GAClD,CAAC;AACJ,CAAC,CAAC;AAEF;AACA,OAAM,MAAOE,YAAa,sBAAQnB,OAAO,CAACoB,OAAO,EAE7C,CAAC,6BAA6B,CAAC;EACjC,OAAgBC,IAAI,gBAAGnB,KAAK,CAACoB,OAAO,CAACH,YAAY,EAAE;IACjDb;GACD,CAAC;;AAGJ,MAAMY,eAAe,GAAGA,CAACV,IAAY,EAAES,KAAc,KAAqB;EACxE,MAAMM,MAAM,GAAGC,YAAY,CAACP,KAAK,CAAC;EAClC,MAAMQ,iBAAiB,GAAGF,MAAM,CAACG,QAAQ,CAAC,wBAAwB,CAAC,IAAIH,MAAM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