@cucumber/cucumber 8.0.0-rc.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -51
- package/api/index.d.ts +6 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +65 -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/api/formatters.d.ts +16 -0
- package/lib/api/formatters.js +72 -0
- 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/api/index.js +28 -0
- 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/api/paths.js +99 -0
- 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/api/runtime.d.ts +20 -0
- package/lib/api/runtime.js +36 -0
- package/lib/api/runtime.js.map +1 -0
- package/lib/api/support.d.ts +9 -0
- package/lib/api/support.js +21 -0
- package/lib/api/support.js.map +1 -0
- package/lib/api/types.d.ts +168 -0
- package/lib/api/types.js +3 -0
- package/lib/api/types.js.map +1 -0
- package/lib/api/wrapper.mjs +6 -0
- package/lib/cli/helpers.d.ts +16 -10
- package/lib/cli/helpers.js +54 -38
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +1 -1
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +6 -23
- package/lib/cli/index.js +38 -195
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/install_validator.js +1 -1
- package/lib/cli/install_validator.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 +15 -7
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.d.ts +10 -0
- package/lib/cli/validate_node_engine_version.js +24 -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 +47 -44
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +60 -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 +7 -0
- package/lib/configuration/index.js +29 -0
- package/lib/configuration/index.js.map +1 -0
- 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 +4 -3
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +25 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- 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 +3 -3
- package/lib/formatter/builder.js +34 -8
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/fixtures/typescript.d.ts +2 -0
- package/lib/formatter/fixtures/typescript.js +6 -0
- package/lib/formatter/fixtures/typescript.js.map +1 -0
- package/lib/formatter/get_color_fns.js +15 -16
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.js +15 -11
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/gherkin_document_parser.js +6 -6
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/index.js +5 -1
- package/lib/formatter/helpers/index.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js +4 -4
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +1 -1
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +1 -1
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +1 -1
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +6 -2
- package/lib/formatter/helpers/summary_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 +24 -19
- 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 +19 -15
- 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 +13 -9
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.js +4 -4
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +6 -6
- package/lib/formatter/http_stream.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 +18 -14
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.js +16 -16
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.js +7 -3
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/publish.d.ts +1 -0
- package/lib/formatter/publish.js +5 -0
- package/lib/formatter/publish.js.map +1 -0
- package/lib/formatter/rerun_formatter.js +10 -6
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +7 -4
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.js +2 -2
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/summary_formatter.js +9 -9
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +11 -8
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js +2 -3
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.js +13 -2
- 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/models/step_definition.js +3 -3
- package/lib/models/step_definition.js.map +1 -1
- package/lib/pickle_filter.js +8 -8
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/assemble_test_cases.js +1 -1
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/attachment_manager/index.js +9 -5
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/helpers.js +11 -4
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +7 -5
- package/lib/runtime/index.js +8 -27
- 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 +32 -11
- package/lib/runtime/parallel/coordinator.js +80 -28
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js +1 -1
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +2 -4
- package/lib/runtime/parallel/worker.js +14 -37
- 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/runtime/step_runner.js +9 -5
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +9 -5
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.js +11 -7
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/stack_trace_filter.js +2 -2
- package/lib/stack_trace_filter.js.map +1 -1
- package/lib/step_arguments.js +2 -2
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/{build_helpers.d.ts → build_parameter_type.d.ts} +0 -2
- package/lib/support_code_library_builder/build_parameter_type.js +13 -0
- package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +30 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
- package/lib/support_code_library_builder/index.d.ts +4 -2
- package/lib/support_code_library_builder/index.js +43 -19
- 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/time.js +5 -1
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +4 -4
- package/lib/user_code_runner.js.map +1 -1
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/lib/wrapper.mjs +5 -1
- package/package.json +72 -49
- package/lib/cli/argv_parser.d.ts +0 -50
- package/lib/cli/argv_parser.js.map +0 -1
- package/lib/cli/configuration_builder.d.ts +0 -45
- package/lib/cli/configuration_builder.js +0 -159
- 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/support_code_library_builder/build_helpers.js +0 -45
- package/lib/support_code_library_builder/build_helpers.js.map +0 -1
package/lib/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AACb,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// generated by genversion\nexport const version = '8.0.0'\n"]}
|
package/lib/wrapper.mjs
CHANGED
|
@@ -7,6 +7,8 @@ export const Runtime = cucumber.Runtime
|
|
|
7
7
|
export const supportCodeLibraryBuilder = cucumber.supportCodeLibraryBuilder
|
|
8
8
|
export const Status = cucumber.Status
|
|
9
9
|
export const DataTable = cucumber.DataTable
|
|
10
|
+
export const TestCaseHookDefinition = cucumber.TestCaseHookDefinition
|
|
11
|
+
export const version = cucumber.version
|
|
10
12
|
|
|
11
13
|
export const Formatter = cucumber.Formatter
|
|
12
14
|
export const FormatterBuilder = cucumber.FormatterBuilder
|
|
@@ -33,6 +35,8 @@ export const setDefinitionFunctionWrapper = cucumber.setDefinitionFunctionWrappe
|
|
|
33
35
|
export const setWorldConstructor = cucumber.setWorldConstructor
|
|
34
36
|
export const Then = cucumber.Then
|
|
35
37
|
export const When = cucumber.When
|
|
36
|
-
|
|
37
38
|
export const World = cucumber.World
|
|
39
|
+
export const parallelCanAssignHelpers = cucumber.parallelCanAssignHelpers
|
|
40
|
+
|
|
41
|
+
export const wrapPromiseWithTimeout = cucumber.wrapPromiseWithTimeout
|
|
38
42
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"gherkin",
|
|
9
9
|
"tests"
|
|
10
10
|
],
|
|
11
|
-
"version": "8.0.0
|
|
11
|
+
"version": "8.0.0",
|
|
12
12
|
"homepage": "https://github.com/cucumber/cucumber-js",
|
|
13
13
|
"author": "Julien Biezemans <jb@jbpros.com>",
|
|
14
14
|
"contributors": [
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"Lukas Degener <l.degener@tarent.de>",
|
|
100
100
|
"Łukasz Gandecki <lgandecki@css.edu>",
|
|
101
101
|
"M.P. Korstanje <mpkorstanje@users.noreply.github.com>",
|
|
102
|
+
"mannyluvstacos <mannyis@typingona.computer>",
|
|
102
103
|
"Marat Dyatko <vectart@gmail.com>",
|
|
103
104
|
"Marc Burton <marc.burton@first-utility.com>",
|
|
104
105
|
"Marcel Hoyer <mhoyer@pixelplastic.de>",
|
|
@@ -124,6 +125,7 @@
|
|
|
124
125
|
"Paul Jensen <paulbjensen@gmail.com>",
|
|
125
126
|
"Paul Shannon (https://devpaul.com)",
|
|
126
127
|
"please-rewrite <please-rewrite@users.noreply.github.com>",
|
|
128
|
+
"plocket <plocket@users.noreply.github.com>",
|
|
127
129
|
"Renier Morales <renier@morales-rodriguez.net>",
|
|
128
130
|
"Rick Lee-Morlang <rick@lee-morlang.com>",
|
|
129
131
|
"RolandArgos <roland.ormrod@argos.co.uk>",
|
|
@@ -171,29 +173,41 @@
|
|
|
171
173
|
"exports": {
|
|
172
174
|
".": {
|
|
173
175
|
"import": "./lib/wrapper.mjs",
|
|
174
|
-
"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"
|
|
175
183
|
},
|
|
176
184
|
"./lib/*": {
|
|
177
185
|
"require": "./lib/*.js"
|
|
178
|
-
}
|
|
186
|
+
},
|
|
187
|
+
"./package.json": "./package.json"
|
|
179
188
|
},
|
|
180
189
|
"types": "./lib/index.d.ts",
|
|
181
190
|
"engines": {
|
|
182
|
-
"node": ">=
|
|
191
|
+
"node": "12 || 14 || >=16"
|
|
192
|
+
},
|
|
193
|
+
"enginesTested": {
|
|
194
|
+
"node": "12 || 14 || 16 || 17"
|
|
183
195
|
},
|
|
184
196
|
"dependencies": {
|
|
185
|
-
"@
|
|
186
|
-
"@cucumber/
|
|
187
|
-
"@cucumber/
|
|
188
|
-
"@cucumber/gherkin
|
|
189
|
-
"@cucumber/
|
|
190
|
-
"@cucumber/
|
|
191
|
-
"@cucumber/
|
|
197
|
+
"@cspotcode/source-map-support": "^0.7.0",
|
|
198
|
+
"@cucumber/ci-environment": "9.0.4",
|
|
199
|
+
"@cucumber/cucumber-expressions": "15.0.2",
|
|
200
|
+
"@cucumber/gherkin": "22.0.0",
|
|
201
|
+
"@cucumber/gherkin-streams": "4.0.0",
|
|
202
|
+
"@cucumber/gherkin-utils": "^7.0.0",
|
|
203
|
+
"@cucumber/html-formatter": "19.0.0",
|
|
204
|
+
"@cucumber/messages": "17.1.1",
|
|
205
|
+
"@cucumber/tag-expressions": "4.1.0",
|
|
192
206
|
"assertion-error-formatter": "^3.0.0",
|
|
193
207
|
"capital-case": "^1.0.4",
|
|
194
|
-
"
|
|
195
|
-
"
|
|
196
|
-
"commander": "^
|
|
208
|
+
"chalk": "^4.1.2",
|
|
209
|
+
"cli-table3": "0.6.1",
|
|
210
|
+
"commander": "^9.0.0",
|
|
197
211
|
"duration": "^0.2.2",
|
|
198
212
|
"durations": "^3.4.2",
|
|
199
213
|
"figures": "^3.2.0",
|
|
@@ -201,75 +215,83 @@
|
|
|
201
215
|
"indent-string": "^4.0.0",
|
|
202
216
|
"is-stream": "^2.0.0",
|
|
203
217
|
"knuth-shuffle-seeded": "^1.0.6",
|
|
218
|
+
"lodash.merge": "^4.6.2",
|
|
219
|
+
"lodash.mergewith": "^4.6.2",
|
|
204
220
|
"mz": "^2.7.0",
|
|
205
221
|
"progress": "^2.0.3",
|
|
206
222
|
"resolve": "^1.19.0",
|
|
207
223
|
"resolve-pkg": "^2.0.0",
|
|
224
|
+
"semver": "7.3.5",
|
|
208
225
|
"stack-chain": "^2.0.0",
|
|
209
|
-
"stacktrace-js": "^2.0.2",
|
|
210
226
|
"string-argv": "^0.3.1",
|
|
211
227
|
"tmp": "^0.2.1",
|
|
212
228
|
"util-arity": "^1.1.0",
|
|
213
|
-
"verror": "^1.10.0"
|
|
229
|
+
"verror": "^1.10.0",
|
|
230
|
+
"yup": "^0.32.11"
|
|
214
231
|
},
|
|
215
232
|
"devDependencies": {
|
|
216
|
-
"@cucumber/compatibility-kit": "
|
|
217
|
-
"@cucumber/message-streams": "
|
|
218
|
-
"@cucumber/query": "
|
|
219
|
-
"@
|
|
220
|
-
"@
|
|
233
|
+
"@cucumber/compatibility-kit": "9.1.2",
|
|
234
|
+
"@cucumber/message-streams": "3.0.0",
|
|
235
|
+
"@cucumber/query": "11.0.0",
|
|
236
|
+
"@microsoft/api-documenter": "7.17.0",
|
|
237
|
+
"@microsoft/api-extractor": "7.20.0",
|
|
238
|
+
"@sinonjs/fake-timers": "9.1.1",
|
|
239
|
+
"@types/chai": "4.3.0",
|
|
221
240
|
"@types/dirty-chai": "2.0.2",
|
|
222
241
|
"@types/express": "4.17.13",
|
|
223
242
|
"@types/fs-extra": "9.0.13",
|
|
224
|
-
"@types/glob": "7.
|
|
225
|
-
"@types/
|
|
243
|
+
"@types/glob": "7.2.0",
|
|
244
|
+
"@types/lodash.merge": "^4.6.6",
|
|
245
|
+
"@types/lodash.mergewith": "^4.6.6",
|
|
246
|
+
"@types/mocha": "9.1.0",
|
|
226
247
|
"@types/mustache": "4.1.2",
|
|
227
248
|
"@types/mz": "2.7.4",
|
|
228
|
-
"@types/node": "
|
|
249
|
+
"@types/node": "16.11.26",
|
|
229
250
|
"@types/progress": "2.0.5",
|
|
230
251
|
"@types/resolve": "1.20.1",
|
|
231
|
-
"@types/semver": "7.3.
|
|
232
|
-
"@types/sinon-chai": "3.2.
|
|
233
|
-
"@types/sinonjs__fake-timers": "
|
|
252
|
+
"@types/semver": "7.3.9",
|
|
253
|
+
"@types/sinon-chai": "3.2.8",
|
|
254
|
+
"@types/sinonjs__fake-timers": "8.1.2",
|
|
234
255
|
"@types/stream-buffers": "3.0.4",
|
|
235
|
-
"@types/tmp": "0.2.
|
|
256
|
+
"@types/tmp": "0.2.3",
|
|
236
257
|
"@types/verror": "1.10.5",
|
|
237
|
-
"@typescript-eslint/eslint-plugin": "
|
|
238
|
-
"@typescript-eslint/parser": "
|
|
239
|
-
"chai": "4.3.
|
|
258
|
+
"@typescript-eslint/eslint-plugin": "5.17.0",
|
|
259
|
+
"@typescript-eslint/parser": "5.17.0",
|
|
260
|
+
"chai": "4.3.6",
|
|
240
261
|
"chai-exclude": "2.1.0",
|
|
241
|
-
"coffeescript": "2.6.
|
|
262
|
+
"coffeescript": "2.6.1",
|
|
242
263
|
"dependency-lint": "7.1.0",
|
|
243
264
|
"dirty-chai": "2.0.1",
|
|
244
|
-
"eslint": "
|
|
245
|
-
"eslint-config-prettier": "8.
|
|
246
|
-
"eslint-
|
|
247
|
-
"eslint-plugin-import": "2.24.2",
|
|
265
|
+
"eslint": "8.12.0",
|
|
266
|
+
"eslint-config-prettier": "8.5.0",
|
|
267
|
+
"eslint-plugin-import": "2.25.4",
|
|
248
268
|
"eslint-plugin-node": "11.1.0",
|
|
249
269
|
"eslint-plugin-prettier": "4.0.0",
|
|
250
|
-
"eslint-plugin-promise": "5.1.0",
|
|
251
270
|
"eslint-plugin-standard": "4.1.0",
|
|
252
|
-
"express": "4.17.
|
|
253
|
-
"fs-extra": "10.0.
|
|
254
|
-
"
|
|
271
|
+
"express": "4.17.3",
|
|
272
|
+
"fs-extra": "10.0.1",
|
|
273
|
+
"genversion": "3.0.2",
|
|
274
|
+
"mocha": "9.2.2",
|
|
255
275
|
"mustache": "4.2.0",
|
|
256
276
|
"nyc": "15.1.0",
|
|
257
|
-
"prettier": "2.
|
|
277
|
+
"prettier": "2.6.1",
|
|
258
278
|
"reindent-template-literals": "1.1.0",
|
|
259
|
-
"
|
|
260
|
-
"sinon": "
|
|
279
|
+
"shx": "0.3.4",
|
|
280
|
+
"sinon": "13.0.1",
|
|
261
281
|
"sinon-chai": "3.7.0",
|
|
262
282
|
"stream-buffers": "3.0.2",
|
|
263
283
|
"stream-to-string": "1.2.0",
|
|
264
|
-
"
|
|
265
|
-
"
|
|
266
|
-
"
|
|
284
|
+
"strip-ansi": "6.0.1",
|
|
285
|
+
"ts-node": "10.7.0",
|
|
286
|
+
"tsd": "0.20.0",
|
|
287
|
+
"typescript": "4.6.3"
|
|
267
288
|
},
|
|
268
289
|
"scripts": {
|
|
269
|
-
"build-local": "tsc --build tsconfig.node.json && cp src/importer.js lib/ && cp src/wrapper.mjs lib/",
|
|
290
|
+
"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/",
|
|
270
291
|
"cck-test": "mocha 'compatibility/**/*_spec.ts'",
|
|
292
|
+
"docs:ci": "api-extractor run --verbose",
|
|
293
|
+
"docs:local": "api-extractor run --verbose --local && api-documenter markdown --input-folder ./tmp/api-extractor --output-folder ./docs/api",
|
|
271
294
|
"feature-test": "node ./bin/cucumber-js",
|
|
272
|
-
"html-formatter": "node ./bin/cucumber-js --profile htmlFormatter",
|
|
273
295
|
"lint-autofix": "eslint --fix \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",
|
|
274
296
|
"lint-code": "eslint \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",
|
|
275
297
|
"lint-dependencies": "dependency-lint",
|
|
@@ -282,7 +304,7 @@
|
|
|
282
304
|
"pretest-coverage": "npm run build-local",
|
|
283
305
|
"pretypes-test": "npm run build-local",
|
|
284
306
|
"test-coverage": "nyc --silent mocha 'src/**/*_spec.ts' 'compatibility/**/*_spec.ts' && nyc --silent --no-clean node ./bin/cucumber-js && nyc report --reporter=lcov",
|
|
285
|
-
"test": "npm run lint && npm run types-test && npm run unit-test && npm run cck-test && npm run feature-test",
|
|
307
|
+
"test": "npm run lint && npm run docs:ci && npm run types-test && npm run unit-test && npm run cck-test && npm run feature-test",
|
|
286
308
|
"types-test": "tsd",
|
|
287
309
|
"unit-test": "mocha 'src/**/*_spec.ts'",
|
|
288
310
|
"update-dependencies": "npx npm-check-updates --upgrade"
|
|
@@ -292,6 +314,7 @@
|
|
|
292
314
|
},
|
|
293
315
|
"license": "MIT",
|
|
294
316
|
"files": [
|
|
317
|
+
"api/",
|
|
295
318
|
"bin/",
|
|
296
319
|
"lib/"
|
|
297
320
|
]
|
package/lib/cli/argv_parser.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax';
|
|
2
|
-
export interface IParsedArgvFormatRerunOptions {
|
|
3
|
-
separator?: string;
|
|
4
|
-
}
|
|
5
|
-
export interface IParsedArgvFormatOptions {
|
|
6
|
-
colorsEnabled?: boolean;
|
|
7
|
-
rerun?: IParsedArgvFormatRerunOptions;
|
|
8
|
-
snippetInterface?: SnippetInterface;
|
|
9
|
-
snippetSyntax?: string;
|
|
10
|
-
[customKey: string]: any;
|
|
11
|
-
}
|
|
12
|
-
export interface IParsedArgvOptions {
|
|
13
|
-
backtrace: boolean;
|
|
14
|
-
config: string;
|
|
15
|
-
dryRun: boolean;
|
|
16
|
-
exit: boolean;
|
|
17
|
-
failFast: boolean;
|
|
18
|
-
format: string[];
|
|
19
|
-
formatOptions: IParsedArgvFormatOptions;
|
|
20
|
-
i18nKeywords: string;
|
|
21
|
-
i18nLanguages: boolean;
|
|
22
|
-
language: string;
|
|
23
|
-
name: string[];
|
|
24
|
-
order: string;
|
|
25
|
-
parallel: number;
|
|
26
|
-
profile: string[];
|
|
27
|
-
publish: boolean;
|
|
28
|
-
publishQuiet: boolean;
|
|
29
|
-
require: string[];
|
|
30
|
-
requireModule: string[];
|
|
31
|
-
retry: number;
|
|
32
|
-
retryTagFilter: string;
|
|
33
|
-
strict: boolean;
|
|
34
|
-
tags: string;
|
|
35
|
-
worldParameters: object;
|
|
36
|
-
}
|
|
37
|
-
export interface IParsedArgv {
|
|
38
|
-
args: string[];
|
|
39
|
-
options: IParsedArgvOptions;
|
|
40
|
-
}
|
|
41
|
-
declare const ArgvParser: {
|
|
42
|
-
collect<T>(val: T, memo: T[]): T[];
|
|
43
|
-
mergeJson(option: string): (str: string, memo: object) => object;
|
|
44
|
-
mergeTags(value: string, memo: string): string;
|
|
45
|
-
validateCountOption(value: string, optionName: string): number;
|
|
46
|
-
validateLanguage(value: string): string;
|
|
47
|
-
validateRetryOptions(options: IParsedArgvOptions): void;
|
|
48
|
-
parse(argv: string[]): IParsedArgv;
|
|
49
|
-
};
|
|
50
|
-
export default ArgvParser;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/cli/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmC;AACnC,gD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,CACH,CAAA;QAEH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACxB,+BAA+B;YAC/B,OAAO,CAAC,GAAG,CACT,mGAAmG,CACpG,CAAA;YACD,8BAA8B;QAChC,CAAC,CAAC,CAAA;QAEF,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 Formatters from '../formatter/helpers/formatters'\n\n// Using require instead of import so compiled typescript will have the desired folder structure\nconst { version } = require('../../package.json') // eslint-disable-line @typescript-eslint/no-var-requires\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: string\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('--help', () => {\n /* eslint-disable no-console */\n console.log(\n ' For more details please visit https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md\\n'\n )\n /* eslint-enable no-console */\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,45 +0,0 @@
|
|
|
1
|
-
import { IParsedArgvFormatOptions } from './argv_parser';
|
|
2
|
-
import { IPickleFilterOptions } from '../pickle_filter';
|
|
3
|
-
import { IRuntimeOptions } from '../runtime';
|
|
4
|
-
export interface IConfigurationFormat {
|
|
5
|
-
outputTo: string;
|
|
6
|
-
type: string;
|
|
7
|
-
}
|
|
8
|
-
export interface IConfiguration {
|
|
9
|
-
featureDefaultLanguage: string;
|
|
10
|
-
featurePaths: string[];
|
|
11
|
-
formats: IConfigurationFormat[];
|
|
12
|
-
formatOptions: IParsedArgvFormatOptions;
|
|
13
|
-
publishing: boolean;
|
|
14
|
-
listI18nKeywordsFor: string;
|
|
15
|
-
listI18nLanguages: boolean;
|
|
16
|
-
order: string;
|
|
17
|
-
parallel: number;
|
|
18
|
-
pickleFilterOptions: IPickleFilterOptions;
|
|
19
|
-
profiles: string[];
|
|
20
|
-
runtimeOptions: IRuntimeOptions;
|
|
21
|
-
shouldExitImmediately: boolean;
|
|
22
|
-
supportCodePaths: string[];
|
|
23
|
-
supportCodeRequiredModules: string[];
|
|
24
|
-
suppressPublishAdvertisement: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface INewConfigurationBuilderOptions {
|
|
27
|
-
argv: string[];
|
|
28
|
-
cwd: string;
|
|
29
|
-
}
|
|
30
|
-
export default class ConfigurationBuilder {
|
|
31
|
-
static build(options: INewConfigurationBuilderOptions): Promise<IConfiguration>;
|
|
32
|
-
private readonly cwd;
|
|
33
|
-
private readonly args;
|
|
34
|
-
private readonly options;
|
|
35
|
-
constructor({ argv, cwd }: INewConfigurationBuilderOptions);
|
|
36
|
-
build(): Promise<IConfiguration>;
|
|
37
|
-
expandPaths(unexpandedPaths: string[], defaultExtension: string): Promise<string[]>;
|
|
38
|
-
expandFeaturePaths(featurePaths: string[]): Promise<string[]>;
|
|
39
|
-
getFeatureDirectoryPaths(featurePaths: string[]): string[];
|
|
40
|
-
isPublishing(): boolean;
|
|
41
|
-
isPublishAdvertisementSuppressed(): boolean;
|
|
42
|
-
getFormats(): IConfigurationFormat[];
|
|
43
|
-
isTruthyString(s: string | undefined): boolean;
|
|
44
|
-
getUnexpandedFeaturePaths(): Promise<string[]>;
|
|
45
|
-
}
|
|
@@ -1,159 +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 argv_parser_1 = __importDefault(require("./argv_parser"));
|
|
7
|
-
const fs_1 = __importDefault(require("mz/fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const option_splitter_1 = __importDefault(require("./option_splitter"));
|
|
10
|
-
const glob_1 = __importDefault(require("glob"));
|
|
11
|
-
const util_1 = require("util");
|
|
12
|
-
const value_checker_1 = require("../value_checker");
|
|
13
|
-
const DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports';
|
|
14
|
-
class ConfigurationBuilder {
|
|
15
|
-
constructor({ argv, cwd }) {
|
|
16
|
-
this.cwd = cwd;
|
|
17
|
-
const parsedArgv = argv_parser_1.default.parse(argv);
|
|
18
|
-
this.args = parsedArgv.args;
|
|
19
|
-
this.options = parsedArgv.options;
|
|
20
|
-
}
|
|
21
|
-
static async build(options) {
|
|
22
|
-
const builder = new ConfigurationBuilder(options);
|
|
23
|
-
return await builder.build();
|
|
24
|
-
}
|
|
25
|
-
async build() {
|
|
26
|
-
const listI18nKeywordsFor = this.options.i18nKeywords;
|
|
27
|
-
const listI18nLanguages = this.options.i18nLanguages;
|
|
28
|
-
const unexpandedFeaturePaths = await this.getUnexpandedFeaturePaths();
|
|
29
|
-
let featurePaths = [];
|
|
30
|
-
let supportCodePaths = [];
|
|
31
|
-
if (listI18nKeywordsFor === '' && !listI18nLanguages) {
|
|
32
|
-
featurePaths = await this.expandFeaturePaths(unexpandedFeaturePaths);
|
|
33
|
-
let unexpandedSupportCodePaths = this.options.require;
|
|
34
|
-
if (unexpandedSupportCodePaths.length === 0) {
|
|
35
|
-
unexpandedSupportCodePaths = this.getFeatureDirectoryPaths(featurePaths);
|
|
36
|
-
}
|
|
37
|
-
supportCodePaths = await this.expandPaths(unexpandedSupportCodePaths, '.@(js|mjs)');
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
featureDefaultLanguage: this.options.language,
|
|
41
|
-
featurePaths,
|
|
42
|
-
formats: this.getFormats(),
|
|
43
|
-
formatOptions: this.options.formatOptions,
|
|
44
|
-
publishing: this.isPublishing(),
|
|
45
|
-
listI18nKeywordsFor,
|
|
46
|
-
listI18nLanguages,
|
|
47
|
-
order: this.options.order,
|
|
48
|
-
parallel: this.options.parallel,
|
|
49
|
-
pickleFilterOptions: {
|
|
50
|
-
cwd: this.cwd,
|
|
51
|
-
featurePaths: unexpandedFeaturePaths,
|
|
52
|
-
names: this.options.name,
|
|
53
|
-
tagExpression: this.options.tags,
|
|
54
|
-
},
|
|
55
|
-
profiles: this.options.profile,
|
|
56
|
-
runtimeOptions: {
|
|
57
|
-
dryRun: this.options.dryRun,
|
|
58
|
-
failFast: this.options.failFast,
|
|
59
|
-
filterStacktraces: !this.options.backtrace,
|
|
60
|
-
retry: this.options.retry,
|
|
61
|
-
retryTagFilter: this.options.retryTagFilter,
|
|
62
|
-
strict: this.options.strict,
|
|
63
|
-
worldParameters: this.options.worldParameters,
|
|
64
|
-
},
|
|
65
|
-
shouldExitImmediately: this.options.exit,
|
|
66
|
-
supportCodePaths,
|
|
67
|
-
supportCodeRequiredModules: this.options.requireModule,
|
|
68
|
-
suppressPublishAdvertisement: this.isPublishAdvertisementSuppressed(),
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
async expandPaths(unexpandedPaths, defaultExtension) {
|
|
72
|
-
const expandedPaths = await Promise.all(unexpandedPaths.map(async (unexpandedPath) => {
|
|
73
|
-
const matches = await util_1.promisify(glob_1.default)(unexpandedPath, {
|
|
74
|
-
absolute: true,
|
|
75
|
-
cwd: this.cwd,
|
|
76
|
-
});
|
|
77
|
-
const expanded = await Promise.all(matches.map(async (match) => {
|
|
78
|
-
if (path_1.default.extname(match) === '') {
|
|
79
|
-
return await util_1.promisify(glob_1.default)(`${match}/**/*${defaultExtension}`);
|
|
80
|
-
}
|
|
81
|
-
return [match];
|
|
82
|
-
}));
|
|
83
|
-
return expanded.flat();
|
|
84
|
-
}));
|
|
85
|
-
return expandedPaths.flat().map((x) => path_1.default.normalize(x));
|
|
86
|
-
}
|
|
87
|
-
async expandFeaturePaths(featurePaths) {
|
|
88
|
-
featurePaths = featurePaths.map((p) => p.replace(/(:\d+)*$/g, '')); // Strip line numbers
|
|
89
|
-
featurePaths = [...new Set(featurePaths)]; // Deduplicate the feature files
|
|
90
|
-
return await this.expandPaths(featurePaths, '.feature');
|
|
91
|
-
}
|
|
92
|
-
getFeatureDirectoryPaths(featurePaths) {
|
|
93
|
-
const featureDirs = featurePaths.map((featurePath) => {
|
|
94
|
-
let featureDir = path_1.default.dirname(featurePath);
|
|
95
|
-
let childDir;
|
|
96
|
-
let parentDir = featureDir;
|
|
97
|
-
while (childDir !== parentDir) {
|
|
98
|
-
childDir = parentDir;
|
|
99
|
-
parentDir = path_1.default.dirname(childDir);
|
|
100
|
-
if (path_1.default.basename(parentDir) === 'features') {
|
|
101
|
-
featureDir = parentDir;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return path_1.default.relative(this.cwd, featureDir);
|
|
106
|
-
});
|
|
107
|
-
return [...new Set(featureDirs)];
|
|
108
|
-
}
|
|
109
|
-
isPublishing() {
|
|
110
|
-
return (this.options.publish ||
|
|
111
|
-
this.isTruthyString(process.env.CUCUMBER_PUBLISH_ENABLED) ||
|
|
112
|
-
process.env.CUCUMBER_PUBLISH_TOKEN !== undefined);
|
|
113
|
-
}
|
|
114
|
-
isPublishAdvertisementSuppressed() {
|
|
115
|
-
return (this.options.publishQuiet ||
|
|
116
|
-
this.isTruthyString(process.env.CUCUMBER_PUBLISH_QUIET));
|
|
117
|
-
}
|
|
118
|
-
getFormats() {
|
|
119
|
-
const mapping = { '': 'progress' };
|
|
120
|
-
this.options.format.forEach((format) => {
|
|
121
|
-
const [type, outputTo] = option_splitter_1.default.split(format);
|
|
122
|
-
mapping[outputTo] = type;
|
|
123
|
-
});
|
|
124
|
-
if (this.isPublishing()) {
|
|
125
|
-
const publishUrl = value_checker_1.valueOrDefault(process.env.CUCUMBER_PUBLISH_URL, DEFAULT_CUCUMBER_PUBLISH_URL);
|
|
126
|
-
mapping[publishUrl] = 'message';
|
|
127
|
-
}
|
|
128
|
-
return Object.keys(mapping).map((outputTo) => ({
|
|
129
|
-
outputTo,
|
|
130
|
-
type: mapping[outputTo],
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
isTruthyString(s) {
|
|
134
|
-
if (s === undefined) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
return s.match(/^(false|no|0)$/i) === null;
|
|
138
|
-
}
|
|
139
|
-
async getUnexpandedFeaturePaths() {
|
|
140
|
-
if (this.args.length > 0) {
|
|
141
|
-
const nestedFeaturePaths = await Promise.all(this.args.map(async (arg) => {
|
|
142
|
-
const filename = path_1.default.basename(arg);
|
|
143
|
-
if (filename[0] === '@') {
|
|
144
|
-
const filePath = path_1.default.join(this.cwd, arg);
|
|
145
|
-
const content = await fs_1.default.readFile(filePath, 'utf8');
|
|
146
|
-
return content.split('\n').map((x) => x.trim());
|
|
147
|
-
}
|
|
148
|
-
return [arg];
|
|
149
|
-
}));
|
|
150
|
-
const featurePaths = nestedFeaturePaths.flat();
|
|
151
|
-
if (featurePaths.length > 0) {
|
|
152
|
-
return featurePaths.filter((x) => x !== '');
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return ['features/**/*.{feature,feature.md}'];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
exports.default = ConfigurationBuilder;
|
|
159
|
-
//# sourceMappingURL=configuration_builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configuration_builder.js","sourceRoot":"","sources":["../../src/cli/configuration_builder.ts"],"names":[],"mappings":";;;;;AAAA,gEAGsB;AACtB,+CAAsB;AACtB,gDAAuB;AACvB,wEAA8C;AAC9C,gDAAuB;AACvB,+BAAgC;AAGhC,oDAAiD;AA+BjD,MAAM,4BAA4B,GAAG,0CAA0C,CAAA;AAE/E,MAAqB,oBAAoB;IAYvC,YAAY,EAAE,IAAI,EAAE,GAAG,EAAmC;QACxD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,MAAM,UAAU,GAAG,qBAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACzC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAA;IACnC,CAAC;IAhBD,MAAM,CAAC,KAAK,CAAC,KAAK,CAChB,OAAwC;QAExC,MAAM,OAAO,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAA;QACjD,OAAO,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;IAC9B,CAAC;IAaD,KAAK,CAAC,KAAK;QACT,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAA;QACrD,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAA;QACpD,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC,yBAAyB,EAAE,CAAA;QACrE,IAAI,YAAY,GAAa,EAAE,CAAA;QAC/B,IAAI,gBAAgB,GAAa,EAAE,CAAA;QACnC,IAAI,mBAAmB,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE;YACpD,YAAY,GAAG,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G,EAAE;oBACvB,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;oBACzC,MAAM,OAAO,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;oBACnD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;iBAChD;gBACD,OAAO,CAAC,GAAG,CAAC,CAAA;YACd,CAAC,CAAC,CACH,CAAA;YACD,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAA;YAC9C,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;aAC5C;SACF;QACD,OAAO,CAAC,oCAAoC,CAAC,CAAA;IAC/C,CAAC;CACF;AAnLD,uCAmLC","sourcesContent":["import ArgvParser, {\n IParsedArgvFormatOptions,\n IParsedArgvOptions,\n} from './argv_parser'\nimport fs from 'mz/fs'\nimport path from 'path'\nimport OptionSplitter from './option_splitter'\nimport glob from 'glob'\nimport { promisify } from 'util'\nimport { IPickleFilterOptions } from '../pickle_filter'\nimport { IRuntimeOptions } from '../runtime'\nimport { valueOrDefault } from '../value_checker'\n\nexport interface IConfigurationFormat {\n outputTo: string\n type: string\n}\n\nexport interface IConfiguration {\n featureDefaultLanguage: string\n featurePaths: string[]\n formats: IConfigurationFormat[]\n formatOptions: IParsedArgvFormatOptions\n publishing: boolean\n listI18nKeywordsFor: string\n listI18nLanguages: boolean\n order: string\n parallel: number\n pickleFilterOptions: IPickleFilterOptions\n profiles: string[]\n runtimeOptions: IRuntimeOptions\n shouldExitImmediately: boolean\n supportCodePaths: string[]\n supportCodeRequiredModules: string[]\n suppressPublishAdvertisement: boolean\n}\n\nexport interface INewConfigurationBuilderOptions {\n argv: string[]\n cwd: string\n}\n\nconst DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports'\n\nexport default class ConfigurationBuilder {\n static async build(\n options: INewConfigurationBuilderOptions\n ): Promise<IConfiguration> {\n const builder = new ConfigurationBuilder(options)\n return await builder.build()\n }\n\n private readonly cwd: string\n private readonly args: string[]\n private readonly options: IParsedArgvOptions\n\n constructor({ argv, cwd }: INewConfigurationBuilderOptions) {\n this.cwd = cwd\n const parsedArgv = ArgvParser.parse(argv)\n this.args = parsedArgv.args\n this.options = parsedArgv.options\n }\n\n async build(): Promise<IConfiguration> {\n const listI18nKeywordsFor = this.options.i18nKeywords\n const listI18nLanguages = this.options.i18nLanguages\n const unexpandedFeaturePaths = await this.getUnexpandedFeaturePaths()\n let featurePaths: string[] = []\n let supportCodePaths: string[] = []\n if (listI18nKeywordsFor === '' && !listI18nLanguages) {\n featurePaths = await this.expandFeaturePaths(unexpandedFeaturePaths)\n let unexpandedSupportCodePaths = this.options.require\n if (unexpandedSupportCodePaths.length === 0) {\n unexpandedSupportCodePaths = this.getFeatureDirectoryPaths(featurePaths)\n }\n supportCodePaths = await this.expandPaths(\n unexpandedSupportCodePaths,\n '.@(js|mjs)'\n )\n }\n return {\n featureDefaultLanguage: this.options.language,\n featurePaths,\n formats: this.getFormats(),\n formatOptions: this.options.formatOptions,\n publishing: this.isPublishing(),\n listI18nKeywordsFor,\n listI18nLanguages,\n order: this.options.order,\n parallel: this.options.parallel,\n pickleFilterOptions: {\n cwd: this.cwd,\n featurePaths: unexpandedFeaturePaths,\n names: this.options.name,\n tagExpression: this.options.tags,\n },\n profiles: this.options.profile,\n runtimeOptions: {\n dryRun: this.options.dryRun,\n failFast: this.options.failFast,\n filterStacktraces: !this.options.backtrace,\n retry: this.options.retry,\n retryTagFilter: this.options.retryTagFilter,\n strict: this.options.strict,\n worldParameters: this.options.worldParameters,\n },\n shouldExitImmediately: this.options.exit,\n supportCodePaths,\n supportCodeRequiredModules: this.options.requireModule,\n suppressPublishAdvertisement: this.isPublishAdvertisementSuppressed(),\n }\n }\n\n async expandPaths(\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: this.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\n async expandFeaturePaths(featurePaths: string[]): 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 this.expandPaths(featurePaths, '.feature')\n }\n\n getFeatureDirectoryPaths(featurePaths: string[]): 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(this.cwd, featureDir)\n })\n return [...new Set(featureDirs)]\n }\n\n isPublishing(): boolean {\n return (\n this.options.publish ||\n this.isTruthyString(process.env.CUCUMBER_PUBLISH_ENABLED) ||\n process.env.CUCUMBER_PUBLISH_TOKEN !== undefined\n )\n }\n\n isPublishAdvertisementSuppressed(): boolean {\n return (\n this.options.publishQuiet ||\n this.isTruthyString(process.env.CUCUMBER_PUBLISH_QUIET)\n )\n }\n\n getFormats(): IConfigurationFormat[] {\n const mapping: { [key: string]: string } = { '': 'progress' }\n this.options.format.forEach((format) => {\n const [type, outputTo] = OptionSplitter.split(format)\n mapping[outputTo] = type\n })\n if (this.isPublishing()) {\n const publishUrl = valueOrDefault(\n process.env.CUCUMBER_PUBLISH_URL,\n DEFAULT_CUCUMBER_PUBLISH_URL\n )\n\n mapping[publishUrl] = 'message'\n }\n return Object.keys(mapping).map((outputTo) => ({\n outputTo,\n type: mapping[outputTo],\n }))\n }\n\n isTruthyString(s: string | undefined): boolean {\n if (s === undefined) {\n return false\n }\n return s.match(/^(false|no|0)$/i) === null\n }\n\n async getUnexpandedFeaturePaths(): Promise<string[]> {\n if (this.args.length > 0) {\n const nestedFeaturePaths = await Promise.all(\n this.args.map(async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(this.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}\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,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 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 && value_checker_1.doesHaveValue(definitions.default)) {
|
|
37
|
-
profiles = ['default'];
|
|
38
|
-
}
|
|
39
|
-
const argvs = profiles.map((profile) => {
|
|
40
|
-
if (value_checker_1.doesNotHaveValue(definitions[profile])) {
|
|
41
|
-
throw new Error(`Undefined profile: ${profile}`);
|
|
42
|
-
}
|
|
43
|
-
return 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,SAA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AK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAA;aACjD;YACD,OAAO,qBAAU,CAAC,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"]}
|