@cucumber/cucumber 7.3.0 → 8.0.0-rc.2
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 +11 -4
- package/lib/cli/argv_parser.d.ts +3 -3
- package/lib/cli/argv_parser.js +19 -19
- package/lib/cli/argv_parser.js.map +1 -1
- package/lib/cli/configuration_builder.d.ts +5 -46
- package/lib/cli/configuration_builder.js +61 -150
- package/lib/cli/configuration_builder.js.map +1 -1
- package/lib/cli/helpers.d.ts +5 -3
- package/lib/cli/helpers.js +42 -15
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +7 -7
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +4 -23
- package/lib/cli/index.js +18 -193
- 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/option_splitter.js +1 -0
- package/lib/cli/option_splitter.js.map +1 -1
- package/lib/cli/profile_loader.d.ts +3 -2
- package/lib/cli/profile_loader.js +20 -13
- package/lib/cli/profile_loader.js.map +1 -1
- package/lib/cli/publish_banner.js +1 -1
- package/lib/cli/publish_banner.js.map +1 -1
- package/lib/cli/run.js +3 -4
- package/lib/cli/run.js.map +1 -1
- package/lib/configuration/index.d.ts +1 -0
- package/lib/configuration/index.js +14 -0
- package/lib/configuration/index.js.map +1 -0
- package/lib/configuration/types.d.ts +29 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- package/lib/formatter/builder.d.ts +5 -4
- package/lib/formatter/builder.js +41 -55
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.d.ts +4 -0
- package/lib/formatter/get_color_fns.js +11 -4
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +2 -1
- package/lib/formatter/helpers/event_data_collector.js +16 -15
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/formatters.d.ts +6 -0
- package/lib/formatter/helpers/formatters.js +41 -0
- package/lib/formatter/helpers/formatters.js.map +1 -0
- package/lib/formatter/helpers/gherkin_document_parser.js +29 -42
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js +6 -7
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +2 -6
- 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 +9 -18
- 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 +8 -7
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +12 -12
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +17 -20
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +26 -40
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.d.ts +1 -0
- package/lib/formatter/html_formatter.js +5 -4
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +7 -7
- package/lib/formatter/http_stream.js.map +1 -1
- package/lib/formatter/index.d.ts +1 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.d.ts +1 -0
- package/lib/formatter/json_formatter.js +25 -20
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/message_formatter.d.ts +1 -0
- package/lib/formatter/message_formatter.js +1 -0
- package/lib/formatter/message_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.d.ts +1 -0
- package/lib/formatter/progress_bar_formatter.js +17 -16
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.d.ts +1 -0
- package/lib/formatter/progress_formatter.js +3 -2
- 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.d.ts +1 -0
- package/lib/formatter/rerun_formatter.js +15 -11
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.d.ts +1 -0
- package/lib/formatter/snippets_formatter.js +3 -2
- 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/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.d.ts +1 -0
- package/lib/formatter/summary_formatter.js +10 -10
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.d.ts +1 -0
- package/lib/formatter/usage_formatter.js +9 -9
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.d.ts +1 -0
- package/lib/formatter/usage_json_formatter.js +3 -2
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js +9 -7
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/step_definition.js +4 -5
- package/lib/models/step_definition.js.map +1 -1
- package/lib/pickle_filter.js +13 -13
- package/lib/pickle_filter.js.map +1 -1
- package/lib/run/formatters.d.ts +14 -0
- package/lib/run/formatters.js +76 -0
- package/lib/run/formatters.js.map +1 -0
- package/lib/run/index.d.ts +2 -0
- package/lib/run/index.js +15 -0
- package/lib/run/index.js.map +1 -0
- package/lib/run/paths.d.ts +6 -0
- package/lib/run/paths.js +83 -0
- package/lib/run/paths.js.map +1 -0
- package/lib/run/runCucumber.d.ts +3 -0
- package/lib/run/runCucumber.js +88 -0
- package/lib/run/runCucumber.js.map +1 -0
- package/lib/run/runtime.d.ts +19 -0
- package/lib/run/runtime.js +58 -0
- package/lib/run/runtime.js.map +1 -0
- package/lib/run/support.d.ts +8 -0
- package/lib/run/support.js +26 -0
- package/lib/run/support.js.map +1 -0
- package/lib/run/types.d.ts +12 -0
- package/lib/run/types.js +3 -0
- package/lib/run/types.js.map +1 -0
- package/lib/runtime/assemble_test_cases.js +3 -3
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/attachment_manager/index.js +4 -4
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/helpers.d.ts +1 -0
- package/lib/runtime/helpers.js +42 -4
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +5 -3
- package/lib/runtime/index.js +22 -46
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +6 -5
- package/lib/runtime/parallel/coordinator.js +19 -22
- 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.js +21 -13
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/step_runner.js +5 -7
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +4 -4
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +3 -3
- package/lib/runtime/test_case_runner.js +19 -28
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/stack_trace_filter.js +6 -7
- 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.js +18 -31
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +2 -1
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +14 -19
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
- package/lib/time.d.ts +1 -0
- package/lib/time.js +17 -2
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +10 -17
- package/lib/user_code_runner.js.map +1 -1
- package/lib/value_checker.d.ts +2 -2
- package/lib/value_checker.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 +38 -0
- package/package.json +77 -67
- package/CHANGELOG.md +0 -1908
- package/lib/support_code_library_builder/build_helpers.js +0 -41
- package/lib/support_code_library_builder/build_helpers.js.map +0 -1
- package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
- package/lib/support_code_library_builder/finalize_helpers.js +0 -26
- package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ We've put a demo of Cucumber.js to [run in your browser](https://cucumber.github
|
|
|
22
22
|
|
|
23
23
|
## Help & support
|
|
24
24
|
|
|
25
|
-
* See here: https://cucumber.io/support
|
|
25
|
+
* See here: https://cucumber.io/support.
|
|
26
26
|
|
|
27
27
|
## Contributing
|
|
28
28
|
|
|
@@ -52,11 +52,9 @@ $ npm install cucumber@6
|
|
|
52
52
|
|
|
53
53
|
## Documentation
|
|
54
54
|
|
|
55
|
-
The following documentation is for master. See below
|
|
55
|
+
The following documentation is for master. See below the documentation for older versions.
|
|
56
56
|
|
|
57
57
|
* [CLI](/docs/cli.md)
|
|
58
|
-
* [Custom Formatters](/docs/custom_formatters.md)
|
|
59
|
-
* [Custom Snippet Syntaxes](/docs/custom_snippet_syntaxes.md)
|
|
60
58
|
* [NodeJs Example](/docs/nodejs_example.md)
|
|
61
59
|
* Support Files
|
|
62
60
|
* [World](/docs/support_files/world.md)
|
|
@@ -66,6 +64,15 @@ The following documentation is for master. See below for documentation for older
|
|
|
66
64
|
* [Data Table Interface](/docs/support_files/data_table_interface.md)
|
|
67
65
|
* [Attachments](/docs/support_files/attachments.md)
|
|
68
66
|
* [API Reference](/docs/support_files/api_reference.md)
|
|
67
|
+
* Guides
|
|
68
|
+
* [Dry Run](./docs/dry_run.md)
|
|
69
|
+
* [ES Modules](./docs/esm.md)
|
|
70
|
+
* [Formatters](./docs/formatters.md)
|
|
71
|
+
* [Running in parallel](./docs/parallel.md)
|
|
72
|
+
* [Profiles](./docs/profiles.md)
|
|
73
|
+
* [Rerunning just failures](./docs/rerun.md)
|
|
74
|
+
* [Retrying flaky scenarios](./docs/retry.md)
|
|
75
|
+
* [Snippets for undefined steps](./docs/snippets.md)
|
|
69
76
|
* [FAQ](/docs/faq.md)
|
|
70
77
|
|
|
71
78
|
#### Documentation for older versions
|
package/lib/cli/argv_parser.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax';
|
|
2
|
+
import { PickleOrder } from './helpers';
|
|
2
3
|
export interface IParsedArgvFormatRerunOptions {
|
|
3
4
|
separator?: string;
|
|
4
5
|
}
|
|
@@ -11,6 +12,7 @@ export interface IParsedArgvFormatOptions {
|
|
|
11
12
|
}
|
|
12
13
|
export interface IParsedArgvOptions {
|
|
13
14
|
backtrace: boolean;
|
|
15
|
+
config: string;
|
|
14
16
|
dryRun: boolean;
|
|
15
17
|
exit: boolean;
|
|
16
18
|
failFast: boolean;
|
|
@@ -20,9 +22,8 @@ export interface IParsedArgvOptions {
|
|
|
20
22
|
i18nLanguages: boolean;
|
|
21
23
|
language: string;
|
|
22
24
|
name: string[];
|
|
23
|
-
order:
|
|
25
|
+
order: PickleOrder;
|
|
24
26
|
parallel: number;
|
|
25
|
-
predictableIds: boolean;
|
|
26
27
|
profile: string[];
|
|
27
28
|
publish: boolean;
|
|
28
29
|
publishQuiet: boolean;
|
|
@@ -46,6 +47,5 @@ declare const ArgvParser: {
|
|
|
46
47
|
validateLanguage(value: string): string;
|
|
47
48
|
validateRetryOptions(options: IParsedArgvOptions): void;
|
|
48
49
|
parse(argv: string[]): IParsedArgv;
|
|
49
|
-
lint(fullArgv: string[]): void;
|
|
50
50
|
};
|
|
51
51
|
export default ArgvParser;
|
package/lib/cli/argv_parser.js
CHANGED
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
7
6
|
const commander_1 = require("commander");
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
9
8
|
const gherkin_1 = require("@cucumber/gherkin");
|
|
10
|
-
|
|
11
|
-
const
|
|
9
|
+
const i18n_1 = require("./i18n");
|
|
10
|
+
const formatters_1 = __importDefault(require("../formatter/helpers/formatters"));
|
|
11
|
+
const version_1 = require("../version");
|
|
12
12
|
const ArgvParser = {
|
|
13
13
|
collect(val, memo) {
|
|
14
14
|
memo.push(val);
|
|
@@ -24,10 +24,10 @@ const ArgvParser = {
|
|
|
24
24
|
const e = error;
|
|
25
25
|
throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`);
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
27
|
+
if (typeof val !== 'object' || Array.isArray(val)) {
|
|
28
28
|
throw new Error(`${option} must be passed JSON of an object: ${str}`);
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return { ...memo, ...val };
|
|
31
31
|
};
|
|
32
32
|
},
|
|
33
33
|
mergeTags(value, memo) {
|
|
@@ -41,7 +41,7 @@ const ArgvParser = {
|
|
|
41
41
|
return numericValue;
|
|
42
42
|
},
|
|
43
43
|
validateLanguage(value) {
|
|
44
|
-
if (!
|
|
44
|
+
if (!Object.keys(gherkin_1.dialects).includes(value)) {
|
|
45
45
|
throw new Error(`Unsupported ISO 639-1: ${value}`);
|
|
46
46
|
}
|
|
47
47
|
return value;
|
|
@@ -56,12 +56,14 @@ const ArgvParser = {
|
|
|
56
56
|
program
|
|
57
57
|
.storeOptionsAsProperties(false)
|
|
58
58
|
.usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')
|
|
59
|
-
.version(version, '-v, --version')
|
|
59
|
+
.version(version_1.version, '-v, --version')
|
|
60
60
|
.option('-b, --backtrace', 'show full backtrace for errors')
|
|
61
|
+
.option('-c, --config <TYPE[:PATH]>', 'specify configuration file')
|
|
61
62
|
.option('-d, --dry-run', 'invoke formatters without executing steps', false)
|
|
62
63
|
.option('--exit', 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit', false)
|
|
63
64
|
.option('--fail-fast', 'abort the run on first failure', false)
|
|
64
|
-
.option('-f, --format <TYPE[:PATH]>', 'specify the output format, optionally supply PATH to redirect formatter output (repeatable)'
|
|
65
|
+
.option('-f, --format <TYPE[:PATH]>', 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\n' +
|
|
66
|
+
formatters_1.default.buildFormattersDocumentationString(), ArgvParser.collect, [])
|
|
65
67
|
.option('--format-options <JSON>', 'provide options for formatters (repeatable)', ArgvParser.mergeJson('--format-options'), {})
|
|
66
68
|
.option('--i18n-keywords <ISO 639-1>', 'list language keywords', ArgvParser.validateLanguage, '')
|
|
67
69
|
.option('--i18n-languages', 'list languages', false)
|
|
@@ -71,21 +73,24 @@ const ArgvParser = {
|
|
|
71
73
|
.option('--order <TYPE[:SEED]>', 'run scenarios in the specified order. Type should be `defined` or `random`', 'defined')
|
|
72
74
|
.option('-p, --profile <NAME>', 'specify the profile to use (repeatable)', ArgvParser.collect, [])
|
|
73
75
|
.option('--parallel <NUMBER_OF_WORKERS>', 'run in parallel with the given number of workers', (val) => ArgvParser.validateCountOption(val, '--parallel'), 0)
|
|
74
|
-
.option('--predictable-ids', 'Use predictable ids in messages (option ignored if using parallel)', false)
|
|
75
76
|
.option('--publish', 'Publish a report to https://reports.cucumber.io', false)
|
|
76
77
|
.option('--publish-quiet', "Don't print information banner about publishing reports", false)
|
|
77
78
|
.option('-r, --require <GLOB|DIR|FILE>', 'require files before executing features (repeatable)', ArgvParser.collect, [])
|
|
78
79
|
.option('--require-module <NODE_MODULE>', 'require node modules before requiring files (repeatable)', ArgvParser.collect, [])
|
|
79
80
|
.option('--retry <NUMBER_OF_RETRIES>', 'specify the number of times to retry failing test cases (default: 0)', (val) => ArgvParser.validateCountOption(val, '--retry'), 0)
|
|
80
|
-
.option('--
|
|
81
|
+
.option('--retry-tag-filter <EXPRESSION>', `only retries the features or scenarios with tags matching the expression (repeatable).
|
|
81
82
|
This option requires '--retry' to be specified.`, ArgvParser.mergeTags, '')
|
|
82
83
|
.option('-t, --tags <EXPRESSION>', 'only execute the features or scenarios with tags matching the expression (repeatable)', ArgvParser.mergeTags, '')
|
|
83
84
|
.option('--world-parameters <JSON>', 'provide parameters that will be passed to the world constructor (repeatable)', ArgvParser.mergeJson('--world-parameters'), {});
|
|
84
|
-
program.on('
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/* eslint-enable no-console */
|
|
85
|
+
program.on('option:i18n-languages', () => {
|
|
86
|
+
console.log((0, i18n_1.getLanguages)());
|
|
87
|
+
process.exit();
|
|
88
88
|
});
|
|
89
|
+
program.on('option:i18n-keywords', function (isoCode) {
|
|
90
|
+
console.log((0, i18n_1.getKeywords)(isoCode));
|
|
91
|
+
process.exit();
|
|
92
|
+
});
|
|
93
|
+
program.addHelpText('afterAll', 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md');
|
|
89
94
|
program.parse(argv);
|
|
90
95
|
const options = program.opts();
|
|
91
96
|
ArgvParser.validateRetryOptions(options);
|
|
@@ -94,11 +99,6 @@ const ArgvParser = {
|
|
|
94
99
|
args: program.args,
|
|
95
100
|
};
|
|
96
101
|
},
|
|
97
|
-
lint(fullArgv) {
|
|
98
|
-
if (fullArgv.includes('--retryTagFilter')) {
|
|
99
|
-
console.warn('the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter');
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
102
|
};
|
|
103
103
|
exports.default = ArgvParser;
|
|
104
104
|
//# sourceMappingURL=argv_parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/cli/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,yCAAmC;AACnC,gDAAuB;AACvB,+CAA4C;AAG5C,gGAAgG;AAChG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA,CAAC,yDAAyD;AA6C3G,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,IAAS;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACd,OAAO,IAAI,CAAA;IACb,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,OAAO,UAAU,GAAW,EAAE,IAAY;YACxC,IAAI,GAAW,CAAA;YACf,IAAI;gBACF,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aACtB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,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C,IAAI,CACV,oHAAoH,CACrH,CAAA;SACF;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import _ from 'lodash'\nimport { Command } from 'commander'\nimport path from 'path'\nimport { dialects } from '@cucumber/gherkin'\nimport { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax'\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 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 predictableIds: boolean\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 (!_.isPlainObject(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return _.merge(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 (!_.includes(_.keys(dialects), 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(\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)',\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 '--predictable-ids',\n 'Use predictable ids in messages (option ignored if using parallel)',\n false\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 '--retryTagFilter, --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 = program.opts() as IParsedArgvOptions\n ArgvParser.validateRetryOptions(options)\n\n return {\n options,\n args: program.args,\n }\n },\n\n lint(fullArgv: string[]): void {\n if (fullArgv.includes('--retryTagFilter')) {\n console.warn(\n 'the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter'\n )\n }\n },\n}\n\nexport default ArgvParser\n"]}
|
|
1
|
+
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/cli/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmC;AACnC,gDAAuB;AACvB,+CAA4C;AAE5C,iCAAkD;AAClD,iFAAwD;AACxD,wCAAoC;AA8CpC,M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,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,46 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
|
|
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
|
-
predictableIds: boolean;
|
|
20
|
-
profiles: string[];
|
|
21
|
-
runtimeOptions: IRuntimeOptions;
|
|
22
|
-
shouldExitImmediately: boolean;
|
|
23
|
-
supportCodePaths: string[];
|
|
24
|
-
supportCodeRequiredModules: string[];
|
|
25
|
-
suppressPublishAdvertisement: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface INewConfigurationBuilderOptions {
|
|
28
|
-
argv: string[];
|
|
29
|
-
cwd: string;
|
|
30
|
-
}
|
|
31
|
-
export default class ConfigurationBuilder {
|
|
32
|
-
static build(options: INewConfigurationBuilderOptions): Promise<IConfiguration>;
|
|
33
|
-
private readonly cwd;
|
|
34
|
-
private readonly args;
|
|
35
|
-
private readonly options;
|
|
36
|
-
constructor({ argv, cwd }: INewConfigurationBuilderOptions);
|
|
37
|
-
build(): Promise<IConfiguration>;
|
|
38
|
-
expandPaths(unexpandedPaths: string[], defaultExtension: string): Promise<string[]>;
|
|
39
|
-
expandFeaturePaths(featurePaths: string[]): Promise<string[]>;
|
|
40
|
-
getFeatureDirectoryPaths(featurePaths: string[]): string[];
|
|
41
|
-
isPublishing(): boolean;
|
|
42
|
-
isPublishAdvertisementSuppressed(): boolean;
|
|
43
|
-
getFormats(): IConfigurationFormat[];
|
|
44
|
-
isTruthyString(s: string | undefined): boolean;
|
|
45
|
-
getUnexpandedFeaturePaths(): Promise<string[]>;
|
|
46
|
-
}
|
|
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;
|
|
@@ -3,158 +3,69 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const argv_parser_1 = __importDefault(require("./argv_parser"));
|
|
8
|
-
const fs_1 = __importDefault(require("mz/fs"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
6
|
+
exports.isTruthyString = exports.buildConfiguration = void 0;
|
|
10
7
|
const option_splitter_1 = __importDefault(require("./option_splitter"));
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
names: this.options.name,
|
|
56
|
-
tagExpression: this.options.tags,
|
|
57
|
-
},
|
|
58
|
-
predictableIds: this.options.predictableIds,
|
|
59
|
-
profiles: this.options.profile,
|
|
60
|
-
runtimeOptions: {
|
|
61
|
-
dryRun: this.options.dryRun,
|
|
62
|
-
predictableIds: this.options.predictableIds,
|
|
63
|
-
failFast: this.options.failFast,
|
|
64
|
-
filterStacktraces: !this.options.backtrace,
|
|
65
|
-
retry: this.options.retry,
|
|
66
|
-
retryTagFilter: this.options.retryTagFilter,
|
|
67
|
-
strict: this.options.strict,
|
|
68
|
-
worldParameters: this.options.worldParameters,
|
|
69
|
-
},
|
|
70
|
-
shouldExitImmediately: this.options.exit,
|
|
71
|
-
supportCodePaths,
|
|
72
|
-
supportCodeRequiredModules: this.options.requireModule,
|
|
73
|
-
suppressPublishAdvertisement: this.isPublishAdvertisementSuppressed(),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
async expandPaths(unexpandedPaths, defaultExtension) {
|
|
77
|
-
const expandedPaths = await bluebird_1.default.map(unexpandedPaths, async (unexpandedPath) => {
|
|
78
|
-
const matches = await util_1.promisify(glob_1.default)(unexpandedPath, {
|
|
79
|
-
absolute: true,
|
|
80
|
-
cwd: this.cwd,
|
|
81
|
-
});
|
|
82
|
-
const expanded = await bluebird_1.default.map(matches, async (match) => {
|
|
83
|
-
if (path_1.default.extname(match) === '') {
|
|
84
|
-
return await util_1.promisify(glob_1.default)(`${match}/**/*${defaultExtension}`);
|
|
85
|
-
}
|
|
86
|
-
return [match];
|
|
87
|
-
});
|
|
88
|
-
return lodash_1.default.flatten(expanded);
|
|
89
|
-
});
|
|
90
|
-
return lodash_1.default.flatten(expandedPaths).map((x) => path_1.default.normalize(x));
|
|
91
|
-
}
|
|
92
|
-
async expandFeaturePaths(featurePaths) {
|
|
93
|
-
featurePaths = featurePaths.map((p) => p.replace(/(:\d+)*$/g, '')); // Strip line numbers
|
|
94
|
-
return this.expandPaths(featurePaths, '.feature');
|
|
95
|
-
}
|
|
96
|
-
getFeatureDirectoryPaths(featurePaths) {
|
|
97
|
-
const featureDirs = featurePaths.map((featurePath) => {
|
|
98
|
-
let featureDir = path_1.default.dirname(featurePath);
|
|
99
|
-
let childDir;
|
|
100
|
-
let parentDir = featureDir;
|
|
101
|
-
while (childDir !== parentDir) {
|
|
102
|
-
childDir = parentDir;
|
|
103
|
-
parentDir = path_1.default.dirname(childDir);
|
|
104
|
-
if (path_1.default.basename(parentDir) === 'features') {
|
|
105
|
-
featureDir = parentDir;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return path_1.default.relative(this.cwd, featureDir);
|
|
110
|
-
});
|
|
111
|
-
return lodash_1.default.uniq(featureDirs);
|
|
112
|
-
}
|
|
113
|
-
isPublishing() {
|
|
114
|
-
return (this.options.publish ||
|
|
115
|
-
this.isTruthyString(process.env.CUCUMBER_PUBLISH_ENABLED) ||
|
|
116
|
-
process.env.CUCUMBER_PUBLISH_TOKEN !== undefined);
|
|
117
|
-
}
|
|
118
|
-
isPublishAdvertisementSuppressed() {
|
|
119
|
-
return (this.options.publishQuiet ||
|
|
120
|
-
this.isTruthyString(process.env.CUCUMBER_PUBLISH_QUIET));
|
|
121
|
-
}
|
|
122
|
-
getFormats() {
|
|
123
|
-
const mapping = { '': 'progress' };
|
|
124
|
-
this.options.format.forEach((format) => {
|
|
125
|
-
const [type, outputTo] = option_splitter_1.default.split(format);
|
|
126
|
-
mapping[outputTo] = type;
|
|
127
|
-
});
|
|
128
|
-
if (this.isPublishing()) {
|
|
129
|
-
const publishUrl = value_checker_1.valueOrDefault(process.env.CUCUMBER_PUBLISH_URL, DEFAULT_CUCUMBER_PUBLISH_URL);
|
|
130
|
-
mapping[publishUrl] = 'message';
|
|
131
|
-
}
|
|
132
|
-
return lodash_1.default.map(mapping, (type, outputTo) => ({ outputTo, type }));
|
|
133
|
-
}
|
|
134
|
-
isTruthyString(s) {
|
|
135
|
-
if (s === undefined) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
return s.match(/^(false|no|0)$/i) === null;
|
|
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;
|
|
139
52
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (featurePaths.length > 0) {
|
|
153
|
-
return lodash_1.default.compact(featurePaths);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return ['features/**/*.{feature,feature.md}'];
|
|
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;
|
|
157
65
|
}
|
|
66
|
+
return {
|
|
67
|
+
url: env.CUCUMBER_PUBLISH_URL,
|
|
68
|
+
token: env.CUCUMBER_PUBLISH_TOKEN,
|
|
69
|
+
};
|
|
158
70
|
}
|
|
159
|
-
exports.default = ConfigurationBuilder;
|
|
160
71
|
//# sourceMappingURL=configuration_builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration_builder.js","sourceRoot":"","sources":["../../src/cli/configuration_builder.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,gEAGsB;AACtB,+CAAsB;AACtB,gDAAuB;AACvB,wEAA8C;AAC9C,wDAA+B;AAC/B,gDAAuB;AACvB,+BAAgC;AAGhC,oDAAiD;AAgCjD,MAAM,4BAA4B,GA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ACd,CAAC,CAAC,CAAA;YACF,MAAM,YAAY,GAAG,gBAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;YAClD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,OAAO,gBAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;aAC/B;SACF;QACD,OAAO,CAAC,oCAAoC,CAAC,CAAA;IAC/C,CAAC;CACF;AAhLD,uCAgLC","sourcesContent":["import _ from 'lodash'\nimport ArgvParser, {\n IParsedArgvFormatOptions,\n IParsedArgvOptions,\n} from './argv_parser'\nimport fs from 'mz/fs'\nimport path from 'path'\nimport OptionSplitter from './option_splitter'\nimport bluebird from 'bluebird'\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 predictableIds: boolean\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\n ArgvParser.lint(argv)\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'\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 predictableIds: this.options.predictableIds,\n profiles: this.options.profile,\n runtimeOptions: {\n dryRun: this.options.dryRun,\n predictableIds: this.options.predictableIds,\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 bluebird.map(\n unexpandedPaths,\n async (unexpandedPath) => {\n const matches = await promisify(glob)(unexpandedPath, {\n absolute: true,\n cwd: this.cwd,\n })\n const expanded = await bluebird.map(matches, async (match) => {\n if (path.extname(match) === '') {\n return await promisify(glob)(`${match}/**/*${defaultExtension}`)\n }\n return [match]\n })\n return _.flatten(expanded)\n }\n )\n return _.flatten(expandedPaths).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 return 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 _.uniq(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 _.map(mapping, (type, outputTo) => ({ outputTo, type }))\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 bluebird.map(this.args, 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 _.chain(content).split('\\n').map(_.trim).value()\n }\n return [arg]\n })\n const featurePaths = _.flatten(nestedFeaturePaths)\n if (featurePaths.length > 0) {\n return _.compact(featurePaths)\n }\n }\n return ['features/**/*.{feature,feature.md}']\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"configuration_builder.js","sourceRoot":"","sources":["../../src/cli/configuration_builder.ts"],"names":[],"mappings":";;;;;;AACA,wEAA8C;AAGvC,KAAK,UAAU,kBAAkB,CACtC,QAAqB,EACrB,GAAsB;IAEtB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAA;IAClC,OAAO;QACL,OAAO,EAAE;YACP,KAAK,EAAE,IAAI;YACX,cAAc,EAAE,OAAO,CAAC,QAAQ;YAChC,KAAK,EAAE,OAAO,CAAC,IAAI;YACnB,aAAa,EAAE,OAAO,CAAC,IAAI;YAC3B,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB;QACD,OAAO,EAAE;YACP,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,KAAK,EAAE,OAAO,CAAC,OAAO;SACvB;QACD,OAAO,EAAE;YACP,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,iBAAiB,EAAE,CAAC,OAAO,CAAC,SAAS;YACrC,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,eAAe,EAAE,OAAO,CAAC,eAAe;SACzC;QACD,OAAO,EAAE;YACP,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC9D,KAAK,EAAE,OAAO,CAAC,MAAM;iBAClB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;iBACxC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;gBACvB,MAAM,CAAC,IAAI,EAAE,MAAM,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"]}
|
package/lib/cli/helpers.d.ts
CHANGED
|
@@ -15,12 +15,14 @@ interface IParseGherkinMessageStreamRequest {
|
|
|
15
15
|
eventBroadcaster: EventEmitter;
|
|
16
16
|
eventDataCollector: EventDataCollector;
|
|
17
17
|
gherkinMessageStream: Readable;
|
|
18
|
-
order:
|
|
18
|
+
order: PickleOrder;
|
|
19
19
|
pickleFilter: PickleFilter;
|
|
20
20
|
}
|
|
21
|
+
export declare type PickleOrder = 'defined' | 'random';
|
|
21
22
|
export declare function parseGherkinMessageStream({ cwd, eventBroadcaster, eventDataCollector, gherkinMessageStream, order, pickleFilter, }: IParseGherkinMessageStreamRequest): Promise<string[]>;
|
|
22
|
-
export declare function orderPickleIds(pickleIds: string[], order:
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function orderPickleIds(pickleIds: string[], order: PickleOrder): void;
|
|
24
|
+
export declare function isJavaScript(filePath: string): boolean;
|
|
25
|
+
export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv): Promise<void>;
|
|
24
26
|
export declare function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }: {
|
|
25
27
|
eventBroadcaster: EventEmitter;
|
|
26
28
|
supportCodeLibrary: ISupportCodeLibrary;
|