@cucumber/cucumber 8.0.0-rc.2 → 8.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -51
- package/api/index.d.ts +6 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +64 -0
- package/lib/api/convert_configuration.js.map +1 -0
- package/lib/api/environment.d.ts +2 -0
- package/lib/api/environment.js +13 -0
- package/lib/api/environment.js.map +1 -0
- package/lib/{run → api}/formatters.d.ts +5 -3
- package/lib/{run → api}/formatters.js +13 -17
- package/lib/api/formatters.js.map +1 -0
- package/lib/api/gherkin.d.ts +21 -0
- package/lib/api/gherkin.js +65 -0
- package/lib/api/gherkin.js.map +1 -0
- package/lib/api/index.d.ts +11 -0
- package/lib/{run → api}/index.js +10 -1
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +32 -0
- package/lib/api/load_configuration.js.map +1 -0
- package/lib/api/load_sources.d.ts +9 -0
- package/lib/api/load_sources.js +53 -0
- package/lib/api/load_sources.js.map +1 -0
- package/lib/api/load_support.d.ts +10 -0
- package/lib/api/load_support.js +28 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +7 -0
- package/lib/{run → api}/paths.js +25 -9
- package/lib/api/paths.js.map +1 -0
- package/lib/api/run_cucumber.d.ts +11 -0
- package/lib/api/run_cucumber.js +108 -0
- package/lib/api/run_cucumber.js.map +1 -0
- package/lib/{run → api}/runtime.d.ts +8 -7
- package/lib/api/runtime.js +36 -0
- package/lib/api/runtime.js.map +1 -0
- package/lib/{run → api}/support.d.ts +4 -3
- package/lib/{run → api}/support.js +5 -10
- package/lib/api/support.js.map +1 -0
- package/lib/api/types.d.ts +168 -0
- package/lib/{run → api}/types.js +0 -0
- package/lib/api/types.js.map +1 -0
- package/lib/api/wrapper.mjs +6 -0
- package/lib/cli/helpers.d.ts +16 -11
- package/lib/cli/helpers.js +19 -29
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/index.d.ts +3 -1
- package/lib/cli/index.js +35 -19
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/publish_banner.js +6 -6
- package/lib/cli/publish_banner.js.map +1 -1
- package/lib/cli/run.js +12 -3
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.d.ts +7 -0
- package/lib/cli/validate_node_engine_version.js +20 -0
- package/lib/cli/validate_node_engine_version.js.map +1 -0
- package/lib/configuration/argv_parser.d.ts +20 -0
- package/lib/{cli → configuration}/argv_parser.js +44 -45
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +56 -0
- package/lib/configuration/check_schema.js.map +1 -0
- package/lib/configuration/default_configuration.d.ts +2 -0
- package/lib/configuration/default_configuration.js +27 -0
- package/lib/configuration/default_configuration.js.map +1 -0
- package/lib/configuration/from_file.d.ts +2 -0
- package/lib/configuration/from_file.js +68 -0
- package/lib/configuration/from_file.js.map +1 -0
- package/lib/configuration/helpers.d.ts +1 -0
- package/lib/configuration/helpers.js +11 -0
- package/lib/configuration/helpers.js.map +1 -0
- package/lib/configuration/index.d.ts +6 -0
- package/lib/configuration/index.js +11 -0
- package/lib/configuration/index.js.map +1 -1
- package/lib/configuration/locate_file.d.ts +1 -0
- package/lib/configuration/locate_file.js +19 -0
- package/lib/configuration/locate_file.js.map +1 -0
- package/lib/configuration/merge_configurations.d.ts +2 -0
- package/lib/configuration/merge_configurations.js +48 -0
- package/lib/configuration/merge_configurations.js.map +1 -0
- package/lib/configuration/option_splitter.d.ts +3 -0
- package/lib/{cli → configuration}/option_splitter.js +2 -2
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +24 -28
- package/lib/configuration/types.js.map +1 -1
- package/lib/configuration/validate_configuration.d.ts +2 -0
- package/lib/configuration/validate_configuration.js +10 -0
- package/lib/configuration/validate_configuration.js.map +1 -0
- package/lib/formatter/builder.d.ts +2 -3
- package/lib/formatter/builder.js +8 -1
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.js +15 -16
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js +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 +9 -8
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +1 -2
- package/lib/formatter/helpers/test_case_attempt_parser.js +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.d.ts +1 -2
- package/lib/formatter/helpers/usage_helpers/index.js +3 -3
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/index.d.ts +14 -2
- package/lib/formatter/index.js +2 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.js +1 -1
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +0 -1
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/summary_formatter.js +1 -1
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +0 -1
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js +0 -1
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/models/pickle_order.d.ts +1 -0
- package/lib/models/pickle_order.js +3 -0
- package/lib/models/pickle_order.js.map +1 -0
- package/lib/runtime/index.d.ts +3 -5
- package/lib/runtime/index.js +7 -36
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +3 -2
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +27 -8
- package/lib/runtime/parallel/coordinator.js +66 -19
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +2 -4
- package/lib/runtime/parallel/worker.js +11 -34
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.d.ts +3 -0
- package/lib/runtime/run_test_run_hooks.js +28 -0
- package/lib/runtime/run_test_run_hooks.js.map +1 -0
- package/lib/support_code_library_builder/index.d.ts +4 -2
- package/lib/support_code_library_builder/index.js +25 -2
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
- package/lib/support_code_library_builder/types.d.ts +9 -0
- 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 +4 -0
- package/package.json +47 -28
- package/lib/cli/argv_parser.d.ts +0 -51
- package/lib/cli/argv_parser.js.map +0 -1
- package/lib/cli/configuration_builder.d.ts +0 -5
- package/lib/cli/configuration_builder.js +0 -71
- package/lib/cli/configuration_builder.js.map +0 -1
- package/lib/cli/option_splitter.d.ts +0 -4
- package/lib/cli/option_splitter.js.map +0 -1
- package/lib/cli/profile_loader.d.ts +0 -7
- package/lib/cli/profile_loader.js +0 -49
- package/lib/cli/profile_loader.js.map +0 -1
- package/lib/run/formatters.js.map +0 -1
- package/lib/run/index.d.ts +0 -2
- package/lib/run/index.js.map +0 -1
- package/lib/run/paths.d.ts +0 -6
- package/lib/run/paths.js.map +0 -1
- package/lib/run/runCucumber.d.ts +0 -3
- package/lib/run/runCucumber.js +0 -88
- package/lib/run/runCucumber.js.map +0 -1
- package/lib/run/runtime.js +0 -58
- package/lib/run/runtime.js.map +0 -1
- package/lib/run/support.js.map +0 -1
- package/lib/run/types.d.ts +0 -12
- package/lib/run/types.js.map +0 -1
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"gherkin",
|
|
9
9
|
"tests"
|
|
10
10
|
],
|
|
11
|
-
"version": "8.0.0-rc.
|
|
11
|
+
"version": "8.0.0-rc.3",
|
|
12
12
|
"homepage": "https://github.com/cucumber/cucumber-js",
|
|
13
13
|
"author": "Julien Biezemans <jb@jbpros.com>",
|
|
14
14
|
"contributors": [
|
|
@@ -125,6 +125,7 @@
|
|
|
125
125
|
"Paul Jensen <paulbjensen@gmail.com>",
|
|
126
126
|
"Paul Shannon (https://devpaul.com)",
|
|
127
127
|
"please-rewrite <please-rewrite@users.noreply.github.com>",
|
|
128
|
+
"plocket <plocket@users.noreply.github.com>",
|
|
128
129
|
"Renier Morales <renier@morales-rodriguez.net>",
|
|
129
130
|
"Rick Lee-Morlang <rick@lee-morlang.com>",
|
|
130
131
|
"RolandArgos <roland.ormrod@argos.co.uk>",
|
|
@@ -172,7 +173,13 @@
|
|
|
172
173
|
"exports": {
|
|
173
174
|
".": {
|
|
174
175
|
"import": "./lib/wrapper.mjs",
|
|
175
|
-
"require": "./lib/index.js"
|
|
176
|
+
"require": "./lib/index.js",
|
|
177
|
+
"types": "./lib/index.d.ts"
|
|
178
|
+
},
|
|
179
|
+
"./api": {
|
|
180
|
+
"import": "./lib/api/wrapper.mjs",
|
|
181
|
+
"require": "./lib/api/index.js",
|
|
182
|
+
"types": "./lib/api/index.d.ts"
|
|
176
183
|
},
|
|
177
184
|
"./lib/*": {
|
|
178
185
|
"require": "./lib/*.js"
|
|
@@ -181,22 +188,23 @@
|
|
|
181
188
|
},
|
|
182
189
|
"types": "./lib/index.d.ts",
|
|
183
190
|
"engines": {
|
|
184
|
-
"node": ">=
|
|
191
|
+
"node": "12 || 14 || >=16"
|
|
185
192
|
},
|
|
186
193
|
"dependencies": {
|
|
187
194
|
"@cspotcode/source-map-support": "^0.7.0",
|
|
188
|
-
"@cucumber/ci-environment": "
|
|
189
|
-
"@cucumber/cucumber-expressions": "
|
|
195
|
+
"@cucumber/ci-environment": "9.0.0",
|
|
196
|
+
"@cucumber/cucumber-expressions": "15.0.2",
|
|
190
197
|
"@cucumber/gherkin": "22.0.0",
|
|
191
198
|
"@cucumber/gherkin-streams": "4.0.0",
|
|
192
|
-
"@cucumber/
|
|
199
|
+
"@cucumber/gherkin-utils": "^7.0.0",
|
|
200
|
+
"@cucumber/html-formatter": "18.0.0",
|
|
193
201
|
"@cucumber/messages": "17.1.1",
|
|
194
202
|
"@cucumber/tag-expressions": "4.1.0",
|
|
195
203
|
"assertion-error-formatter": "^3.0.0",
|
|
196
204
|
"capital-case": "^1.0.4",
|
|
205
|
+
"chalk": "^4.1.2",
|
|
197
206
|
"cli-table3": "0.6.1",
|
|
198
|
-
"
|
|
199
|
-
"commander": "^8.0.0",
|
|
207
|
+
"commander": "^9.0.0",
|
|
200
208
|
"duration": "^0.2.2",
|
|
201
209
|
"durations": "^3.4.2",
|
|
202
210
|
"figures": "^3.2.0",
|
|
@@ -204,30 +212,38 @@
|
|
|
204
212
|
"indent-string": "^4.0.0",
|
|
205
213
|
"is-stream": "^2.0.0",
|
|
206
214
|
"knuth-shuffle-seeded": "^1.0.6",
|
|
215
|
+
"lodash.merge": "^4.6.2",
|
|
216
|
+
"lodash.mergewith": "^4.6.2",
|
|
207
217
|
"mz": "^2.7.0",
|
|
208
218
|
"progress": "^2.0.3",
|
|
209
219
|
"resolve": "^1.19.0",
|
|
210
220
|
"resolve-pkg": "^2.0.0",
|
|
221
|
+
"semver": "7.3.5",
|
|
211
222
|
"stack-chain": "^2.0.0",
|
|
212
223
|
"string-argv": "^0.3.1",
|
|
213
224
|
"tmp": "^0.2.1",
|
|
214
225
|
"util-arity": "^1.1.0",
|
|
215
|
-
"verror": "^1.10.0"
|
|
226
|
+
"verror": "^1.10.0",
|
|
227
|
+
"yup": "^0.32.11"
|
|
216
228
|
},
|
|
217
229
|
"devDependencies": {
|
|
218
230
|
"@cucumber/compatibility-kit": "9.1.2",
|
|
219
231
|
"@cucumber/message-streams": "3.0.0",
|
|
220
232
|
"@cucumber/query": "11.0.0",
|
|
221
|
-
"@
|
|
233
|
+
"@microsoft/api-documenter": "^7.15.3",
|
|
234
|
+
"@microsoft/api-extractor": "^7.19.4",
|
|
235
|
+
"@sinonjs/fake-timers": "9.1.0",
|
|
222
236
|
"@types/chai": "4.3.0",
|
|
223
237
|
"@types/dirty-chai": "2.0.2",
|
|
224
238
|
"@types/express": "4.17.13",
|
|
225
239
|
"@types/fs-extra": "9.0.13",
|
|
226
240
|
"@types/glob": "7.2.0",
|
|
227
|
-
"@types/
|
|
241
|
+
"@types/lodash.merge": "^4.6.6",
|
|
242
|
+
"@types/lodash.mergewith": "^4.6.6",
|
|
243
|
+
"@types/mocha": "9.1.0",
|
|
228
244
|
"@types/mustache": "4.1.2",
|
|
229
245
|
"@types/mz": "2.7.4",
|
|
230
|
-
"@types/node": "16.11.
|
|
246
|
+
"@types/node": "16.11.26",
|
|
231
247
|
"@types/progress": "2.0.5",
|
|
232
248
|
"@types/resolve": "1.20.1",
|
|
233
249
|
"@types/semver": "7.3.9",
|
|
@@ -236,40 +252,42 @@
|
|
|
236
252
|
"@types/stream-buffers": "3.0.4",
|
|
237
253
|
"@types/tmp": "0.2.3",
|
|
238
254
|
"@types/verror": "1.10.5",
|
|
239
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
240
|
-
"@typescript-eslint/parser": "5.
|
|
241
|
-
"chai": "4.3.
|
|
255
|
+
"@typescript-eslint/eslint-plugin": "5.13.0",
|
|
256
|
+
"@typescript-eslint/parser": "5.13.0",
|
|
257
|
+
"chai": "4.3.6",
|
|
242
258
|
"chai-exclude": "2.1.0",
|
|
243
259
|
"coffeescript": "2.6.1",
|
|
244
260
|
"dependency-lint": "7.1.0",
|
|
245
261
|
"dirty-chai": "2.0.1",
|
|
246
|
-
"eslint": "8.
|
|
247
|
-
"eslint-config-prettier": "8.
|
|
248
|
-
"eslint-plugin-import": "2.25.
|
|
262
|
+
"eslint": "8.10.0",
|
|
263
|
+
"eslint-config-prettier": "8.4.0",
|
|
264
|
+
"eslint-plugin-import": "2.25.4",
|
|
249
265
|
"eslint-plugin-node": "11.1.0",
|
|
250
266
|
"eslint-plugin-prettier": "4.0.0",
|
|
251
267
|
"eslint-plugin-standard": "4.1.0",
|
|
252
|
-
"express": "4.17.
|
|
253
|
-
"fs-extra": "10.0.
|
|
268
|
+
"express": "4.17.3",
|
|
269
|
+
"fs-extra": "10.0.1",
|
|
254
270
|
"genversion": "3.0.2",
|
|
255
|
-
"mocha": "9.1
|
|
271
|
+
"mocha": "9.2.1",
|
|
256
272
|
"mustache": "4.2.0",
|
|
257
273
|
"nyc": "15.1.0",
|
|
258
274
|
"prettier": "2.5.1",
|
|
259
275
|
"reindent-template-literals": "1.1.0",
|
|
260
|
-
"
|
|
261
|
-
"
|
|
262
|
-
"sinon": "12.0.1",
|
|
276
|
+
"shx": "0.3.4",
|
|
277
|
+
"sinon": "13.0.1",
|
|
263
278
|
"sinon-chai": "3.7.0",
|
|
264
279
|
"stream-buffers": "3.0.2",
|
|
265
280
|
"stream-to-string": "1.2.0",
|
|
266
|
-
"
|
|
281
|
+
"strip-ansi": "6.0.1",
|
|
282
|
+
"ts-node": "10.6.0",
|
|
267
283
|
"tsd": "0.19.1",
|
|
268
|
-
"typescript": "4.
|
|
284
|
+
"typescript": "4.6.2"
|
|
269
285
|
},
|
|
270
286
|
"scripts": {
|
|
271
|
-
"build-local": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/",
|
|
287
|
+
"build-local": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/ && shx cp src/api/wrapper.mjs lib/api/",
|
|
272
288
|
"cck-test": "mocha 'compatibility/**/*_spec.ts'",
|
|
289
|
+
"docs:ci": "api-extractor run --verbose",
|
|
290
|
+
"docs:local": "api-extractor run --verbose --local && api-documenter markdown --input-folder ./tmp/api-extractor --output-folder ./docs/api",
|
|
273
291
|
"feature-test": "node ./bin/cucumber-js",
|
|
274
292
|
"lint-autofix": "eslint --fix \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",
|
|
275
293
|
"lint-code": "eslint \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",
|
|
@@ -283,7 +301,7 @@
|
|
|
283
301
|
"pretest-coverage": "npm run build-local",
|
|
284
302
|
"pretypes-test": "npm run build-local",
|
|
285
303
|
"test-coverage": "nyc --silent mocha 'src/**/*_spec.ts' 'compatibility/**/*_spec.ts' && nyc --silent --no-clean node ./bin/cucumber-js && nyc report --reporter=lcov",
|
|
286
|
-
"test": "npm run lint && npm run types-test && npm run unit-test && npm run cck-test && npm run feature-test",
|
|
304
|
+
"test": "npm run lint && npm run docs:ci && npm run types-test && npm run unit-test && npm run cck-test && npm run feature-test",
|
|
287
305
|
"types-test": "tsd",
|
|
288
306
|
"unit-test": "mocha 'src/**/*_spec.ts'",
|
|
289
307
|
"update-dependencies": "npx npm-check-updates --upgrade"
|
|
@@ -293,6 +311,7 @@
|
|
|
293
311
|
},
|
|
294
312
|
"license": "MIT",
|
|
295
313
|
"files": [
|
|
314
|
+
"api/",
|
|
296
315
|
"bin/",
|
|
297
316
|
"lib/"
|
|
298
317
|
]
|
package/lib/cli/argv_parser.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax';
|
|
2
|
-
import { PickleOrder } from './helpers';
|
|
3
|
-
export interface IParsedArgvFormatRerunOptions {
|
|
4
|
-
separator?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface IParsedArgvFormatOptions {
|
|
7
|
-
colorsEnabled?: boolean;
|
|
8
|
-
rerun?: IParsedArgvFormatRerunOptions;
|
|
9
|
-
snippetInterface?: SnippetInterface;
|
|
10
|
-
snippetSyntax?: string;
|
|
11
|
-
[customKey: string]: any;
|
|
12
|
-
}
|
|
13
|
-
export interface IParsedArgvOptions {
|
|
14
|
-
backtrace: boolean;
|
|
15
|
-
config: string;
|
|
16
|
-
dryRun: boolean;
|
|
17
|
-
exit: boolean;
|
|
18
|
-
failFast: boolean;
|
|
19
|
-
format: string[];
|
|
20
|
-
formatOptions: IParsedArgvFormatOptions;
|
|
21
|
-
i18nKeywords: string;
|
|
22
|
-
i18nLanguages: boolean;
|
|
23
|
-
language: string;
|
|
24
|
-
name: string[];
|
|
25
|
-
order: PickleOrder;
|
|
26
|
-
parallel: number;
|
|
27
|
-
profile: string[];
|
|
28
|
-
publish: boolean;
|
|
29
|
-
publishQuiet: boolean;
|
|
30
|
-
require: string[];
|
|
31
|
-
requireModule: string[];
|
|
32
|
-
retry: number;
|
|
33
|
-
retryTagFilter: string;
|
|
34
|
-
strict: boolean;
|
|
35
|
-
tags: string;
|
|
36
|
-
worldParameters: object;
|
|
37
|
-
}
|
|
38
|
-
export interface IParsedArgv {
|
|
39
|
-
args: string[];
|
|
40
|
-
options: IParsedArgvOptions;
|
|
41
|
-
}
|
|
42
|
-
declare const ArgvParser: {
|
|
43
|
-
collect<T>(val: T, memo: T[]): T[];
|
|
44
|
-
mergeJson(option: string): (str: string, memo: object) => object;
|
|
45
|
-
mergeTags(value: string, memo: string): string;
|
|
46
|
-
validateCountOption(value: string, optionName: string): number;
|
|
47
|
-
validateLanguage(value: string): string;
|
|
48
|
-
validateRetryOptions(options: IParsedArgvOptions): void;
|
|
49
|
-
parse(argv: string[]): IParsedArgv;
|
|
50
|
-
};
|
|
51
|
-
export default ArgvParser;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/cli/argv_parser.ts"],"names":[],"mappings":";;;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uBAAuB,EAAE,GAAG,EAAE;YACvC,OAAO,CAAC,GAAG,CAAC,IAAA,mBAAY,GAAE,CAAC,CAAA;YAC3B,OAAO,CAAC,IAAI,EAAE,CAAA;QAChB,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,sBAAsB,EAAE,UAAU,OAAe;YAC1D,OAAO,CAAC,GAAG,CAAC,IAAA,kBAAW,EAAC,OAAO,CAAC,CAAC,CAAA;YACjC,OAAO,CAAC,IAAI,EAAE,CAAA;QAChB,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,WAAW,CACjB,UAAU,EACV,6FAA6F,CAC9F,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACnB,MAAM,OAAO,GAAuB,OAAO,CAAC,IAAI,EAAE,CAAA;QAClD,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;QAExC,OAAO;YACL,OAAO;YACP,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { Command } from 'commander'\nimport path from 'path'\nimport { dialects } from '@cucumber/gherkin'\nimport { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax'\nimport { getKeywords, getLanguages } from './i18n'\nimport Formatters from '../formatter/helpers/formatters'\nimport { version } from '../version'\nimport { PickleOrder } from './helpers'\n\nexport interface IParsedArgvFormatRerunOptions {\n separator?: string\n}\n\nexport interface IParsedArgvFormatOptions {\n colorsEnabled?: boolean\n rerun?: IParsedArgvFormatRerunOptions\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n [customKey: string]: any\n}\n\nexport interface IParsedArgvOptions {\n backtrace: boolean\n config: string\n dryRun: boolean\n exit: boolean\n failFast: boolean\n format: string[]\n formatOptions: IParsedArgvFormatOptions\n i18nKeywords: string\n i18nLanguages: boolean\n language: string\n name: string[]\n order: PickleOrder\n parallel: number\n profile: string[]\n publish: boolean\n publishQuiet: boolean\n require: string[]\n requireModule: string[]\n retry: number\n retryTagFilter: string\n strict: boolean\n tags: string\n worldParameters: object\n}\n\nexport interface IParsedArgv {\n args: string[]\n options: IParsedArgvOptions\n}\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[]): T[] {\n memo.push(val)\n return memo\n },\n\n mergeJson(option: string): (str: string, memo: object) => object {\n return function (str: string, memo: object) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return { ...memo, ...val }\n }\n },\n\n mergeTags(value: string, memo: string): string {\n return memo === '' ? `(${value})` : `${memo} and (${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n validateRetryOptions(options: IParsedArgvOptions): void {\n if (options.retryTagFilter !== '' && options.retry === 0) {\n throw new Error(\n 'a positive --retry count must be specified when setting --retry-tag-filter'\n )\n }\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command(path.basename(argv[1]))\n\n program\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <TYPE[:PATH]>', 'specify configuration file')\n .option(\n '-d, --dry-run',\n 'invoke formatters without executing steps',\n false\n )\n .option(\n '--exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit',\n false\n )\n .option('--fail-fast', 'abort the run on first failure', false)\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Formatters.buildFormattersDocumentationString(),\n ArgvParser.collect,\n []\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options'),\n {}\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage,\n ''\n )\n .option('--i18n-languages', 'list languages', false)\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files',\n 'en'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect,\n []\n )\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined` or `random`',\n 'defined'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel'),\n 0\n )\n .option(\n '--publish',\n 'Publish a report to https://reports.cucumber.io',\n false\n )\n .option(\n '--publish-quiet',\n \"Don't print information banner about publishing reports\",\n false\n )\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry'),\n 0\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags,\n ''\n )\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags,\n ''\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters'),\n {}\n )\n\n program.on('option:i18n-languages', () => {\n console.log(getLanguages())\n process.exit()\n })\n\n program.on('option:i18n-keywords', function (isoCode: string) {\n console.log(getKeywords(isoCode))\n process.exit()\n })\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const options: IParsedArgvOptions = program.opts()\n ArgvParser.validateRetryOptions(options)\n\n return {\n options,\n args: program.args,\n }\n },\n}\n\nexport default ArgvParser\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IParsedArgv } from './argv_parser';
|
|
3
|
-
import { IRunConfiguration } from '../configuration';
|
|
4
|
-
export declare function buildConfiguration(fromArgv: IParsedArgv, env: NodeJS.ProcessEnv): Promise<IRunConfiguration>;
|
|
5
|
-
export declare function isTruthyString(s: string | undefined): boolean;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isTruthyString = exports.buildConfiguration = void 0;
|
|
7
|
-
const option_splitter_1 = __importDefault(require("./option_splitter"));
|
|
8
|
-
async function buildConfiguration(fromArgv, env) {
|
|
9
|
-
const { args, options } = fromArgv;
|
|
10
|
-
return {
|
|
11
|
-
sources: {
|
|
12
|
-
paths: args,
|
|
13
|
-
defaultDialect: options.language,
|
|
14
|
-
names: options.name,
|
|
15
|
-
tagExpression: options.tags,
|
|
16
|
-
order: options.order,
|
|
17
|
-
},
|
|
18
|
-
support: {
|
|
19
|
-
transpileWith: options.requireModule,
|
|
20
|
-
paths: options.require,
|
|
21
|
-
},
|
|
22
|
-
runtime: {
|
|
23
|
-
dryRun: options.dryRun,
|
|
24
|
-
failFast: options.failFast,
|
|
25
|
-
filterStacktraces: !options.backtrace,
|
|
26
|
-
parallel: options.parallel,
|
|
27
|
-
retry: options.retry,
|
|
28
|
-
retryTagFilter: options.retryTagFilter,
|
|
29
|
-
strict: options.strict,
|
|
30
|
-
worldParameters: options.worldParameters,
|
|
31
|
-
},
|
|
32
|
-
formats: {
|
|
33
|
-
stdout: options.format.find((option) => !option.includes(':')),
|
|
34
|
-
files: options.format
|
|
35
|
-
.filter((option) => option.includes(':'))
|
|
36
|
-
.reduce((mapped, item) => {
|
|
37
|
-
const [type, target] = option_splitter_1.default.split(item);
|
|
38
|
-
return {
|
|
39
|
-
...mapped,
|
|
40
|
-
[target]: type,
|
|
41
|
-
};
|
|
42
|
-
}, {}),
|
|
43
|
-
publish: makePublishConfig(options, env),
|
|
44
|
-
options: options.formatOptions,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
exports.buildConfiguration = buildConfiguration;
|
|
49
|
-
function isTruthyString(s) {
|
|
50
|
-
if (s === undefined) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
return s.match(/^(false|no|0)$/i) === null;
|
|
54
|
-
}
|
|
55
|
-
exports.isTruthyString = isTruthyString;
|
|
56
|
-
function isPublishing(options, env) {
|
|
57
|
-
return (options.publish ||
|
|
58
|
-
isTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||
|
|
59
|
-
env.CUCUMBER_PUBLISH_TOKEN !== undefined);
|
|
60
|
-
}
|
|
61
|
-
function makePublishConfig(options, env) {
|
|
62
|
-
const enabled = isPublishing(options, env);
|
|
63
|
-
if (!enabled) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
url: env.CUCUMBER_PUBLISH_URL,
|
|
68
|
-
token: env.CUCUMBER_PUBLISH_TOKEN,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=configuration_builder.js.map
|
|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AAM,CAAC,GAAG,yBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBACjD,OAAO;oBACL,GAAG,MAAM;oBACT,CAAC,MAAM,CAAC,EAAE,IAAI;iBACf,CAAA;YACH,CAAC,EAAE,EAAE,CAAC;YACR,OAAO,EAAE,iBAAiB,CAAC,OAAO,EAAE,GAAG,CAAC;YACxC,OAAO,EAAE,OAAO,CAAC,aAAa;SAC/B;KACF,CAAA;AACH,CAAC;AA1CD,gDA0CC;AAED,SAAgB,cAAc,CAAC,CAAqB;IAClD,IAAI,CAAC,KAAK,SAAS,EAAE;QACnB,OAAO,KAAK,CAAA;KACb;IACD,OAAO,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;AAC5C,CAAC;AALD,wCAKC;AAED,SAAS,YAAY,CACnB,OAA2B,EAC3B,GAAsB;IAEtB,OAAO,CACL,OAAO,CAAC,OAAO;QACf,cAAc,CAAC,GAAG,CAAC,wBAAwB,CAAC;QAC5C,GAAG,CAAC,sBAAsB,KAAK,SAAS,CACzC,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,OAA2B,EAC3B,GAAsB;IAEtB,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IAC1C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IACD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,oBAAoB;QAC7B,KAAK,EAAE,GAAG,CAAC,sBAAsB;KAClC,CAAA;AACH,CAAC","sourcesContent":["import { IParsedArgv, IParsedArgvOptions } from './argv_parser'\nimport OptionSplitter from './option_splitter'\nimport { IRunConfiguration } from '../configuration'\n\nexport async function buildConfiguration(\n fromArgv: IParsedArgv,\n env: NodeJS.ProcessEnv\n): Promise<IRunConfiguration> {\n const { args, options } = fromArgv\n return {\n sources: {\n paths: args,\n defaultDialect: options.language,\n names: options.name,\n tagExpression: options.tags,\n order: options.order,\n },\n support: {\n transpileWith: options.requireModule,\n paths: options.require,\n },\n runtime: {\n dryRun: options.dryRun,\n failFast: options.failFast,\n filterStacktraces: !options.backtrace,\n parallel: options.parallel,\n retry: options.retry,\n retryTagFilter: options.retryTagFilter,\n strict: options.strict,\n worldParameters: options.worldParameters,\n },\n formats: {\n stdout: options.format.find((option) => !option.includes(':')),\n files: options.format\n .filter((option) => option.includes(':'))\n .reduce((mapped, item) => {\n const [type, target] = OptionSplitter.split(item)\n return {\n ...mapped,\n [target]: type,\n }\n }, {}),\n publish: makePublishConfig(options, env),\n options: options.formatOptions,\n },\n }\n}\n\nexport function isTruthyString(s: string | undefined): boolean {\n if (s === undefined) {\n return false\n }\n return s.match(/^(false|no|0)$/i) === null\n}\n\nfunction isPublishing(\n options: IParsedArgvOptions,\n env: NodeJS.ProcessEnv\n): boolean {\n return (\n options.publish ||\n isTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||\n env.CUCUMBER_PUBLISH_TOKEN !== undefined\n )\n}\n\nfunction makePublishConfig(\n options: IParsedArgvOptions,\n env: NodeJS.ProcessEnv\n): any {\n const enabled = isPublishing(options, env)\n if (!enabled) {\n return false\n }\n return {\n url: env.CUCUMBER_PUBLISH_URL,\n token: env.CUCUMBER_PUBLISH_TOKEN,\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"option_splitter.js","sourceRoot":"","sources":["../../src/cli/option_splitter.ts"],"names":[],"mappings":";;AAAA,MAAM,cAAc,GAAG;IACrB,KAAK,CAAC,MAAc;QAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAEjC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;QAE7C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAc,EAAE,IAAY,EAAE,CAAS,EAAE,EAAE;YACtE,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;gBAC1B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;aAC1C;YAED,OAAO,IAAI,CAAA;QACb,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAChB;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACpB,CAAC;AAED,kBAAe,cAAc,CAAA","sourcesContent":["const OptionSplitter = {\n split(option: string): string[] {\n option = option.replace(/\"/g, '')\n\n const parts = option.split(/([^A-Z]):(?!\\\\)/)\n\n const result = parts.reduce((memo: string[], part: string, i: number) => {\n if (partNeedsRecombined(i)) {\n memo.push(parts.slice(i, i + 2).join(''))\n }\n\n return memo\n }, [])\n\n if (result.length === 1) {\n result.push('')\n }\n\n return result\n },\n}\n\nfunction partNeedsRecombined(i: number): boolean {\n return i % 2 === 0\n}\n\nexport default OptionSplitter\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export default class ProfileLoader {
|
|
2
|
-
private readonly directory;
|
|
3
|
-
constructor(directory: string);
|
|
4
|
-
getDefinitions(configFile?: string): Promise<Record<string, string>>;
|
|
5
|
-
loadFile(configFile: string): Record<string, string>;
|
|
6
|
-
getArgv(profiles: string[], configFile?: string): Promise<string[]>;
|
|
7
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_1 = __importDefault(require("mz/fs"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const string_argv_1 = __importDefault(require("string-argv"));
|
|
9
|
-
const value_checker_1 = require("../value_checker");
|
|
10
|
-
const DEFAULT_FILENAMES = ['cucumber.cjs', 'cucumber.js'];
|
|
11
|
-
class ProfileLoader {
|
|
12
|
-
constructor(directory) {
|
|
13
|
-
this.directory = directory;
|
|
14
|
-
}
|
|
15
|
-
async getDefinitions(configFile) {
|
|
16
|
-
if (configFile) {
|
|
17
|
-
return this.loadFile(configFile);
|
|
18
|
-
}
|
|
19
|
-
const defaultFile = DEFAULT_FILENAMES.find((filename) => fs_1.default.existsSync(path_1.default.join(this.directory, filename)));
|
|
20
|
-
if (defaultFile) {
|
|
21
|
-
return this.loadFile(defaultFile);
|
|
22
|
-
}
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
loadFile(configFile) {
|
|
26
|
-
const definitionsFilePath = path_1.default.join(this.directory, configFile);
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
28
|
-
const definitions = require(definitionsFilePath);
|
|
29
|
-
if (typeof definitions !== 'object') {
|
|
30
|
-
throw new Error(`${definitionsFilePath} does not export an object`);
|
|
31
|
-
}
|
|
32
|
-
return definitions;
|
|
33
|
-
}
|
|
34
|
-
async getArgv(profiles, configFile) {
|
|
35
|
-
const definitions = await this.getDefinitions(configFile);
|
|
36
|
-
if (profiles.length === 0 && (0, value_checker_1.doesHaveValue)(definitions.default)) {
|
|
37
|
-
profiles = ['default'];
|
|
38
|
-
}
|
|
39
|
-
const argvs = profiles.map((profile) => {
|
|
40
|
-
if ((0, value_checker_1.doesNotHaveValue)(definitions[profile])) {
|
|
41
|
-
throw new Error(`Undefined profile: ${profile}`);
|
|
42
|
-
}
|
|
43
|
-
return (0, string_argv_1.default)(definitions[profile]);
|
|
44
|
-
});
|
|
45
|
-
return argvs.flat();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.default = ProfileLoader;
|
|
49
|
-
//# sourceMappingURL=profile_loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile_loader.js","sourceRoot":"","sources":["../../src/cli/profile_loader.ts"],"names":[],"mappings":";;;;;AAAA,+CAAsB;AACtB,gDAAuB;AACvB,8DAAoC;AACpC,oDAAkE;AAElE,MAAM,iBAAiB,GAAG,CAAC,cAAc,EAAE,aAAa,CAAC,CAAA;AAEzD,MAAqB,aAAa;IAChC,YAA6B,SAAiB;QAAjB,cAAS,GAAT,SAAS,CAAQ;IAAG,CAAC;IAElD,KAAK,CAAC,cAAc,CAAC,UAAmB;QACtC,IAAI,UAAU,EAAE;YACd,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;SACjC;QAED,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACtD,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CACnD,CAAA;QAED,IAAI,WAAW,EAAE;YACf,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;SAClC;QAED,OAAO,EAAE,CAAA;IACX,CAAC;IAED,QAAQ,CAAC,UAAkB;QACzB,MAAM,mBAAmB,GAAW,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;QACzE,8DAA8D;QAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;QAChD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,GAAG,mBAAmB,4BAA4B,CAAC,CAAA;SACpE;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAkB,EAAE,UAAmB;QACnD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;QACzD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,IAAA,6BAAa,EAAC,WAAW,CAAC,OAAO,CAAC,EAAE;YAC/D,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;SACvB;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,IAAA,gCAAgB,EAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE;gBAC1C,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAA;aACjD;YACD,OAAO,IAAA,qBAAU,EAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;QACF,OAAO,KAAK,CAAC,IAAI,EAAE,CAAA;IACrB,CAAC;CACF;AA1CD,gCA0CC","sourcesContent":["import fs from 'mz/fs'\nimport path from 'path'\nimport stringArgv from 'string-argv'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\n\nconst DEFAULT_FILENAMES = ['cucumber.cjs', 'cucumber.js']\n\nexport default class ProfileLoader {\n constructor(private readonly directory: string) {}\n\n async getDefinitions(configFile?: string): Promise<Record<string, string>> {\n if (configFile) {\n return this.loadFile(configFile)\n }\n\n const defaultFile = DEFAULT_FILENAMES.find((filename) =>\n fs.existsSync(path.join(this.directory, filename))\n )\n\n if (defaultFile) {\n return this.loadFile(defaultFile)\n }\n\n return {}\n }\n\n loadFile(configFile: string): Record<string, string> {\n const definitionsFilePath: string = path.join(this.directory, configFile)\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const definitions = require(definitionsFilePath)\n if (typeof definitions !== 'object') {\n throw new Error(`${definitionsFilePath} does not export an object`)\n }\n return definitions\n }\n\n async getArgv(profiles: string[], configFile?: string): Promise<string[]> {\n const definitions = await this.getDefinitions(configFile)\n if (profiles.length === 0 && doesHaveValue(definitions.default)) {\n profiles = ['default']\n }\n const argvs = profiles.map((profile) => {\n if (doesNotHaveValue(definitions[profile])) {\n throw new Error(`Undefined profile: ${profile}`)\n }\n return stringArgv(definitions[profile])\n })\n return argvs.flat()\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/run/formatters.ts"],"names":[],"mappings":";;;;;;AAIA,+BAAgC;AAChC,oDAAmD;AAEnD,mEAAmD;AACnD,+CAAsB;AACtB,gDAAuB;AACvB,kDAAmE;AACnE,2EAAiD;AACjD,mCAAiC;AAG1B,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,GAAG,EAAE,EAClB,kBAAkB,GAQnB;;IACC,KAAK,UAAU,mBAAmB,CAChC,MAAwB,EACxB,MAAc,EACd,IAAY;;QAEZ,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,MAAM,WAAW,GAAG;YAClB,GAAG;YACH,gBAAgB;YAChB,kBAAkB;YAClB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,iBAAiB,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,EAAE;YAC9C,MAAM;YACN,OAAO,EACL,MAAM,KAAK,MAAM;gBACf,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE;gBACrC,CAAC,CAAC,IAAA,gBAAS,EAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7C,kBAAkB;SACnB,CAAA;QACD,IAAI,IAAA,gCAAgB,EAAC,MAAA,aAAa,CAAC,OAAO,0CAAE,aAAa,C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I,qBAAU,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;QAClD,MAAM,YAAY,GAAG,IAAI,iBAAQ,CAAC;YAChC,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,UAAU,YAAoB,EAAE,QAAQ,EAAE,aAAa;gBAC5D,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;gBAC3B,aAAa,EAAE,CAAA;YACjB,CAAC;SACF,CAAC,CAAA;QACF,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACzB,UAAU,CAAC,IAAI,CAAC,MAAM,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;KACnE;IAED,OAAO,KAAK;QACV,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACpE,CAAC,CAAA;AACH,CAAC;AA3FD,oDA2FC","sourcesContent":["import Formatter, { IFormatterStream } from '../formatter'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { promisify } from 'util'\nimport { doesNotHaveValue } from '../value_checker'\nimport { WriteStream as TtyWriteStream } from 'tty'\nimport FormatterBuilder from '../formatter/builder'\nimport fs from 'mz/fs'\nimport path from 'path'\nimport { DEFAULT_CUCUMBER_PUBLISH_URL } from '../formatter/publish'\nimport HttpStream from '../formatter/http_stream'\nimport { Writable } from 'stream'\nimport { IFormatterConfiguration } from '../configuration'\n\nexport async function initializeFormatters({\n cwd,\n stdout,\n eventBroadcaster,\n eventDataCollector,\n configuration = {},\n supportCodeLibrary,\n}: {\n cwd: string\n stdout: IFormatterStream\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n configuration: IFormatterConfiguration\n supportCodeLibrary: ISupportCodeLibrary\n}): Promise<() => Promise<void>> {\n async function initializeFormatter(\n stream: IFormatterStream,\n target: string,\n type: string\n ): Promise<Formatter> {\n stream.on('error', (error) => {\n console.error(error.message)\n process.exit(1)\n })\n const typeOptions = {\n cwd,\n eventBroadcaster,\n eventDataCollector,\n log: stream.write.bind(stream),\n parsedArgvOptions: configuration.options ?? {},\n stream,\n cleanup:\n stream === stdout\n ? async () => await Promise.resolve()\n : promisify<any>(stream.end.bind(stream)),\n supportCodeLibrary,\n }\n if (doesNotHaveValue(configuration.options?.colorsEnabled)) {\n typeOptions.parsedArgvOptions.colorsEnabled = (\n stream as TtyWriteStream\n ).isTTY\n }\n if (type === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {\n console.warn(\n `Cannot use 'progress-bar' formatter for output to '${target}' as not a TTY. Switching to 'progress' formatter.`\n )\n type = 'progress'\n }\n return await FormatterBuilder.build(type, typeOptions)\n }\n\n const formatters: Formatter[] = []\n\n formatters.push(\n await initializeFormatter(\n stdout,\n 'stdout',\n configuration.stdout ?? 'progress'\n )\n )\n\n if (configuration.files) {\n for (const [target, type] of Object.entries(configuration.files)) {\n const stream: IFormatterStream = fs.createWriteStream(null, {\n fd: await fs.open(path.resolve(cwd, target), 'w'),\n })\n formatters.push(await initializeFormatter(stream, target, type))\n }\n }\n\n if (configuration.publish) {\n const { url = DEFAULT_CUCUMBER_PUBLISH_URL, token } = configuration.publish\n const headers: { [key: string]: string } = {}\n if (token !== undefined) {\n headers.Authorization = `Bearer ${token}`\n }\n const stream = new HttpStream(url, 'GET', headers)\n const readerStream = new Writable({\n objectMode: true,\n write: function (responseBody: string, encoding, writeCallback) {\n console.error(responseBody)\n writeCallback()\n },\n })\n stream.pipe(readerStream)\n formatters.push(await initializeFormatter(stream, url, 'message'))\n }\n\n return async function () {\n await Promise.all(formatters.map(async (f) => await f.finished()))\n }\n}\n"]}
|
package/lib/run/index.d.ts
DELETED
package/lib/run/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/run/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA6B;AAC7B,0CAAuB","sourcesContent":["export * from './runCucumber'\nexport * from './types'\n"]}
|
package/lib/run/paths.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IRunConfiguration } from '../configuration';
|
|
2
|
-
export declare function resolvePaths(cwd: string, configuration: Pick<IRunConfiguration, 'sources' | 'support'>): Promise<{
|
|
3
|
-
unexpandedFeaturePaths: string[];
|
|
4
|
-
featurePaths: string[];
|
|
5
|
-
supportCodePaths: string[];
|
|
6
|
-
}>;
|
package/lib/run/paths.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/run/paths.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAgC;AAChC,gDAAuB;AACvB,gDAAuB;AACvB,+CAAsB;AAGf,KAAK,UAAU,YAAY,CAChC,GAAW,EACX,aAA6D;;IAM7D,MAAM,sBAAsB,GAAG,MAAM,yBAAyB,CAC5D,GAAG,EACH,aAAa,CAAC,OAAO,CAAC,KAAK,CAC5B,CAAA;IACD,MAAM,YAAY,GAAa,MAAM,kBAAkB,CACrD,GAAG,EACH,sBAAsB,CACvB,CAAA;IACD,IAAI,0BAA0B,GAAG,MAAA,aAAa,CAAC,OAAO,CAAC,KAAK,mCAAI,EAAE,CAAA;IAClE,IAAI,0BAA0B,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3C,0BAA0B,GAAG,wBAAwB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;KACzE;IACD,MAAM,gBAAgB,GAAG,MAAM,WAAW,CACxC,GAAG,EACH,0BAA0B,EAC1B,YAAY,CACb,CAAA;IACD,OAAO;QACL,sBAAsB;QACtB,YAAY;QACZ,gBAAgB;KACjB,CAAA;AACH,CAAC;AA9BD,oCA8BC;AAED,KAAK,UAAU,WAAW,CACxB,GAAW,EACX,eAAyB,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AAK,UAAU,kBAAkB,CAC/B,GAAW,EACX,YAAsB;IAEtB,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAA,CAAC,qBAAqB;IACxF,YAAY,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,CAAA,CAAC,gCAAgC;IAC1E,OAAO,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;AACzD,CAAC","sourcesContent":["import { promisify } from 'util'\nimport glob from 'glob'\nimport path from 'path'\nimport fs from 'mz/fs'\nimport { IRunConfiguration } from '../configuration'\n\nexport async function resolvePaths(\n cwd: string,\n configuration: Pick<IRunConfiguration, 'sources' | 'support'>\n): Promise<{\n unexpandedFeaturePaths: string[]\n featurePaths: string[]\n supportCodePaths: string[]\n}> {\n const unexpandedFeaturePaths = await getUnexpandedFeaturePaths(\n cwd,\n configuration.sources.paths\n )\n const featurePaths: string[] = await expandFeaturePaths(\n cwd,\n unexpandedFeaturePaths\n )\n let unexpandedSupportCodePaths = configuration.support.paths ?? []\n if (unexpandedSupportCodePaths.length === 0) {\n unexpandedSupportCodePaths = getFeatureDirectoryPaths(cwd, featurePaths)\n }\n const supportCodePaths = await expandPaths(\n cwd,\n unexpandedSupportCodePaths,\n '.@(js|mjs)'\n )\n return {\n unexpandedFeaturePaths,\n featurePaths,\n supportCodePaths,\n }\n}\n\nasync function expandPaths(\n cwd: string,\n unexpandedPaths: string[],\n defaultExtension: string\n): Promise<string[]> {\n const expandedPaths = await Promise.all(\n unexpandedPaths.map(async (unexpandedPath) => {\n const matches = await promisify(glob)(unexpandedPath, {\n absolute: true,\n cwd,\n })\n const expanded = await Promise.all(\n matches.map(async (match) => {\n if (path.extname(match) === '') {\n return await promisify(glob)(`${match}/**/*${defaultExtension}`)\n }\n return [match]\n })\n )\n return expanded.flat()\n })\n )\n return expandedPaths.flat().map((x) => path.normalize(x))\n}\n\nasync function getUnexpandedFeaturePaths(\n cwd: string,\n args: string[]\n): Promise<string[]> {\n if (args.length > 0) {\n const nestedFeaturePaths = await Promise.all(\n args.map(async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(cwd, arg)\n const content = await fs.readFile(filePath, 'utf8')\n return content.split('\\n').map((x) => x.trim())\n }\n return [arg]\n })\n )\n const featurePaths = nestedFeaturePaths.flat()\n if (featurePaths.length > 0) {\n return featurePaths.filter((x) => x !== '')\n }\n }\n return ['features/**/*.{feature,feature.md}']\n}\n\nfunction getFeatureDirectoryPaths(\n cwd: string,\n featurePaths: string[]\n): string[] {\n const featureDirs = featurePaths.map((featurePath) => {\n let featureDir = path.dirname(featurePath)\n let childDir: string\n let parentDir = featureDir\n while (childDir !== parentDir) {\n childDir = parentDir\n parentDir = path.dirname(childDir)\n if (path.basename(parentDir) === 'features') {\n featureDir = parentDir\n break\n }\n }\n return path.relative(cwd, featureDir)\n })\n return [...new Set(featureDirs)]\n}\n\nasync function expandFeaturePaths(\n cwd: string,\n featurePaths: string[]\n): Promise<string[]> {\n featurePaths = featurePaths.map((p) => p.replace(/(:\\d+)*$/g, '')) // Strip line numbers\n featurePaths = [...new Set(featurePaths)] // Deduplicate the feature files\n return await expandPaths(cwd, featurePaths, '.feature')\n}\n"]}
|
package/lib/run/runCucumber.d.ts
DELETED
package/lib/run/runCucumber.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.runCucumber = void 0;
|
|
7
|
-
const messages_1 = require("@cucumber/messages");
|
|
8
|
-
const events_1 = require("events");
|
|
9
|
-
const helpers_1 = require("../formatter/helpers");
|
|
10
|
-
const helpers_2 = require("../cli/helpers");
|
|
11
|
-
const gherkin_streams_1 = require("@cucumber/gherkin-streams");
|
|
12
|
-
const pickle_filter_1 = __importDefault(require("../pickle_filter"));
|
|
13
|
-
const paths_1 = require("./paths");
|
|
14
|
-
const runtime_1 = require("./runtime");
|
|
15
|
-
const formatters_1 = require("./formatters");
|
|
16
|
-
const support_1 = require("./support");
|
|
17
|
-
async function runCucumber(configuration, environment = {
|
|
18
|
-
cwd: process.cwd(),
|
|
19
|
-
stdout: process.stdout,
|
|
20
|
-
env: process.env,
|
|
21
|
-
}) {
|
|
22
|
-
var _a;
|
|
23
|
-
const { cwd, stdout, env } = environment;
|
|
24
|
-
const newId = messages_1.IdGenerator.uuid();
|
|
25
|
-
const { unexpandedFeaturePaths, featurePaths, supportCodePaths } = await (0, paths_1.resolvePaths)(cwd, configuration);
|
|
26
|
-
const supportCodeLibrary = await (0, support_1.getSupportCodeLibrary)({
|
|
27
|
-
cwd,
|
|
28
|
-
newId,
|
|
29
|
-
supportCodePaths,
|
|
30
|
-
supportCodeRequiredModules: configuration.support.transpileWith,
|
|
31
|
-
});
|
|
32
|
-
const eventBroadcaster = new events_1.EventEmitter();
|
|
33
|
-
const eventDataCollector = new helpers_1.EventDataCollector(eventBroadcaster);
|
|
34
|
-
const cleanup = await (0, formatters_1.initializeFormatters)({
|
|
35
|
-
cwd,
|
|
36
|
-
stdout,
|
|
37
|
-
eventBroadcaster,
|
|
38
|
-
eventDataCollector,
|
|
39
|
-
configuration: configuration.formats,
|
|
40
|
-
supportCodeLibrary,
|
|
41
|
-
});
|
|
42
|
-
await (0, helpers_2.emitMetaMessage)(eventBroadcaster, env);
|
|
43
|
-
const gherkinMessageStream = gherkin_streams_1.GherkinStreams.fromPaths(featurePaths, {
|
|
44
|
-
defaultDialect: configuration.sources.defaultDialect,
|
|
45
|
-
newId,
|
|
46
|
-
relativeTo: cwd,
|
|
47
|
-
});
|
|
48
|
-
let pickleIds = [];
|
|
49
|
-
if (featurePaths.length > 0) {
|
|
50
|
-
pickleIds = await (0, helpers_2.parseGherkinMessageStream)({
|
|
51
|
-
cwd,
|
|
52
|
-
eventBroadcaster,
|
|
53
|
-
eventDataCollector,
|
|
54
|
-
gherkinMessageStream,
|
|
55
|
-
order: (_a = configuration.sources.order) !== null && _a !== void 0 ? _a : 'defined',
|
|
56
|
-
pickleFilter: new pickle_filter_1.default({
|
|
57
|
-
cwd,
|
|
58
|
-
featurePaths: unexpandedFeaturePaths,
|
|
59
|
-
names: configuration.sources.names,
|
|
60
|
-
tagExpression: configuration.sources.tagExpression,
|
|
61
|
-
}),
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
(0, helpers_2.emitSupportCodeMessages)({
|
|
65
|
-
eventBroadcaster,
|
|
66
|
-
supportCodeLibrary,
|
|
67
|
-
newId,
|
|
68
|
-
});
|
|
69
|
-
const runtime = (0, runtime_1.makeRuntime)({
|
|
70
|
-
cwd,
|
|
71
|
-
eventBroadcaster,
|
|
72
|
-
eventDataCollector,
|
|
73
|
-
pickleIds,
|
|
74
|
-
newId,
|
|
75
|
-
supportCodeLibrary,
|
|
76
|
-
supportCodePaths,
|
|
77
|
-
supportCodeRequiredModules: configuration.support.transpileWith,
|
|
78
|
-
options: configuration.runtime,
|
|
79
|
-
});
|
|
80
|
-
const success = await runtime.start();
|
|
81
|
-
await cleanup();
|
|
82
|
-
return {
|
|
83
|
-
success,
|
|
84
|
-
support: supportCodeLibrary,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
exports.runCucumber = runCucumber;
|
|
88
|
-
//# sourceMappingURL=runCucumber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runCucumber.js","sourceRoot":"","sources":["../../src/run/runCucumber.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAgD;AAChD,mCAAqC;AACrC,kDAAyD;AACzD,4CAIuB;AACvB,+DAA0D;AAC1D,qEAA2C;AAG3C,mCAAsC;AACtC,uCAAuC;AACvC,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M,IAAA,mCAAyB,EAAC;YAC1C,GAAG;YACH,gBAAgB;YAChB,kBAAkB;YAClB,oBAAoB;YACpB,KAAK,EAAE,MAAA,aAAa,CAAC,OAAO,CAAC,KAAK,mCAAI,SAAS;YAC/C,YAAY,EAAE,IAAI,uBAAY,CAAC;gBAC7B,GAAG;gBACH,YAAY,EAAE,sBAAsB;gBACpC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK;gBAClC,aAAa,EAAE,aAAa,CAAC,OAAO,CAAC,aAAa;aACnD,CAAC;SACH,CAAC,CAAA;KACH;IACD,IAAA,iCAAuB,EAAC;QACtB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;KACN,CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC;QAC1B,GAAG;QACH,gBAAgB;QAChB,kBAAkB;QAClB,SAAS;QACT,KAAK;QACL,kBAAkB;QAClB,gBAAgB;QAChB,0BAA0B,EAAE,aAAa,CAAC,OAAO,CAAC,aAAa;QAC/D,OAAO,EAAE,aAAa,CAAC,OAAO;KAC/B,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;IACrC,MAAM,OAAO,EAAE,CAAA;IAEf,OAAO;QACL,OAAO;QACP,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC;AAhFD,kCAgFC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport {\n emitMetaMessage,\n emitSupportCodeMessages,\n parseGherkinMessageStream,\n} from '../cli/helpers'\nimport { GherkinStreams } from '@cucumber/gherkin-streams'\nimport PickleFilter from '../pickle_filter'\nimport { IRunConfiguration } from '../configuration'\nimport { IRunEnvironment, IRunResult } from './types'\nimport { resolvePaths } from './paths'\nimport { makeRuntime } from './runtime'\nimport { initializeFormatters } from './formatters'\nimport { getSupportCodeLibrary } from './support'\n\nexport async function runCucumber(\n configuration: IRunConfiguration,\n environment: IRunEnvironment = {\n cwd: process.cwd(),\n stdout: process.stdout,\n env: process.env,\n }\n): Promise<IRunResult> {\n const { cwd, stdout, env } = environment\n const newId = IdGenerator.uuid()\n\n const { unexpandedFeaturePaths, featurePaths, supportCodePaths } =\n await resolvePaths(cwd, configuration)\n\n const supportCodeLibrary = await getSupportCodeLibrary({\n cwd,\n newId,\n supportCodePaths,\n supportCodeRequiredModules: configuration.support.transpileWith,\n })\n\n const eventBroadcaster = new EventEmitter()\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n const cleanup = await initializeFormatters({\n cwd,\n stdout,\n eventBroadcaster,\n eventDataCollector,\n configuration: configuration.formats,\n supportCodeLibrary,\n })\n await emitMetaMessage(eventBroadcaster, env)\n\n const gherkinMessageStream = GherkinStreams.fromPaths(featurePaths, {\n defaultDialect: configuration.sources.defaultDialect,\n newId,\n relativeTo: cwd,\n })\n let pickleIds: string[] = []\n\n if (featurePaths.length > 0) {\n pickleIds = await parseGherkinMessageStream({\n cwd,\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order: configuration.sources.order ?? 'defined',\n pickleFilter: new PickleFilter({\n cwd,\n featurePaths: unexpandedFeaturePaths,\n names: configuration.sources.names,\n tagExpression: configuration.sources.tagExpression,\n }),\n })\n }\n emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n })\n\n const runtime = makeRuntime({\n cwd,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n supportCodePaths,\n supportCodeRequiredModules: configuration.support.transpileWith,\n options: configuration.runtime,\n })\n const success = await runtime.start()\n await cleanup()\n\n return {\n success,\n support: supportCodeLibrary,\n }\n}\n"]}
|