@cucumber/cucumber 7.3.2 → 8.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/lib/cli/argv_parser.d.ts +1 -2
- package/lib/cli/argv_parser.js +8 -12
- package/lib/cli/argv_parser.js.map +1 -1
- package/lib/cli/configuration_builder.d.ts +0 -1
- package/lib/cli/configuration_builder.js +18 -20
- package/lib/cli/configuration_builder.js.map +1 -1
- package/lib/cli/helpers.d.ts +1 -0
- package/lib/cli/helpers.js +9 -4
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +6 -6
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +1 -1
- package/lib/cli/index.js +18 -20
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/profile_loader.d.ts +3 -2
- package/lib/cli/profile_loader.js +17 -10
- package/lib/cli/profile_loader.js.map +1 -1
- package/lib/formatter/builder.d.ts +5 -4
- package/lib/formatter/builder.js +38 -52
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +2 -1
- package/lib/formatter/helpers/event_data_collector.js +6 -5
- 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 +24 -37
- 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 +4 -5
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +1 -5
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +8 -17
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +7 -6
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +4 -7
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +21 -35
- 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 +1 -0
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +1 -1
- 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 +12 -7
- 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 +2 -1
- 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 +1 -0
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.d.ts +1 -0
- package/lib/formatter/rerun_formatter.js +11 -7
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.d.ts +1 -0
- package/lib/formatter/snippets_formatter.js +1 -0
- package/lib/formatter/snippets_formatter.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 +4 -4
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.d.ts +1 -0
- package/lib/formatter/usage_formatter.js +3 -3
- 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 +1 -0
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -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 +1 -2
- package/lib/models/step_definition.js.map +1 -1
- package/lib/pickle_filter.js +5 -5
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/assemble_test_cases.js +2 -2
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/helpers.d.ts +1 -0
- package/lib/runtime/helpers.js +36 -1
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +0 -2
- package/lib/runtime/index.js +7 -41
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +0 -1
- package/lib/runtime/parallel/coordinator.js +11 -15
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.js +15 -7
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/step_runner.js +1 -3
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +3 -3
- package/lib/runtime/test_case_runner.js +13 -22
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/stack_trace_filter.js +4 -5
- package/lib/stack_trace_filter.js.map +1 -1
- package/lib/support_code_library_builder/build_helpers.js +14 -10
- package/lib/support_code_library_builder/build_helpers.js.map +1 -1
- package/lib/support_code_library_builder/index.js +0 -15
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +1 -0
- 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 +7 -14
- 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/wrapper.mjs +38 -0
- package/package.json +71 -63
- 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
|
@@ -11,6 +11,7 @@ export interface IParsedArgvFormatOptions {
|
|
|
11
11
|
}
|
|
12
12
|
export interface IParsedArgvOptions {
|
|
13
13
|
backtrace: boolean;
|
|
14
|
+
config: string;
|
|
14
15
|
dryRun: boolean;
|
|
15
16
|
exit: boolean;
|
|
16
17
|
failFast: boolean;
|
|
@@ -22,7 +23,6 @@ export interface IParsedArgvOptions {
|
|
|
22
23
|
name: string[];
|
|
23
24
|
order: string;
|
|
24
25
|
parallel: number;
|
|
25
|
-
predictableIds: boolean;
|
|
26
26
|
profile: string[];
|
|
27
27
|
publish: boolean;
|
|
28
28
|
publishQuiet: boolean;
|
|
@@ -46,6 +46,5 @@ declare const ArgvParser: {
|
|
|
46
46
|
validateLanguage(value: string): string;
|
|
47
47
|
validateRetryOptions(options: IParsedArgvOptions): void;
|
|
48
48
|
parse(argv: string[]): IParsedArgv;
|
|
49
|
-
lint(fullArgv: string[]): void;
|
|
50
49
|
};
|
|
51
50
|
export default ArgvParser;
|
package/lib/cli/argv_parser.js
CHANGED
|
@@ -3,10 +3,10 @@ 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");
|
|
9
|
+
const formatters_1 = __importDefault(require("../formatter/helpers/formatters"));
|
|
10
10
|
// Using require instead of import so compiled typescript will have the desired folder structure
|
|
11
11
|
const { version } = require('../../package.json'); // eslint-disable-line @typescript-eslint/no-var-requires
|
|
12
12
|
const ArgvParser = {
|
|
@@ -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;
|
|
@@ -58,10 +58,12 @@ const ArgvParser = {
|
|
|
58
58
|
.usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')
|
|
59
59
|
.version(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,13 +73,12 @@ 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'), {});
|
|
@@ -94,11 +95,6 @@ const ArgvParser = {
|
|
|
94
95
|
args: program.args,
|
|
95
96
|
};
|
|
96
97
|
},
|
|
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
98
|
};
|
|
103
99
|
exports.default = ArgvParser;
|
|
104
100
|
//# 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,CAAC,GAAU,KAAK,CAAA;gBACtB,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,yBAAyB,CAAC,CAAC,OAAO,KAAK,GAAG,EAAE,CAAC,CAAA;aACvE;YACD,IAAI,CAAC,gBAAC,CAAC,aAAa,CAAC,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A,MAAM,CACL,+BAA+B,EAC/B,sDAAsD,EACtD,UAAU,CAAC,OAAO,EAClB,EAAE,CACH;aACA,MAAM,CACL,gCAAgC,EAChC,0DAA0D,EAC1D,UAAU,CAAC,OAAO,EAClB,EAAE,CACH;aACA,MAAM,CACL,6BAA6B,EAC7B,sEAAsE,EACtE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,EACvD,CAAC,CACF;aACA,MAAM,CACL,mDAAmD,EACnD;wDACgD,EAChD,UAAU,CAAC,SAAS,EACpB,EAAE,CACH;aACA,MAAM,CACL,yBAAyB,EACzB,uFAAuF,EACvF,UAAU,CAAC,SAAS,EACpB,EAAE,CACH;aACA,MAAM,CACL,2BAA2B,EAC3B,8EAA8E,EAC9E,UAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAC1C,EAAE,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,GAAG,OAAO,CAAC,IAAI,EAAwB,CAAA;QACpD,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;QAExC,OAAO;YACL,OAAO;YACP,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAA;IACH,CAAC;IAED,IAAI,CAAC,QAAkB;QACrB,IAAI,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE;YACzC,OAAO,CAAC,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,iFAAwD;AAExD,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;Q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O,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"]}
|
|
@@ -3,12 +3,10 @@ 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 argv_parser_1 = __importDefault(require("./argv_parser"));
|
|
8
7
|
const fs_1 = __importDefault(require("mz/fs"));
|
|
9
8
|
const path_1 = __importDefault(require("path"));
|
|
10
9
|
const option_splitter_1 = __importDefault(require("./option_splitter"));
|
|
11
|
-
const bluebird_1 = __importDefault(require("bluebird"));
|
|
12
10
|
const glob_1 = __importDefault(require("glob"));
|
|
13
11
|
const util_1 = require("util");
|
|
14
12
|
const value_checker_1 = require("../value_checker");
|
|
@@ -16,7 +14,6 @@ const DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports';
|
|
|
16
14
|
class ConfigurationBuilder {
|
|
17
15
|
constructor({ argv, cwd }) {
|
|
18
16
|
this.cwd = cwd;
|
|
19
|
-
argv_parser_1.default.lint(argv);
|
|
20
17
|
const parsedArgv = argv_parser_1.default.parse(argv);
|
|
21
18
|
this.args = parsedArgv.args;
|
|
22
19
|
this.options = parsedArgv.options;
|
|
@@ -37,7 +34,7 @@ class ConfigurationBuilder {
|
|
|
37
34
|
if (unexpandedSupportCodePaths.length === 0) {
|
|
38
35
|
unexpandedSupportCodePaths = this.getFeatureDirectoryPaths(featurePaths);
|
|
39
36
|
}
|
|
40
|
-
supportCodePaths = await this.expandPaths(unexpandedSupportCodePaths, '
|
|
37
|
+
supportCodePaths = await this.expandPaths(unexpandedSupportCodePaths, '.@(js|mjs)');
|
|
41
38
|
}
|
|
42
39
|
return {
|
|
43
40
|
featureDefaultLanguage: this.options.language,
|
|
@@ -55,11 +52,9 @@ class ConfigurationBuilder {
|
|
|
55
52
|
names: this.options.name,
|
|
56
53
|
tagExpression: this.options.tags,
|
|
57
54
|
},
|
|
58
|
-
predictableIds: this.options.predictableIds,
|
|
59
55
|
profiles: this.options.profile,
|
|
60
56
|
runtimeOptions: {
|
|
61
57
|
dryRun: this.options.dryRun,
|
|
62
|
-
predictableIds: this.options.predictableIds,
|
|
63
58
|
failFast: this.options.failFast,
|
|
64
59
|
filterStacktraces: !this.options.backtrace,
|
|
65
60
|
retry: this.options.retry,
|
|
@@ -74,25 +69,25 @@ class ConfigurationBuilder {
|
|
|
74
69
|
};
|
|
75
70
|
}
|
|
76
71
|
async expandPaths(unexpandedPaths, defaultExtension) {
|
|
77
|
-
const expandedPaths = await
|
|
72
|
+
const expandedPaths = await Promise.all(unexpandedPaths.map(async (unexpandedPath) => {
|
|
78
73
|
const matches = await util_1.promisify(glob_1.default)(unexpandedPath, {
|
|
79
74
|
absolute: true,
|
|
80
75
|
cwd: this.cwd,
|
|
81
76
|
});
|
|
82
|
-
const expanded = await
|
|
77
|
+
const expanded = await Promise.all(matches.map(async (match) => {
|
|
83
78
|
if (path_1.default.extname(match) === '') {
|
|
84
79
|
return await util_1.promisify(glob_1.default)(`${match}/**/*${defaultExtension}`);
|
|
85
80
|
}
|
|
86
81
|
return [match];
|
|
87
|
-
});
|
|
88
|
-
return
|
|
89
|
-
});
|
|
90
|
-
return
|
|
82
|
+
}));
|
|
83
|
+
return expanded.flat();
|
|
84
|
+
}));
|
|
85
|
+
return expandedPaths.flat().map((x) => path_1.default.normalize(x));
|
|
91
86
|
}
|
|
92
87
|
async expandFeaturePaths(featurePaths) {
|
|
93
88
|
featurePaths = featurePaths.map((p) => p.replace(/(:\d+)*$/g, '')); // Strip line numbers
|
|
94
89
|
featurePaths = [...new Set(featurePaths)]; // Deduplicate the feature files
|
|
95
|
-
return this.expandPaths(featurePaths, '.feature');
|
|
90
|
+
return await this.expandPaths(featurePaths, '.feature');
|
|
96
91
|
}
|
|
97
92
|
getFeatureDirectoryPaths(featurePaths) {
|
|
98
93
|
const featureDirs = featurePaths.map((featurePath) => {
|
|
@@ -109,7 +104,7 @@ class ConfigurationBuilder {
|
|
|
109
104
|
}
|
|
110
105
|
return path_1.default.relative(this.cwd, featureDir);
|
|
111
106
|
});
|
|
112
|
-
return
|
|
107
|
+
return [...new Set(featureDirs)];
|
|
113
108
|
}
|
|
114
109
|
isPublishing() {
|
|
115
110
|
return (this.options.publish ||
|
|
@@ -130,7 +125,10 @@ class ConfigurationBuilder {
|
|
|
130
125
|
const publishUrl = value_checker_1.valueOrDefault(process.env.CUCUMBER_PUBLISH_URL, DEFAULT_CUCUMBER_PUBLISH_URL);
|
|
131
126
|
mapping[publishUrl] = 'message';
|
|
132
127
|
}
|
|
133
|
-
return
|
|
128
|
+
return Object.keys(mapping).map((outputTo) => ({
|
|
129
|
+
outputTo,
|
|
130
|
+
type: mapping[outputTo],
|
|
131
|
+
}));
|
|
134
132
|
}
|
|
135
133
|
isTruthyString(s) {
|
|
136
134
|
if (s === undefined) {
|
|
@@ -140,18 +138,18 @@ class ConfigurationBuilder {
|
|
|
140
138
|
}
|
|
141
139
|
async getUnexpandedFeaturePaths() {
|
|
142
140
|
if (this.args.length > 0) {
|
|
143
|
-
const nestedFeaturePaths = await
|
|
141
|
+
const nestedFeaturePaths = await Promise.all(this.args.map(async (arg) => {
|
|
144
142
|
const filename = path_1.default.basename(arg);
|
|
145
143
|
if (filename[0] === '@') {
|
|
146
144
|
const filePath = path_1.default.join(this.cwd, arg);
|
|
147
145
|
const content = await fs_1.default.readFile(filePath, 'utf8');
|
|
148
|
-
return
|
|
146
|
+
return content.split('\n').map((x) => x.trim());
|
|
149
147
|
}
|
|
150
148
|
return [arg];
|
|
151
|
-
});
|
|
152
|
-
const featurePaths =
|
|
149
|
+
}));
|
|
150
|
+
const featurePaths = nestedFeaturePaths.flat();
|
|
153
151
|
if (featurePaths.length > 0) {
|
|
154
|
-
return
|
|
152
|
+
return featurePaths.filter((x) => x !== '');
|
|
155
153
|
}
|
|
156
154
|
}
|
|
157
155
|
return ['features/**/*.{feature,feature.md}'];
|
|
@@ -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;AAC9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AC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,gBAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAA;iBACxD;gBACD,OAAO,CAAC,GAAG,CAAC,CAAA;YACd,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;AAjLD,uCAiLC","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 featurePaths = [...new Set(featurePaths)] // Deduplicate the feature files\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":";;;;;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,M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CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,GAAG,CAC1C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBAC1B,MAAM,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;gBACnC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG,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"]}
|
package/lib/cli/helpers.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ interface IParseGherkinMessageStreamRequest {
|
|
|
20
20
|
}
|
|
21
21
|
export declare function parseGherkinMessageStream({ cwd, eventBroadcaster, eventDataCollector, gherkinMessageStream, order, pickleFilter, }: IParseGherkinMessageStreamRequest): Promise<string[]>;
|
|
22
22
|
export declare function orderPickleIds(pickleIds: string[], order: string): void;
|
|
23
|
+
export declare function isJavaScript(filePath: string): boolean;
|
|
23
24
|
export declare function emitMetaMessage(eventBroadcaster: EventEmitter): Promise<void>;
|
|
24
25
|
export declare function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }: {
|
|
25
26
|
eventBroadcaster: EventEmitter;
|
package/lib/cli/helpers.js
CHANGED
|
@@ -22,8 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.emitSupportCodeMessages = exports.emitMetaMessage = exports.orderPickleIds = exports.parseGherkinMessageStream = exports.getExpandedArgv = void 0;
|
|
26
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
25
|
+
exports.emitSupportCodeMessages = exports.emitMetaMessage = exports.isJavaScript = exports.orderPickleIds = exports.parseGherkinMessageStream = exports.getExpandedArgv = void 0;
|
|
27
26
|
const argv_parser_1 = __importDefault(require("./argv_parser"));
|
|
28
27
|
const profile_loader_1 = __importDefault(require("./profile_loader"));
|
|
29
28
|
const knuth_shuffle_seeded_1 = __importDefault(require("knuth-shuffle-seeded"));
|
|
@@ -35,9 +34,9 @@ const support_code_library_builder_1 = require("../support_code_library_builder"
|
|
|
35
34
|
async function getExpandedArgv({ argv, cwd, }) {
|
|
36
35
|
const { options } = argv_parser_1.default.parse(argv);
|
|
37
36
|
let fullArgv = argv;
|
|
38
|
-
const profileArgv = await new profile_loader_1.default(cwd).getArgv(options.profile);
|
|
37
|
+
const profileArgv = await new profile_loader_1.default(cwd).getArgv(options.profile, options.config);
|
|
39
38
|
if (profileArgv.length > 0) {
|
|
40
|
-
fullArgv =
|
|
39
|
+
fullArgv = argv.slice(0, 2).concat(profileArgv).concat(argv.slice(2));
|
|
41
40
|
}
|
|
42
41
|
return fullArgv;
|
|
43
42
|
}
|
|
@@ -85,6 +84,12 @@ function orderPickleIds(pickleIds, order) {
|
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
exports.orderPickleIds = orderPickleIds;
|
|
87
|
+
function isJavaScript(filePath) {
|
|
88
|
+
return (filePath.endsWith('.js') ||
|
|
89
|
+
filePath.endsWith('.mjs') ||
|
|
90
|
+
filePath.endsWith('.cjs'));
|
|
91
|
+
}
|
|
92
|
+
exports.isJavaScript = isJavaScript;
|
|
88
93
|
async function emitMetaMessage(eventBroadcaster) {
|
|
89
94
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
90
95
|
const { version } = require('../../package.json');
|
package/lib/cli/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsB;AACtB,gEAAsC;AACtC,sEAA4C;AAC5C,gFAA0C;AAI1C,oDAAgD;AAChD,wEAA8C;AAG9C,6DAA8C;AAC9C,wEAA8C;AAI9C,kFAAuE;AAOhE,KAAK,UAAU,eAAe,CAAC,EACpC,IAAI,EACJ,GAAG,GACqB;IACxB,MAAM,EAAE,OAAO,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC1C,IAAI,QAAQ,GAAG,IAAI,CAAA;IACnB,MAAM,WAAW,GAAG,MAAM,IAAI,wBAAa,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACzE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,QAAQ,GAAG,gBAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;KAClE;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAXD,0CAWC;AAWM,KAAK,UAAU,yBAAyB,CAAC,EAC9C,GAAG,EACH,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,EACL,YAAY,GACsB;IAClC,OAAO,MAAM,IAAI,OAAO,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AA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import _ from 'lodash'\nimport ArgvParser from './argv_parser'\nimport ProfileLoader from './profile_loader'\nimport shuffle from 'knuth-shuffle-seeded'\nimport { EventEmitter } from 'events'\nimport PickleFilter from '../pickle_filter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { doesHaveValue } from '../value_checker'\nimport OptionSplitter from './option_splitter'\nimport { Readable } from 'stream'\nimport { IdGenerator } from '@cucumber/messages'\nimport * as messages from '@cucumber/messages'\nimport createMeta from '@cucumber/create-meta'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { builtinParameterTypes } from '../support_code_library_builder'\n\nexport interface IGetExpandedArgvRequest {\n argv: string[]\n cwd: string\n}\n\nexport async function getExpandedArgv({\n argv,\n cwd,\n}: IGetExpandedArgvRequest): Promise<string[]> {\n const { options } = ArgvParser.parse(argv)\n let fullArgv = argv\n const profileArgv = await new ProfileLoader(cwd).getArgv(options.profile)\n if (profileArgv.length > 0) {\n fullArgv = _.concat(argv.slice(0, 2), profileArgv, argv.slice(2))\n }\n return fullArgv\n}\n\ninterface IParseGherkinMessageStreamRequest {\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\n\nexport async function parseGherkinMessageStream({\n cwd,\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n if (doesHaveValue(envelope.parseError)) {\n reject(\n new Error(\n `Parse error in '${envelope.parseError.source.uri}': ${envelope.parseError.message}`\n )\n )\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickleIds(result, order)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickleIds(pickleIds: string[], order: string): void {\n let [type, seed] = OptionSplitter.split(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n seed = Math.floor(Math.random() * 1000 * 1000).toString()\n console.warn(`Random order using seed: ${seed}`)\n }\n shuffle(pickleIds, seed)\n break\n default:\n throw new Error(\n 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter\n): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { version } = require('../../package.json')\n eventBroadcaster.emit('envelope', {\n meta: createMeta('cucumber-js', version, process.env),\n })\n}\n\nfunction emitParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (builtinParameterTypes.includes(parameterType.name)) {\n continue\n }\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: {\n uri: stepDefinition.uri,\n location: {\n line: stepDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: {\n uri: testCaseHookDefinition.uri,\n location: {\n line: testCaseHookDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: {\n uri: testRunHookDefinition.uri,\n location: {\n line: testRunHookDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: ISupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAsC;AACtC,sEAA4C;AAC5C,gFAA0C;AAI1C,oDAAgD;AAChD,wEAA8C;AAG9C,6DAA8C;AAC9C,wEAA8C;AAI9C,kFAAuE;AAOhE,KAAK,UAAU,eAAe,CAAC,EACpC,IAAI,EACJ,GAAG,GACqB;IACxB,MAAM,EAAE,OAAO,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC1C,IAAI,QAAQ,GAAG,IAAI,CAAA;IACnB,MAAM,WAAW,GAAG,MAAM,IAAI,wBAAa,CAAC,GAAG,CAAC,CAAC,OAAO,CACtD,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,MAAM,CACf,CAAA;IACD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;KACtE;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAdD,0CAcC;AAWM,KAAK,UAAU,yBAAyB,CAAC,EAC9C,GAAG,EACH,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,EACL,YAAY,GACsB;IAClC,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,MAAM,MAAM,G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mB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import ArgvParser from './argv_parser'\nimport ProfileLoader from './profile_loader'\nimport shuffle from 'knuth-shuffle-seeded'\nimport { EventEmitter } from 'events'\nimport PickleFilter from '../pickle_filter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { doesHaveValue } from '../value_checker'\nimport OptionSplitter from './option_splitter'\nimport { Readable } from 'stream'\nimport { IdGenerator } from '@cucumber/messages'\nimport * as messages from '@cucumber/messages'\nimport createMeta from '@cucumber/create-meta'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { builtinParameterTypes } from '../support_code_library_builder'\n\nexport interface IGetExpandedArgvRequest {\n argv: string[]\n cwd: string\n}\n\nexport async function getExpandedArgv({\n argv,\n cwd,\n}: IGetExpandedArgvRequest): Promise<string[]> {\n const { options } = ArgvParser.parse(argv)\n let fullArgv = argv\n const profileArgv = await new ProfileLoader(cwd).getArgv(\n options.profile,\n options.config\n )\n if (profileArgv.length > 0) {\n fullArgv = argv.slice(0, 2).concat(profileArgv).concat(argv.slice(2))\n }\n return fullArgv\n}\n\ninterface IParseGherkinMessageStreamRequest {\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\n\nexport async function parseGherkinMessageStream({\n cwd,\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n if (doesHaveValue(envelope.parseError)) {\n reject(\n new Error(\n `Parse error in '${envelope.parseError.source.uri}': ${envelope.parseError.message}`\n )\n )\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickleIds(result, order)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickleIds(pickleIds: string[], order: string): void {\n let [type, seed] = OptionSplitter.split(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n seed = Math.floor(Math.random() * 1000 * 1000).toString()\n console.warn(`Random order using seed: ${seed}`)\n }\n shuffle(pickleIds, seed)\n break\n default:\n throw new Error(\n 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\n}\n\nexport function isJavaScript(filePath: string): boolean {\n return (\n filePath.endsWith('.js') ||\n filePath.endsWith('.mjs') ||\n filePath.endsWith('.cjs')\n )\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter\n): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { version } = require('../../package.json')\n eventBroadcaster.emit('envelope', {\n meta: createMeta('cucumber-js', version, process.env),\n })\n}\n\nfunction emitParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (builtinParameterTypes.includes(parameterType.name)) {\n continue\n }\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: {\n uri: stepDefinition.uri,\n location: {\n line: stepDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: {\n uri: testCaseHookDefinition.uri,\n location: {\n line: testCaseHookDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: {\n uri: testRunHookDefinition.uri,\n location: {\n line: testRunHookDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: ISupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
package/lib/cli/i18n.js
CHANGED
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getKeywords = exports.getLanguages = void 0;
|
|
7
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const gherkin_1 = require("@cucumber/gherkin");
|
|
9
8
|
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
10
9
|
const capital_case_1 = require("capital-case");
|
|
11
10
|
const keywords = [
|
|
12
11
|
'feature',
|
|
12
|
+
'rule',
|
|
13
13
|
'background',
|
|
14
14
|
'scenario',
|
|
15
15
|
'scenarioOutline',
|
|
@@ -50,18 +50,18 @@ function getAsTable(header, rows) {
|
|
|
50
50
|
return table.toString();
|
|
51
51
|
}
|
|
52
52
|
function getLanguages() {
|
|
53
|
-
const rows =
|
|
53
|
+
const rows = Object.keys(gherkin_1.dialects).map((isoCode) => [
|
|
54
54
|
isoCode,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
gherkin_1.dialects[isoCode].name,
|
|
56
|
+
gherkin_1.dialects[isoCode].native,
|
|
57
57
|
]);
|
|
58
58
|
return getAsTable(['ISO 639-1', 'ENGLISH NAME', 'NATIVE NAME'], rows);
|
|
59
59
|
}
|
|
60
60
|
exports.getLanguages = getLanguages;
|
|
61
61
|
function getKeywords(isoCode) {
|
|
62
62
|
const language = gherkin_1.dialects[isoCode];
|
|
63
|
-
const rows =
|
|
64
|
-
const words =
|
|
63
|
+
const rows = keywords.map((keyword) => {
|
|
64
|
+
const words = language[keyword].map((s) => `"${s}"`).join(', ');
|
|
65
65
|
return [capital_case_1.capitalCase(keyword), words];
|
|
66
66
|
});
|
|
67
67
|
return getAsTable(['ENGLISH KEYWORD', 'NATIVE KEYWORDS'], rows);
|
package/lib/cli/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/cli/i18n.ts"],"names":[],"mappings":";;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/cli/i18n.ts"],"names":[],"mappings":";;;;;;AAAA,+CAA4C;AAC5C,4DAA8B;AAC9B,+CAA0C;AAE1C,MAAM,QAAQ,GAAG;IACf,SAAS;IACT,MAAM;IACN,YAAY;IACZ,UAAU;IACV,iBAAiB;IACjB,UAAU;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;CACG,CAAA;AAEV,SAAS,UAAU,CAAC,MAAgB,EAAE,IAAgB;IACpD,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,EAAE;YACT,WAAW,EAAE,EAAE;YACf,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,SAAS,E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-table3'\nimport { capitalCase } from 'capital-case'\n\nconst keywords = [\n 'feature',\n 'rule',\n 'background',\n 'scenario',\n 'scenarioOutline',\n 'examples',\n 'given',\n 'when',\n 'then',\n 'and',\n 'but',\n] as const\n\nfunction getAsTable(header: string[], rows: string[][]): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: ' | ',\n right: '',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 0,\n 'padding-right': 0,\n },\n })\n table.push(header)\n table.push(...rows)\n return table.toString()\n}\n\nexport function getLanguages(): string {\n const rows = Object.keys(dialects).map((isoCode) => [\n isoCode,\n dialects[isoCode].name,\n dialects[isoCode].native,\n ])\n return getAsTable(['ISO 639-1', 'ENGLISH NAME', 'NATIVE NAME'], rows)\n}\n\nexport function getKeywords(isoCode: string): string {\n const language = dialects[isoCode]\n const rows = keywords.map((keyword) => {\n const words = language[keyword].map((s) => `\"${s}\"`).join(', ')\n return [capitalCase(keyword), words]\n })\n return getAsTable(['ENGLISH KEYWORD', 'NATIVE KEYWORDS'], rows)\n}\n"]}
|
package/lib/cli/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export default class Cli {
|
|
|
33
33
|
});
|
|
34
34
|
getConfiguration(): Promise<IConfiguration>;
|
|
35
35
|
initializeFormatters({ eventBroadcaster, eventDataCollector, formatOptions, formats, supportCodeLibrary, }: IInitializeFormattersRequest): Promise<() => Promise<void>>;
|
|
36
|
-
getSupportCodeLibrary({ newId, supportCodeRequiredModules, supportCodePaths, }: IGetSupportCodeLibraryRequest): ISupportCodeLibrary
|
|
36
|
+
getSupportCodeLibrary({ newId, supportCodeRequiredModules, supportCodePaths, }: IGetSupportCodeLibraryRequest): Promise<ISupportCodeLibrary>;
|
|
37
37
|
run(): Promise<ICliRunResult>;
|
|
38
38
|
}
|
|
39
39
|
export {};
|