@cucumber/cucumber 10.1.0 → 10.2.1
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/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/environment.d.ts +6 -1
- package/lib/api/environment.js +6 -1
- package/lib/api/environment.js.map +1 -1
- package/lib/api/formatters.d.ts +2 -2
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/index.d.ts +6 -2
- package/lib/api/index.js +4 -2
- package/lib/api/index.js.map +1 -1
- package/lib/api/load_configuration.d.ts +3 -3
- package/lib/api/load_configuration.js +7 -6
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.d.ts +4 -3
- package/lib/api/load_sources.js +5 -6
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.d.ts +4 -5
- package/lib/api/load_support.js +4 -6
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/run_cucumber.d.ts +5 -5
- package/lib/api/run_cucumber.js +16 -18
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/runtime.d.ts +2 -2
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/support.d.ts +2 -2
- package/lib/api/support.js.map +1 -1
- package/lib/api/types.d.ts +170 -26
- package/lib/api/types.js.map +1 -1
- package/lib/cli/helpers.d.ts +4 -4
- package/lib/cli/helpers.js.map +1 -1
- package/lib/configuration/check_schema.js +2 -2
- package/lib/configuration/check_schema.js.map +1 -1
- package/lib/configuration/types.d.ts +125 -9
- package/lib/configuration/types.js.map +1 -1
- package/lib/filter/types.d.ts +8 -0
- package/lib/filter/types.js.map +1 -1
- package/lib/formatter/builder.d.ts +3 -3
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/index.d.ts +3 -7
- package/lib/formatter/index.js.map +1 -1
- package/lib/index.d.ts +13 -5
- package/lib/index.js +16 -7
- package/lib/index.js.map +1 -1
- package/lib/publish/index.d.ts +1 -0
- package/lib/publish/index.js +15 -0
- package/lib/publish/index.js.map +1 -1
- package/lib/publish/publish_plugin.d.ts +1 -1
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/publish/types.d.ts +14 -0
- package/lib/{models/pickle_order.js → publish/types.js} +1 -1
- package/lib/publish/types.js.map +1 -0
- package/lib/runtime/assemble_test_cases.d.ts +2 -2
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/index.d.ts +2 -2
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +2 -2
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +2 -2
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/support_code_library_builder/index.d.ts +2 -2
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +1 -1
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/lib/wrapper.mjs +2 -1
- package/package.json +11 -6
- package/lib/models/pickle_order.d.ts +0 -1
- package/lib/models/pickle_order.js.map +0 -1
package/lib/api/types.d.ts
CHANGED
|
@@ -1,55 +1,84 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { Writable } from 'node:stream';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { PickleOrder } from '../models/pickle_order';
|
|
7
|
-
import { IRuntimeOptions } from '../runtime';
|
|
4
|
+
import { JsonObject } from 'type-fest';
|
|
5
|
+
import { IPublishConfig } from '../publish';
|
|
8
6
|
import { IConfiguration } from '../configuration';
|
|
7
|
+
import { IPickleOrder } from '../filter';
|
|
9
8
|
/**
|
|
9
|
+
* Options for {@link loadConfiguration}
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
12
|
export interface ILoadConfigurationOptions {
|
|
13
13
|
/**
|
|
14
|
-
* Path to load configuration file from
|
|
14
|
+
* Path to load configuration file from, or `false` to skip
|
|
15
|
+
* @default `cucumber.(json|yaml|yml|js|cjs|mjs)`
|
|
15
16
|
*/
|
|
16
|
-
file?: string;
|
|
17
|
+
file?: string | false;
|
|
17
18
|
/**
|
|
18
|
-
* Zero or more profile names from which to source configuration
|
|
19
|
+
* Zero or more profile names from which to source configuration in the file
|
|
20
|
+
* @remarks
|
|
21
|
+
* If omitted or empty, the `default` profile will be used.
|
|
19
22
|
*/
|
|
20
23
|
profiles?: string[];
|
|
21
24
|
/**
|
|
22
|
-
* Ad-hoc configuration options to be
|
|
25
|
+
* Ad-hoc configuration options to be merged over the top of whatever is
|
|
26
|
+
* loaded from the configuration file/profiles
|
|
23
27
|
*/
|
|
24
28
|
provided?: Partial<IConfiguration>;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
31
|
+
* Response from {@link loadConfiguration}
|
|
27
32
|
* @public
|
|
28
33
|
*/
|
|
29
34
|
export interface IResolvedConfiguration {
|
|
30
35
|
/**
|
|
31
|
-
* The final flat configuration object resolved from the configuration
|
|
36
|
+
* The final flat configuration object resolved from the configuration
|
|
37
|
+
* file/profiles plus any extra provided
|
|
32
38
|
*/
|
|
33
39
|
useConfiguration: IConfiguration;
|
|
34
40
|
/**
|
|
35
|
-
* The format that can be passed into
|
|
41
|
+
* The format that can be passed into {@link runCucumber}
|
|
36
42
|
*/
|
|
37
43
|
runConfiguration: IRunConfiguration;
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
46
|
+
* Options relating to sources (i.e. feature files) - where to load them from,
|
|
47
|
+
* how to interpret, filter and order them
|
|
40
48
|
* @public
|
|
41
49
|
*/
|
|
42
50
|
export interface ISourcesCoordinates {
|
|
51
|
+
/**
|
|
52
|
+
* Default Gherkin dialect
|
|
53
|
+
* @remarks
|
|
54
|
+
* Used if no dialect is specified in the feature file itself.
|
|
55
|
+
*/
|
|
43
56
|
defaultDialect: string;
|
|
57
|
+
/**
|
|
58
|
+
* Paths and/or glob expressions to feature files
|
|
59
|
+
*/
|
|
44
60
|
paths: string[];
|
|
61
|
+
/**
|
|
62
|
+
* Regular expressions of which scenario names should match one of to be run
|
|
63
|
+
*/
|
|
45
64
|
names: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Tag expression to filter which scenarios should be run
|
|
67
|
+
*/
|
|
46
68
|
tagExpression: string;
|
|
47
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Run in the order defined, or in a random order
|
|
71
|
+
*/
|
|
72
|
+
order: IPickleOrder;
|
|
48
73
|
}
|
|
49
74
|
/**
|
|
75
|
+
* A pickle that has been successfully compiled from a source
|
|
50
76
|
* @public
|
|
51
77
|
*/
|
|
52
78
|
export interface IPlannedPickle {
|
|
79
|
+
/**
|
|
80
|
+
* Name of the pickle (after parameter resolution)
|
|
81
|
+
*/
|
|
53
82
|
name: string;
|
|
54
83
|
uri: string;
|
|
55
84
|
location: {
|
|
@@ -58,6 +87,7 @@ export interface IPlannedPickle {
|
|
|
58
87
|
};
|
|
59
88
|
}
|
|
60
89
|
/**
|
|
90
|
+
* An error encountered when parsing a source
|
|
61
91
|
* @public
|
|
62
92
|
*/
|
|
63
93
|
export interface ISourcesError {
|
|
@@ -66,46 +96,133 @@ export interface ISourcesError {
|
|
|
66
96
|
line: number;
|
|
67
97
|
column?: number;
|
|
68
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Error message explaining what went wrong with the parse
|
|
101
|
+
*/
|
|
69
102
|
message: string;
|
|
70
103
|
}
|
|
71
104
|
/**
|
|
105
|
+
* Response from {@link loadSources}
|
|
72
106
|
* @public
|
|
73
107
|
*/
|
|
74
108
|
export interface ILoadSourcesResult {
|
|
109
|
+
/**
|
|
110
|
+
* Pickles that have been successfully compiled, in the order they would be
|
|
111
|
+
* run in
|
|
112
|
+
*/
|
|
75
113
|
plan: IPlannedPickle[];
|
|
114
|
+
/**
|
|
115
|
+
* Any errors encountered when parsing sources
|
|
116
|
+
*/
|
|
76
117
|
errors: ISourcesError[];
|
|
77
118
|
}
|
|
78
119
|
/**
|
|
120
|
+
* Options relating to user code (aka support code) - where to load it from and
|
|
121
|
+
* how to preprocess it
|
|
79
122
|
* @public
|
|
80
123
|
*/
|
|
81
124
|
export interface ISupportCodeCoordinates {
|
|
125
|
+
/**
|
|
126
|
+
* Names of transpilation modules to load, via `require()`
|
|
127
|
+
*/
|
|
82
128
|
requireModules: string[];
|
|
129
|
+
/**
|
|
130
|
+
* Paths and/or glob expressions of user code to load, via `require()`
|
|
131
|
+
*/
|
|
83
132
|
requirePaths: string[];
|
|
133
|
+
/**
|
|
134
|
+
* Paths and/or glob expressions of user code to load, via `import()`
|
|
135
|
+
*/
|
|
84
136
|
importPaths: string[];
|
|
85
137
|
}
|
|
86
138
|
/**
|
|
139
|
+
* Options for {@link loadSupport}
|
|
87
140
|
* @public
|
|
141
|
+
* @remarks
|
|
142
|
+
* A subset of {@link IRunConfiguration}
|
|
88
143
|
*/
|
|
89
144
|
export interface ILoadSupportOptions {
|
|
145
|
+
/**
|
|
146
|
+
* @remarks
|
|
147
|
+
* This is needed because the default support path locations are derived from
|
|
148
|
+
* feature file locations.
|
|
149
|
+
*/
|
|
90
150
|
sources: ISourcesCoordinates;
|
|
91
151
|
support: ISupportCodeCoordinates;
|
|
92
152
|
}
|
|
93
153
|
/**
|
|
154
|
+
* Options relating to behaviour when actually running tests
|
|
94
155
|
* @public
|
|
95
156
|
*/
|
|
96
|
-
export interface IRunOptionsRuntime
|
|
157
|
+
export interface IRunOptionsRuntime {
|
|
158
|
+
/**
|
|
159
|
+
* Perform a dry run, where a test run is prepared but nothing is executed
|
|
160
|
+
*/
|
|
161
|
+
dryRun: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Stop running tests when a test fails
|
|
164
|
+
*/
|
|
165
|
+
failFast: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Filter out stack frames from Cucumber's code when formatting stack traces
|
|
168
|
+
*/
|
|
169
|
+
filterStacktraces: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Run tests in parallel with the given number of worker processes
|
|
172
|
+
*/
|
|
97
173
|
parallel: number;
|
|
174
|
+
/**
|
|
175
|
+
* Retry failing tests up to the given number of times
|
|
176
|
+
*/
|
|
177
|
+
retry: number;
|
|
178
|
+
/**
|
|
179
|
+
* Tag expression to filter which scenarios can be retried
|
|
180
|
+
*/
|
|
181
|
+
retryTagFilter: string;
|
|
182
|
+
/**
|
|
183
|
+
* Fail the test run if there are pending steps
|
|
184
|
+
*/
|
|
185
|
+
strict: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Parameters to be passed to the World
|
|
188
|
+
* @remarks
|
|
189
|
+
* The value must be a JSON-serializable object.
|
|
190
|
+
*/
|
|
191
|
+
worldParameters: JsonObject;
|
|
98
192
|
}
|
|
99
193
|
/**
|
|
194
|
+
* Options relating to formatters - which ones to use, where to write their
|
|
195
|
+
* output, how they should behave
|
|
100
196
|
* @public
|
|
101
197
|
*/
|
|
102
198
|
export interface IRunOptionsFormats {
|
|
199
|
+
/**
|
|
200
|
+
* Name/path of the formatter to use for `stdout` output
|
|
201
|
+
*/
|
|
103
202
|
stdout: string;
|
|
203
|
+
/**
|
|
204
|
+
* Zero or more mappings of file output path (key) to name/path of the
|
|
205
|
+
* formatter to use (value)
|
|
206
|
+
* @example
|
|
207
|
+
* \{
|
|
208
|
+
* "./reports/cucumber.html": "html",
|
|
209
|
+
* "./reports/custom.txt": "./custom-formatter.js"
|
|
210
|
+
* \}
|
|
211
|
+
*/
|
|
104
212
|
files: Record<string, string>;
|
|
213
|
+
/**
|
|
214
|
+
* Options for report publication, or `false` to disable publication
|
|
215
|
+
*/
|
|
105
216
|
publish: IPublishConfig | false;
|
|
106
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Options to be provided to formatters
|
|
219
|
+
* @remarks
|
|
220
|
+
* The value must be a JSON-serializable object.
|
|
221
|
+
*/
|
|
222
|
+
options: JsonObject;
|
|
107
223
|
}
|
|
108
224
|
/**
|
|
225
|
+
* Structured configuration object suitable for passing to {@link runCucumber}
|
|
109
226
|
* @public
|
|
110
227
|
*/
|
|
111
228
|
export interface IRunConfiguration {
|
|
@@ -115,14 +232,32 @@ export interface IRunConfiguration {
|
|
|
115
232
|
formats: IRunOptionsFormats;
|
|
116
233
|
}
|
|
117
234
|
/**
|
|
235
|
+
* A collection of user-defined code and setup ("support code") that can be
|
|
236
|
+
* used for a test run
|
|
118
237
|
* @public
|
|
238
|
+
* @remarks
|
|
239
|
+
* This is mostly a marker interface. The actual instance is a complex object
|
|
240
|
+
* that you shouldn't interact with directly, but some functions return and/or
|
|
241
|
+
* accept it as a means of optimising a test workflow.
|
|
119
242
|
*/
|
|
120
|
-
export
|
|
243
|
+
export interface ISupportCodeLibrary {
|
|
244
|
+
readonly originalCoordinates: ISupportCodeCoordinates;
|
|
245
|
+
}
|
|
121
246
|
/**
|
|
247
|
+
* Either an actual {@link ISupportCodeLibrary | support code library}, or the
|
|
248
|
+
* {@link ISupportCodeCoordinates | coordinates} required to create and
|
|
249
|
+
* populate one
|
|
122
250
|
* @public
|
|
251
|
+
* @remarks
|
|
252
|
+
* This alias exists because {@link runCucumber} will accept an existing
|
|
253
|
+
* support code library in its options and thus avoid trying to load it again,
|
|
254
|
+
* improving performance and avoiding cache issues for use cases where multiple
|
|
255
|
+
* test runs happen within the same process. Note this is only useful in serial
|
|
256
|
+
* mode, as parallel workers will each load the support code themselves anyway.
|
|
123
257
|
*/
|
|
124
|
-
export type
|
|
258
|
+
export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
|
|
125
259
|
/**
|
|
260
|
+
* Options for {@link runCucumber}
|
|
126
261
|
* @public
|
|
127
262
|
*/
|
|
128
263
|
export interface IRunOptions {
|
|
@@ -132,44 +267,53 @@ export interface IRunOptions {
|
|
|
132
267
|
formats: IRunOptionsFormats;
|
|
133
268
|
}
|
|
134
269
|
/**
|
|
135
|
-
* Contextual data about the project environment
|
|
136
|
-
*
|
|
270
|
+
* Contextual data about the project environment
|
|
137
271
|
* @public
|
|
138
272
|
*/
|
|
139
273
|
export interface IRunEnvironment {
|
|
140
274
|
/**
|
|
141
|
-
* Working directory for the project
|
|
275
|
+
* Working directory for the project
|
|
276
|
+
* @default process.cwd()
|
|
142
277
|
*/
|
|
143
278
|
cwd?: string;
|
|
144
279
|
/**
|
|
145
|
-
* Writable stream where the test run's main output is written
|
|
280
|
+
* Writable stream where the test run's main formatter output is written
|
|
281
|
+
* @default process.stdout
|
|
146
282
|
*/
|
|
147
283
|
stdout?: Writable;
|
|
148
284
|
/**
|
|
149
|
-
* Writable stream where the test run's warning/error output is written
|
|
285
|
+
* Writable stream where the test run's warning/error output is written
|
|
286
|
+
* @default process.stderr
|
|
150
287
|
*/
|
|
151
288
|
stderr?: Writable;
|
|
152
289
|
/**
|
|
153
|
-
* Environment variables
|
|
290
|
+
* Environment variables
|
|
291
|
+
* @default process.env
|
|
154
292
|
*/
|
|
155
293
|
env?: NodeJS.ProcessEnv;
|
|
156
294
|
/**
|
|
157
|
-
* Whether debug logging
|
|
295
|
+
* Whether debug logging should be emitted to {@link IRunEnvironment.stderr}
|
|
296
|
+
* @default false
|
|
297
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}
|
|
158
298
|
*/
|
|
159
299
|
debug?: boolean;
|
|
160
300
|
}
|
|
161
301
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
302
|
+
* Response from {@link runCucumber}
|
|
164
303
|
* @public
|
|
165
304
|
*/
|
|
166
305
|
export interface IRunResult {
|
|
167
306
|
/**
|
|
168
|
-
* Whether the test run was overall successful
|
|
307
|
+
* Whether the test run was overall successful
|
|
308
|
+
* @remarks
|
|
309
|
+
* The exact meaning can vary based on the `strict` configuration option.
|
|
169
310
|
*/
|
|
170
311
|
success: boolean;
|
|
171
312
|
/**
|
|
172
|
-
* The support code library that was used in the test run
|
|
313
|
+
* The support code library that was used in the test run
|
|
314
|
+
* @remarks
|
|
315
|
+
* This can be reused in subsequent {@link runCucumber} calls,
|
|
316
|
+
* see {@link ISupportCodeCoordinatesOrLibrary}
|
|
173
317
|
*/
|
|
174
318
|
support: ISupportCodeLibrary;
|
|
175
319
|
}
|
package/lib/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\nimport {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\nimport { JsonObject } from 'type-fest'\nimport { IPublishConfig } from '../publish'\nimport { IConfiguration } from '../configuration'\nimport { IPickleOrder } from '../filter'\n\n/**\n * Options for {@link loadConfiguration}\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from, or `false` to skip\n * @default `cucumber.(json|yaml|yml|js|cjs|mjs)`\n */\n file?: string | false\n /**\n * Zero or more profile names from which to source configuration in the file\n * @remarks\n * If omitted or empty, the `default` profile will be used.\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be merged over the top of whatever is\n * loaded from the configuration file/profiles\n */\n provided?: Partial<IConfiguration>\n}\n\n/**\n * Response from {@link loadConfiguration}\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration\n * file/profiles plus any extra provided\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into {@link runCucumber}\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * Options relating to sources (i.e. feature files) - where to load them from,\n * how to interpret, filter and order them\n * @public\n */\nexport interface ISourcesCoordinates {\n /**\n * Default Gherkin dialect\n * @remarks\n * Used if no dialect is specified in the feature file itself.\n */\n defaultDialect: string\n /**\n * Paths and/or glob expressions to feature files\n */\n paths: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n */\n names: string[]\n /**\n * Tag expression to filter which scenarios should be run\n */\n tagExpression: string\n /**\n * Run in the order defined, or in a random order\n */\n order: IPickleOrder\n}\n\n/**\n * A pickle that has been successfully compiled from a source\n * @public\n */\nexport interface IPlannedPickle {\n /**\n * Name of the pickle (after parameter resolution)\n */\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * An error encountered when parsing a source\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n /**\n * Error message explaining what went wrong with the parse\n */\n message: string\n}\n\n/**\n * Response from {@link loadSources}\n * @public\n */\nexport interface ILoadSourcesResult {\n /**\n * Pickles that have been successfully compiled, in the order they would be\n * run in\n */\n plan: IPlannedPickle[]\n /**\n * Any errors encountered when parsing sources\n */\n errors: ISourcesError[]\n}\n\n/**\n * Options relating to user code (aka support code) - where to load it from and\n * how to preprocess it\n * @public\n */\nexport interface ISupportCodeCoordinates {\n /**\n * Names of transpilation modules to load, via `require()`\n */\n requireModules: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `require()`\n */\n requirePaths: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `import()`\n */\n importPaths: string[]\n}\n\n/**\n * Options for {@link loadSupport}\n * @public\n * @remarks\n * A subset of {@link IRunConfiguration}\n */\nexport interface ILoadSupportOptions {\n /**\n * @remarks\n * This is needed because the default support path locations are derived from\n * feature file locations.\n */\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n}\n\n/**\n * Options relating to behaviour when actually running tests\n * @public\n */\nexport interface IRunOptionsRuntime {\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n */\n dryRun: boolean\n /**\n * Stop running tests when a test fails\n */\n failFast: boolean\n /**\n * Filter out stack frames from Cucumber's code when formatting stack traces\n */\n filterStacktraces: boolean\n /**\n * Run tests in parallel with the given number of worker processes\n */\n parallel: number\n /**\n * Retry failing tests up to the given number of times\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n */\n strict: boolean\n /**\n * Parameters to be passed to the World\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n\n/**\n * Options relating to formatters - which ones to use, where to write their\n * output, how they should behave\n * @public\n */\nexport interface IRunOptionsFormats {\n /**\n * Name/path of the formatter to use for `stdout` output\n */\n stdout: string\n /**\n * Zero or more mappings of file output path (key) to name/path of the\n * formatter to use (value)\n * @example\n * \\{\n * \"./reports/cucumber.html\": \"html\",\n * \"./reports/custom.txt\": \"./custom-formatter.js\"\n * \\}\n */\n files: Record<string, string>\n /**\n * Options for report publication, or `false` to disable publication\n */\n publish: IPublishConfig | false\n /**\n * Options to be provided to formatters\n * @remarks\n * The value must be a JSON-serializable object.\n */\n options: JsonObject\n}\n\n/**\n * Structured configuration object suitable for passing to {@link runCucumber}\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * A collection of user-defined code and setup (\"support code\") that can be\n * used for a test run\n * @public\n * @remarks\n * This is mostly a marker interface. The actual instance is a complex object\n * that you shouldn't interact with directly, but some functions return and/or\n * accept it as a means of optimising a test workflow.\n */\nexport interface ISupportCodeLibrary {\n readonly originalCoordinates: ISupportCodeCoordinates\n}\n\n/**\n * Either an actual {@link ISupportCodeLibrary | support code library}, or the\n * {@link ISupportCodeCoordinates | coordinates} required to create and\n * populate one\n * @public\n * @remarks\n * This alias exists because {@link runCucumber} will accept an existing\n * support code library in its options and thus avoid trying to load it again,\n * improving performance and avoiding cache issues for use cases where multiple\n * test runs happen within the same process. Note this is only useful in serial\n * mode, as parallel workers will each load the support code themselves anyway.\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | ISupportCodeCoordinates\n | ISupportCodeLibrary\n\n/**\n * Options for {@link runCucumber}\n * @public\n */\nexport interface IRunOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinatesOrLibrary\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * Contextual data about the project environment\n * @public\n */\nexport interface IRunEnvironment {\n /**\n * Working directory for the project\n * @default process.cwd()\n */\n cwd?: string\n /**\n * Writable stream where the test run's main formatter output is written\n * @default process.stdout\n */\n stdout?: Writable\n /**\n * Writable stream where the test run's warning/error output is written\n * @default process.stderr\n */\n stderr?: Writable\n /**\n * Environment variables\n * @default process.env\n */\n env?: NodeJS.ProcessEnv\n /**\n * Whether debug logging should be emitted to {@link IRunEnvironment.stderr}\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}\n */\n debug?: boolean\n}\n\n/**\n * Response from {@link runCucumber}\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful\n * @remarks\n * The exact meaning can vary based on the `strict` configuration option.\n */\n success: boolean\n /**\n * The support code library that was used in the test run\n * @remarks\n * This can be reused in subsequent {@link runCucumber} calls,\n * see {@link ISupportCodeCoordinatesOrLibrary}\n */\n support: ISupportCodeLibrary\n}\n"]}
|
package/lib/cli/helpers.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ import { Readable } from 'node:stream';
|
|
|
6
6
|
import { IdGenerator } from '@cucumber/messages';
|
|
7
7
|
import { EventDataCollector } from '../formatter/helpers';
|
|
8
8
|
import PickleFilter from '../pickle_filter';
|
|
9
|
-
import {
|
|
10
|
-
import { PickleOrder } from '../models/pickle_order';
|
|
9
|
+
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
11
10
|
import { ILogger } from '../logger';
|
|
11
|
+
import { IPickleOrder } from '../filter';
|
|
12
12
|
interface IParseGherkinMessageStreamRequest {
|
|
13
13
|
cwd?: string;
|
|
14
14
|
eventBroadcaster: EventEmitter;
|
|
@@ -27,11 +27,11 @@ interface IParseGherkinMessageStreamRequest {
|
|
|
27
27
|
* @param pickleFilter
|
|
28
28
|
*/
|
|
29
29
|
export declare function parseGherkinMessageStream({ eventBroadcaster, eventDataCollector, gherkinMessageStream, order, pickleFilter, }: IParseGherkinMessageStreamRequest): Promise<string[]>;
|
|
30
|
-
export declare function orderPickles<T = string>(pickleIds: T[], order:
|
|
30
|
+
export declare function orderPickles<T = string>(pickleIds: T[], order: IPickleOrder, logger: ILogger): void;
|
|
31
31
|
export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv): Promise<void>;
|
|
32
32
|
export declare function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }: {
|
|
33
33
|
eventBroadcaster: EventEmitter;
|
|
34
|
-
supportCodeLibrary:
|
|
34
|
+
supportCodeLibrary: SupportCodeLibrary;
|
|
35
35
|
newId: IdGenerator.NewId;
|
|
36
36
|
}): void;
|
|
37
37
|
export {};
|
package/lib/cli/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,sDAAwB;AACxB,gFAA0C;AAC1C,6DAA8C;AAE9C,8EAA0D;AAC1D,oDAAgD;AAOhD,wCAAoC;AAapC;;;;;;;;GAQG;AACI,KAAK,UAAU,yBAAyB,CAAC,EAC9C,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,EACL,YAAY,GACsB;IAClC,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,QAA2B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CAAC;AAED,SAAgB,uBAAuB,CAAC,EACtC,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GAKN;IACC,kBAAkB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACjE,mBAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Readable } from 'node:stream'\nimport os from 'node:os'\nimport shuffle from 'knuth-shuffle-seeded'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { doesHaveValue } from '../value_checker'\nimport { EventDataCollector } from '../formatter/helpers'\nimport PickleFilter from '../pickle_filter'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { PickleOrder } from '../models/pickle_order'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\nimport { ILineAndUri } from '../types'\n\ninterface IParseGherkinMessageStreamRequest {\n cwd?: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\n\n/**\n * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids\n *\n * @param eventBroadcaster\n * @param eventDataCollector\n * @param gherkinMessageStream\n * @param order\n * @param pickleFilter\n */\nexport async function parseGherkinMessageStream({\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickles(result, order, console)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: PickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = splitOrder(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\n}\n\nfunction splitOrder(order: string) {\n if (!order.includes(':')) {\n return [order, '']\n }\n return order.split(':')\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv\n): Promise<void> {\n const meta: messages.Meta = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nconst makeSourceReference = (source: ILineAndUri) => ({\n uri: source.uri,\n location: {\n line: source.line,\n },\n})\n\nfunction emitParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (parameterType.builtin) {\n continue\n }\n const source =\n supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType)\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n sourceReference: makeSourceReference(source),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: makeSourceReference(stepDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n name: testCaseHookDefinition.name,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: makeSourceReference(testCaseHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: makeSourceReference(testRunHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: ISupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,sDAAwB;AACxB,gFAA0C;AAC1C,6DAA8C;AAE9C,8EAA0D;AAC1D,oDAAgD;AAMhD,wCAAoC;AAcpC;;;;;;;;GAQG;AACI,KAAK,UAAU,yBAAyB,CAAC,EAC9C,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,EACL,YAAY,GACsB;IAClC,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,QAA2B,EAAE,EAAE;YAC9D,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;YAC3C,IAAI,IAAA,6BAAa,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kB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACjE,mBAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Readable } from 'node:stream'\nimport os from 'node:os'\nimport shuffle from 'knuth-shuffle-seeded'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { doesHaveValue } from '../value_checker'\nimport { EventDataCollector } from '../formatter/helpers'\nimport PickleFilter from '../pickle_filter'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\nimport { ILineAndUri } from '../types'\nimport { IPickleOrder } from '../filter'\n\ninterface IParseGherkinMessageStreamRequest {\n cwd?: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\n\n/**\n * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids\n *\n * @param eventBroadcaster\n * @param eventDataCollector\n * @param gherkinMessageStream\n * @param order\n * @param pickleFilter\n */\nexport async function parseGherkinMessageStream({\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickles(result, order as IPickleOrder, console)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: IPickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = splitOrder(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\n}\n\nfunction splitOrder(order: string) {\n if (!order.includes(':')) {\n return [order, '']\n }\n return order.split(':')\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv\n): Promise<void> {\n const meta: messages.Meta = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nconst makeSourceReference = (source: ILineAndUri) => ({\n uri: source.uri,\n location: {\n line: source.line,\n },\n})\n\nfunction emitParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (parameterType.builtin) {\n continue\n }\n const source =\n supportCodeLibrary.parameterTypeRegistry.lookupSource(parameterType)\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n sourceReference: makeSourceReference(source),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: makeSourceReference(stepDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n name: testCaseHookDefinition.name,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: makeSourceReference(testCaseHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: SupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: makeSourceReference(testRunHookDefinition),\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: SupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
|
@@ -34,13 +34,13 @@ const schema = yup.object().shape({
|
|
|
34
34
|
format: yup
|
|
35
35
|
.array()
|
|
36
36
|
.of(yup.lazy((val) => Array.isArray(val)
|
|
37
|
-
? yup.array().of(yup.string()).min(
|
|
37
|
+
? yup.array().of(yup.string()).min(1).max(2)
|
|
38
38
|
: yup.string())),
|
|
39
39
|
formatOptions: yup.object(),
|
|
40
40
|
import: yup.array().of(yup.string()),
|
|
41
41
|
language: yup.string().oneOf(Object.keys(gherkin_1.dialects)),
|
|
42
42
|
name: yup.array().of(yup.string()),
|
|
43
|
-
order: yup.string().
|
|
43
|
+
order: yup.string().matches(/^random:.*|random|defined$/),
|
|
44
44
|
paths: yup.array().of(yup.string()),
|
|
45
45
|
parallel: yup.number().integer().min(0),
|
|
46
46
|
publish: yup.boolean(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check_schema.js","sourceRoot":"","sources":["../../src/configuration/check_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA0B;AAC1B,+CAA4C;AAG5C,MAAM,MAAM,GAAG,GAAG,CAAC,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,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC3C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE;IAC5B,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE;IACrB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE;IAClB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE;CAC9B,CAAC,CAAA;AAEF,SAAgB,WAAW,CAAC,aAAkB;IAC5C,OAAO,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE;QACxC,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,IAAI;KACnB,CAA4B,CAAA;AAC/B,CAAC;AAND,kCAMC","sourcesContent":["import * as yup from 'yup'\nimport { dialects } from '@cucumber/gherkin'\nimport { IConfiguration } from './types'\n\nconst schema = yup.object().shape({\n backtrace: yup.boolean(),\n dryRun: yup.boolean(),\n exit: yup.boolean(),\n failFast: yup.boolean(),\n format: yup\n .array()\n .of(\n yup.lazy((val) =>\n Array.isArray(val)\n ? yup.array().of(yup.string()).min(1).max(2)\n : yup.string()\n )\n ),\n formatOptions: yup.object(),\n import: yup.array().of(yup.string()),\n language: yup.string().oneOf(Object.keys(dialects)),\n name: yup.array().of(yup.string()),\n order: yup.string().matches(/^random:.*|random|defined$/),\n paths: yup.array().of(yup.string()),\n parallel: yup.number().integer().min(0),\n publish: yup.boolean(),\n publishQuiet: yup.boolean(),\n require: yup.array().of(yup.string()),\n requireModule: yup.array().of(yup.string()),\n retry: yup.number().integer().min(0),\n retryTagFilter: yup.string(),\n strict: yup.boolean(),\n tags: yup.string(),\n worldParameters: yup.object(),\n})\n\nexport function checkSchema(configuration: any): Partial<IConfiguration> {\n return schema.validateSync(configuration, {\n abortEarly: false,\n strict: true,\n stripUnknown: true,\n }) as Partial<IConfiguration>\n}\n"]}
|
|
@@ -1,31 +1,147 @@
|
|
|
1
1
|
import { JsonObject } from 'type-fest';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { IPickleOrder } from '../filter';
|
|
3
|
+
/**
|
|
4
|
+
* User-defined configuration
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
5
8
|
export interface IConfiguration {
|
|
9
|
+
/**
|
|
10
|
+
* Paths to where your feature files are
|
|
11
|
+
* @default []
|
|
12
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-features}
|
|
13
|
+
*/
|
|
14
|
+
paths: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Show the full backtrace for errors
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
6
19
|
backtrace: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Perform a dry run, where a test run is prepared but nothing is executed
|
|
22
|
+
* @default false
|
|
23
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/dry_run.md}
|
|
24
|
+
*/
|
|
7
25
|
dryRun: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Explicitly call `process.exit()` after the test run
|
|
28
|
+
* @default false
|
|
29
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#exiting}
|
|
30
|
+
* @remarks
|
|
31
|
+
* This option is only used by the CLI.
|
|
32
|
+
*/
|
|
8
33
|
forceExit: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Stop running tests when a test fails
|
|
36
|
+
* @default false
|
|
37
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/fail_fast.md}
|
|
38
|
+
*/
|
|
9
39
|
failFast: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Name/path and (optionally) output file path of each formatter to use
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* [
|
|
45
|
+
* "\@cucumber/pretty-formatter",
|
|
46
|
+
* ["html", "./reports/cucumber.html"],
|
|
47
|
+
* ["./custom-formatter.js", "./reports/custom.txt"]
|
|
48
|
+
* ]
|
|
49
|
+
* @default []
|
|
50
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md}
|
|
51
|
+
* @remarks
|
|
52
|
+
* Each item has one or two values. The first (required) identifies the
|
|
53
|
+
* formatter to be used. The second (optional) specifies where the output
|
|
54
|
+
* should be written.
|
|
55
|
+
*/
|
|
56
|
+
format: Array<string | [string, string?]>;
|
|
57
|
+
/**
|
|
58
|
+
* Options to be provided to formatters
|
|
59
|
+
* @default \{\}
|
|
60
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#options}
|
|
61
|
+
* @remarks
|
|
62
|
+
* The value must be a JSON-serializable object.
|
|
63
|
+
*/
|
|
64
|
+
formatOptions: JsonObject;
|
|
65
|
+
/**
|
|
66
|
+
* Paths to where your support code is
|
|
67
|
+
* @default []
|
|
68
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}
|
|
69
|
+
*/
|
|
12
70
|
import: string[];
|
|
71
|
+
/**
|
|
72
|
+
* Default language for your feature files
|
|
73
|
+
* @default "en"
|
|
74
|
+
*/
|
|
13
75
|
language: string;
|
|
76
|
+
/**
|
|
77
|
+
* Regular expressions of which scenario names should match one of to be run
|
|
78
|
+
* @default []
|
|
79
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#names}
|
|
80
|
+
*/
|
|
14
81
|
name: string[];
|
|
15
|
-
|
|
16
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Run in the order defined, or in a random order
|
|
84
|
+
* @default "defined"
|
|
85
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#order}
|
|
86
|
+
*/
|
|
87
|
+
order: IPickleOrder;
|
|
88
|
+
/**
|
|
89
|
+
* Run tests in parallel with the given number of worker processes
|
|
90
|
+
* @default 0
|
|
91
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md}
|
|
92
|
+
*/
|
|
17
93
|
parallel: number;
|
|
94
|
+
/**
|
|
95
|
+
* Publish a report of your test run to https://reports.cucumber.io/
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
18
98
|
publish: boolean;
|
|
19
99
|
/**
|
|
20
|
-
* @deprecated no longer needed
|
|
100
|
+
* @deprecated no longer needed
|
|
101
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md}
|
|
21
102
|
*/
|
|
22
103
|
publishQuiet: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Paths to where your support code is, for CommonJS
|
|
106
|
+
* @default []
|
|
107
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}
|
|
108
|
+
*/
|
|
23
109
|
require: string[];
|
|
110
|
+
/**
|
|
111
|
+
* Names of transpilation modules to load, via `require()`
|
|
112
|
+
* @default []
|
|
113
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md}
|
|
114
|
+
*/
|
|
24
115
|
requireModule: string[];
|
|
116
|
+
/**
|
|
117
|
+
* Retry failing tests up to the given number of times
|
|
118
|
+
* @default 0
|
|
119
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}
|
|
120
|
+
*/
|
|
25
121
|
retry: number;
|
|
122
|
+
/**
|
|
123
|
+
* Tag expression to filter which scenarios can be retried
|
|
124
|
+
* @default ""
|
|
125
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}
|
|
126
|
+
*/
|
|
26
127
|
retryTagFilter: string;
|
|
128
|
+
/**
|
|
129
|
+
* Fail the test run if there are pending steps
|
|
130
|
+
* @default true
|
|
131
|
+
*/
|
|
27
132
|
strict: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Tag expression to filter which scenarios should be run
|
|
135
|
+
* @default ""
|
|
136
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags}
|
|
137
|
+
*/
|
|
28
138
|
tags: string;
|
|
139
|
+
/**
|
|
140
|
+
* Parameters to be passed to your World
|
|
141
|
+
* @default \{\}
|
|
142
|
+
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md}
|
|
143
|
+
* @remarks
|
|
144
|
+
* The value must be a JSON-serializable object.
|
|
145
|
+
*/
|
|
29
146
|
worldParameters: JsonObject;
|
|
30
147
|
}
|
|
31
|
-
export {};
|