@lynxwall/cucumber-tsflow 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +27 -25
  2. package/bin/cucumber-tsflow +0 -0
  3. package/lib/behave.d.ts +1 -1
  4. package/lib/behave.js +27 -27
  5. package/lib/cli/argv-parser.d.ts +24 -24
  6. package/lib/cli/argv-parser.js +103 -103
  7. package/lib/cli/index.d.ts +22 -22
  8. package/lib/cli/index.js +100 -100
  9. package/lib/cli/load-configuration.d.ts +20 -20
  10. package/lib/cli/load-configuration.js +92 -92
  11. package/lib/cli/run.d.ts +1 -1
  12. package/lib/cli/run.js +47 -49
  13. package/lib/cucumber/binding-decorator.d.ts +10 -10
  14. package/lib/cucumber/binding-decorator.js +180 -180
  15. package/lib/cucumber/binding-registry.d.ts +82 -82
  16. package/lib/cucumber/binding-registry.js +215 -215
  17. package/lib/cucumber/hook-decorators.d.ts +46 -46
  18. package/lib/cucumber/hook-decorators.js +102 -102
  19. package/lib/cucumber/managed-scenario-context.d.ts +21 -21
  20. package/lib/cucumber/managed-scenario-context.js +95 -95
  21. package/lib/cucumber/message-collector.d.ts +81 -81
  22. package/lib/cucumber/message-collector.js +250 -250
  23. package/lib/cucumber/parallel/coordinator.d.ts +79 -79
  24. package/lib/cucumber/parallel/coordinator.js +246 -246
  25. package/lib/cucumber/parallel/run-worker.d.ts +1 -1
  26. package/lib/cucumber/parallel/run-worker.js +31 -31
  27. package/lib/cucumber/parallel/worker.d.ts +30 -30
  28. package/lib/cucumber/parallel/worker.js +103 -103
  29. package/lib/cucumber/run-cucumber.d.ts +14 -14
  30. package/lib/cucumber/run-cucumber.js +117 -117
  31. package/lib/cucumber/runtime.d.ts +25 -25
  32. package/lib/cucumber/runtime.js +39 -39
  33. package/lib/cucumber/step-definition-decorators.d.ts +24 -24
  34. package/lib/cucumber/step-definition-decorators.js +91 -91
  35. package/lib/cucumber/utils.d.ts +16 -16
  36. package/lib/cucumber/utils.js +77 -77
  37. package/lib/esnode.js +18 -18
  38. package/lib/esvue.d.ts +1 -1
  39. package/lib/esvue.js +40 -40
  40. package/lib/formatters/behave-json-formatter.d.ts +49 -49
  41. package/lib/formatters/behave-json-formatter.js +74 -74
  42. package/lib/formatters/tsflow-snippet-syntax.d.ts +9 -9
  43. package/lib/formatters/tsflow-snippet-syntax.js +89 -89
  44. package/lib/gherkin/configuration.d.ts +30 -30
  45. package/lib/gherkin/configuration.js +26 -26
  46. package/lib/gherkin/gherkin-feature.d.ts +28 -28
  47. package/lib/gherkin/gherkin-feature.js +333 -333
  48. package/lib/gherkin/gherkin-manager.d.ts +29 -29
  49. package/lib/gherkin/gherkin-manager.js +139 -114
  50. package/lib/gherkin/models.d.ts +45 -45
  51. package/lib/gherkin/models.js +2 -2
  52. package/lib/index.d.ts +4 -4
  53. package/lib/index.js +22 -22
  54. package/lib/snippet.d.ts +1 -1
  55. package/lib/snippet.js +27 -27
  56. package/lib/transpilers/esbuild-transpiler.d.ts +4 -4
  57. package/lib/transpilers/esbuild-transpiler.js +18 -18
  58. package/lib/transpilers/esbuild.d.ts +12 -12
  59. package/lib/transpilers/esbuild.js +54 -54
  60. package/lib/transpilers/vue-sfc/compiler.d.ts +7 -7
  61. package/lib/transpilers/vue-sfc/compiler.js +21 -21
  62. package/lib/transpilers/vue-sfc/index.d.ts +23 -23
  63. package/lib/transpilers/vue-sfc/index.js +46 -46
  64. package/lib/transpilers/vue-sfc/main.d.ts +8 -8
  65. package/lib/transpilers/vue-sfc/main.js +247 -247
  66. package/lib/transpilers/vue-sfc/script.d.ts +5 -5
  67. package/lib/transpilers/vue-sfc/script.js +41 -41
  68. package/lib/transpilers/vue-sfc/template.d.ts +8 -8
  69. package/lib/transpilers/vue-sfc/template.js +101 -101
  70. package/lib/transpilers/vue-sfc/types.d.ts +55 -55
  71. package/lib/transpilers/vue-sfc/types.js +2 -2
  72. package/lib/transpilers/vue-sfc/utils/descriptorCache.d.ts +13 -13
  73. package/lib/transpilers/vue-sfc/utils/descriptorCache.js +67 -67
  74. package/lib/transpilers/vue-sfc/utils/error.d.ts +3 -3
  75. package/lib/transpilers/vue-sfc/utils/error.js +22 -22
  76. package/lib/transpilers/vue-sfc/utils/query.d.ts +13 -13
  77. package/lib/transpilers/vue-sfc/utils/query.js +35 -35
  78. package/lib/tsnode.js +17 -17
  79. package/lib/tsvue.d.ts +1 -1
  80. package/lib/tsvue.js +39 -39
  81. package/lib/types/scenario-context.d.ts +16 -16
  82. package/lib/types/scenario-context.js +17 -17
  83. package/lib/types/scenario-info.d.ts +16 -16
  84. package/lib/types/scenario-info.js +22 -22
  85. package/lib/types/step-binding-flags.d.ts +53 -53
  86. package/lib/types/step-binding-flags.js +58 -58
  87. package/lib/types/step-binding.d.ts +50 -50
  88. package/lib/types/step-binding.js +17 -17
  89. package/lib/types/types.d.ts +21 -21
  90. package/lib/types/types.js +2 -2
  91. package/lib/utils/helpers.d.ts +6 -6
  92. package/lib/utils/helpers.js +17 -17
  93. package/lib/utils/logger.d.ts +3 -3
  94. package/lib/utils/logger.js +29 -29
  95. package/lib/utils/our-callsite.d.ts +27 -27
  96. package/lib/utils/our-callsite.js +72 -72
  97. package/lib/version.d.ts +1 -1
  98. package/lib/version.js +5 -5
  99. package/package.json +2 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # cucumber-tsflow
4
4
 
5
- Provides 'specflow' like bindings for CucumberJS 8.5.0+ in TypeScript 1.7+.
5
+ Provides 'specflow' like bindings for CucumberJS 9.1.0+ in TypeScript 4.0+.
6
6
 
7
7
  Supports Vue3 files in cucumber tests.
8
8
 
@@ -10,26 +10,28 @@ Supports Vue3 files in cucumber tests.
10
10
  This is a detached fork of <https://github.com/timjroberts/cucumber-js-tsflow>. It has had the <https://github.com/wudong/cucumber-js-tsflow/tree/before_after_all_hooks> branch merged into it, which adds support for beforeAll and afterAll hooks.
11
11
 
12
12
  In addition, the following features have been added:
13
- - Test runner using the cucumber-tsflow command
14
- - Uses underlying cucumber api to run tests
15
- - Typescript and esbuild transpiler support
16
- - Vue3 transformer used to handle .vue files in tests
17
- - Timeout in step definitions and hooks
18
- - WrapperOptions in step definitions
19
- - BeforeStep and AfterStep Hooks
20
- - Boolean custom definition added to cucumber expressions
21
- - Support for Parallel execution of tests
22
- - A behave-json-formatter that fixes json so it can be used with Behave Pro
23
- - tsflow-snippet-syntax used to format snippet examples
24
- - snippets use the [Cucumber Expressions](https://github.com/cucumber/cucumber-expressions#readme) Syntax for parameters
25
-
26
- <div style="padding: 15px; border: 1px solid transparent; border-color: transparent; margin-bottom: 20px; border-radius: 4px; color: #8a6d3b;; background-color: #fcf8e3; border-color: #faebcc;">
27
- <strong>Note:</strong> With recent updates you must use the <strong>cucumber-tsflow</strong> command to execute tests. This command executes the same API calls that cucumber-js does and supports all of the options and features as cucumber-js along with new features listed above.
13
+ - Test runner using the cucumber-tsflow command.
14
+ - Uses underlying cucumber api to run tests.
15
+ - Returns three exit codes:
16
+ - **0** = all scenarios passing, **1** = implemented scenarios are passing but there are pending, undefined or unknown scenario steps, **2** = one or more scenario steps have failed.
17
+ - Typescript and esbuild transpiler support.
18
+ - Vue3 transformer used to handle .vue files in tests.
19
+ - Timeout in step definitions and hooks.
20
+ - WrapperOptions in step definitions.
21
+ - BeforeStep and AfterStep Hooks.
22
+ - Boolean custom definition added to cucumber expressions.
23
+ - Support for Parallel execution of tests.
24
+ - A behave-json-formatter that fixes json so it can be used with Behave Pro.
25
+ - tsflow-snippet-syntax used to format snippet examples.
26
+ - snippets use the [Cucumber Expressions](https://github.com/cucumber/cucumber-expressions#readme) Syntax for parameters.
27
+
28
+ <div style="padding: 15px; border: 1px solid transparent; border-color: transparent; margin-bottom: 20px; border-radius: 4px; color: #8a6d3b; background-color: #fcf8e3; border-color: #faebcc;">
29
+ <strong><span style="color: #000">Note:</span></strong> With recent updates you must use the <strong><span style="color: #000">cucumber-tsflow</span></strong> command to execute tests. This command executes the same API calls that cucumber-js does and supports all of the options and features as cucumber-js along with new features listed above.
28
30
  </div>
29
31
 
30
32
  ## Quick Start
31
33
 
32
- cucumber-tsflow uses TypeScript Decorators to create SpecFlow like bindings for TypeScript classes and methods that allow those classes and methods to be used in your CucumberJS support files. As such, cucumber-tsflow has a dependency on CucumberJS and extends CucumberJS functionality. However, you can run your specifications using the cucumber-tsflow command line tool.
34
+ cucumber-tsflow uses TypeScript Decorators to create SpecFlow like bindings for TypeScript classes and methods that allow those classes and methods to be used in your CucumberJS support files. As such, cucumber-tsflow has a dependency on CucumberJS and extends CucumberJS functionality. However, you run your specifications using the cucumber-tsflow command line tool.
33
35
 
34
36
  ### Install @lynxwall/cucumber-tsflow
35
37
 
@@ -113,7 +115,7 @@ As mentioned previously, with recent updates cucumber-tsflow must be used to exe
113
115
 
114
116
  The following example demonstrates executing cucumber-tsflow from the command line to execute tests:
115
117
 
116
- ```bash
118
+ ```cmd
117
119
  C:\GitHub\cucumber-js-tsflow (dev -> origin)
118
120
  λ npx cucumber-tsflow
119
121
  Loading configuration and step definitions...
@@ -164,14 +166,14 @@ As mentioned, when using cucumber-tsflow to execute tests all of the configurati
164
166
 
165
167
  In addition to cucumber configuration options the following two options have been added:
166
168
 
167
- | Name | Type | Repeatable | CLI Option | Description | Default |
168
- |-------------------|------------|------------|---------------------------|-------------------------------------------------------------------------------------------------------------------|---------|
169
- | `transpiler` | `string` | No | `--transpiler` | Name of the transpiler to use: esnode, esvue, tsnode or tsvue | esnode |
170
- | `debugFile` | `string` | No | `--debug-file` | Path to a file with steps for debugging | |
169
+ | Name | Type | Repeatable | CLI Option | Description | Default |
170
+ | ------------ | -------- | ---------- | -------------- | ------------------------------------------------------------ | ------- |
171
+ | `transpiler` | `string` | No | `--transpiler` | Name of the transpiler to use: esnode, esvue, tsnode or tsvue | esnode |
172
+ | `debugFile` | `string` | No | `--debug-file` | Path to a file with steps for debugging | |
171
173
 
172
174
  #### Transpiler and Vue3 supported
173
175
 
174
- Using TypeScript with cucumberJs requires a couple of tsconfig.json parameters and the output needs to be commonJS as documented here: <https://github.com/cucumber/cucumber-js/blob/v8.0.0/docs/transpiling.md>
176
+ Using TypeScript with cucumberJs requires a couple of tsconfig.json parameters as described here: [Transpiling](https://github.com/cucumber/cucumber-js/blob/v9.1.0/docs/transpiling.md)
175
177
 
176
178
  As a result, cucumber-tsflow adds several configurations for transpiling TypeScript code using the recommended configuration. In addition, support has been added to transform .vue files during test execution allowing you to test Vue SFC components using cucumber.
177
179
 
@@ -376,7 +378,7 @@ class MySteps {
376
378
  public beforeAllScenarios(): void {
377
379
  ...
378
380
  }
379
-
381
+
380
382
  @before("@requireTempDir")
381
383
  public async beforeAllScenariosRequiringTempDirectory(): Promise<void> {
382
384
  let tempDirInfo = await this.createTemporaryDirectory();
@@ -441,7 +443,7 @@ In step definition, we can pass additional wrapper options to cucumber js. For e
441
443
  @given('I perform a search using the value {string}', undefined, undefined, {retry: 2})
442
444
  public givenAValueBasedSearch(searchValue: string): void {
443
445
  ...
444
- // this step will be retried by cucumber js
446
+ // this step will be retried by cucumber js
445
447
  ...
446
448
  }
447
449
 
File without changes
package/lib/behave.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/lib/behave.js CHANGED
@@ -1,28 +1,28 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const behave = __importStar(require("./formatters/behave-json-formatter"));
27
- module.exports = behave;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const behave = __importStar(require("./formatters/behave-json-formatter"));
27
+ module.exports = behave;
28
28
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVoYXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2JlaGF2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkVBQTZEO0FBRTdELE1BQU0sQ0FBQyxPQUFPLEdBQUcsTUFBTSxDQUFDIn0=
@@ -1,24 +1,24 @@
1
- import { IConfiguration } from '@cucumber/cucumber/lib/configuration/types';
2
- export interface IParsedArgvOptions {
3
- config?: string;
4
- i18nKeywords?: string;
5
- i18nLanguages?: boolean;
6
- profile?: string[];
7
- }
8
- export interface ITsflowConfiguration extends IConfiguration {
9
- debugFile: string;
10
- transpiler: string;
11
- }
12
- export interface IParsedArgv {
13
- options: IParsedArgvOptions;
14
- configuration: Partial<ITsflowConfiguration>;
15
- }
16
- declare const ArgvParser: {
17
- collect<T>(val: T, memo?: T[]): T[] | undefined;
18
- mergeJson(option: string): (str: string, memo?: object) => object;
19
- mergeTags(value: string, memo?: string): string;
20
- validateCountOption(value: string, optionName: string): number;
21
- validateLanguage(value: string): string;
22
- parse(argv: string[]): IParsedArgv;
23
- };
24
- export default ArgvParser;
1
+ import { IConfiguration } from '@cucumber/cucumber/lib/configuration/types';
2
+ export interface IParsedArgvOptions {
3
+ config?: string;
4
+ i18nKeywords?: string;
5
+ i18nLanguages?: boolean;
6
+ profile?: string[];
7
+ }
8
+ export interface ITsflowConfiguration extends IConfiguration {
9
+ debugFile: string;
10
+ transpiler: string;
11
+ }
12
+ export interface IParsedArgv {
13
+ options: IParsedArgvOptions;
14
+ configuration: Partial<ITsflowConfiguration>;
15
+ }
16
+ declare const ArgvParser: {
17
+ collect<T>(val: T, memo?: T[]): T[] | undefined;
18
+ mergeJson(option: string): (str: string, memo?: object) => object;
19
+ mergeTags(value: string, memo?: string): string;
20
+ validateCountOption(value: string, optionName: string): number;
21
+ validateLanguage(value: string): string;
22
+ parse(argv: string[]): IParsedArgv;
23
+ };
24
+ export default ArgvParser;
@@ -1,107 +1,107 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const commander_1 = require("commander");
7
- const lodash_merge_1 = __importDefault(require("lodash.merge"));
8
- const path_1 = __importDefault(require("path"));
9
- const gherkin_1 = require("@cucumber/gherkin");
10
- const formatters_1 = __importDefault(require("@cucumber/cucumber/lib/formatter/helpers/formatters"));
11
- const version_1 = require("../version");
12
- const ArgvParser = {
13
- collect(val, memo = []) {
14
- if (val) {
15
- return [...memo, val];
16
- }
17
- return undefined;
18
- },
19
- mergeJson(option) {
20
- return function (str, memo = {}) {
21
- let val;
22
- try {
23
- val = JSON.parse(str);
24
- }
25
- catch (error) {
26
- const e = error;
27
- throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`);
28
- }
29
- if (typeof val !== 'object' || Array.isArray(val)) {
30
- throw new Error(`${option} must be passed JSON of an object: ${str}`);
31
- }
32
- return (0, lodash_merge_1.default)(memo, val);
33
- };
34
- },
35
- mergeTags(value, memo) {
36
- return memo ? `${memo} and (${value})` : `(${value})`;
37
- },
38
- validateCountOption(value, optionName) {
39
- const numericValue = parseInt(value);
40
- if (isNaN(numericValue) || numericValue < 0) {
41
- throw new Error(`${optionName} must be a non negative integer`);
42
- }
43
- return numericValue;
44
- },
45
- validateLanguage(value) {
46
- if (!Object.keys(gherkin_1.dialects).includes(value)) {
47
- throw new Error(`Unsupported ISO 639-1: ${value}`);
48
- }
49
- return value;
50
- },
51
- parse(argv) {
52
- const program = new commander_1.Command(path_1.default.basename(argv[1]));
53
- program
54
- .storeOptionsAsProperties(false)
55
- .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')
56
- .version(version_1.version, '-v, --version')
57
- .option('-b, --backtrace', 'show full backtrace for errors')
58
- .option('-c, --config <PATH>', 'specify configuration file')
59
- .option('-d, --dry-run', 'invoke formatters without executing steps')
60
- .option('--debug-file <STRING>', 'path to a file with steps for debugging')
61
- .option('--exit, --force-exit', 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit')
62
- .option('--fail-fast', 'abort the run on first failure')
63
- .option('-f, --format <TYPE[:PATH]>', 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\n' +
64
- formatters_1.default.buildFormattersDocumentationString(), ArgvParser.collect)
65
- .option('--format-options <JSON>', 'provide options for formatters (repeatable)', ArgvParser.mergeJson('--format-options'))
66
- .option('--i18n-keywords <ISO 639-1>', 'list language keywords', ArgvParser.validateLanguage)
67
- .option('--i18n-languages', 'list languages')
68
- .option('-i, --import <GLOB|DIR|FILE>', 'import files before executing features (repeatable)', ArgvParser.collect)
69
- .option('--language <ISO 639-1>', 'provide the default language for feature files')
70
- .option('--name <REGEXP>', 'only execute the scenarios with name matching the expression (repeatable)', ArgvParser.collect)
71
- .option('--order <TYPE[:SEED]>', 'run scenarios in the specified order. Type should be `defined` or `random`')
72
- .option('-p, --profile <NAME>', 'specify the profile to use (repeatable)', ArgvParser.collect, [])
73
- .option('--parallel <NUMBER_OF_WORKERS>', 'run in parallel with the given number of workers', val => ArgvParser.validateCountOption(val, '--parallel'))
74
- .option('--publish', 'Publish a report to https://reports.cucumber.io')
75
- .option('--publish-quiet', "Don't print information banner about publishing reports")
76
- .option('-r, --require <GLOB|DIR|FILE>', 'require files before executing features (repeatable)', ArgvParser.collect)
77
- .option('--require-module <NODE_MODULE>', 'require node modules before requiring files (repeatable)', ArgvParser.collect)
78
- .option('--retry <NUMBER_OF_RETRIES>', 'specify the number of times to retry failing test cases (default: 0)', val => ArgvParser.validateCountOption(val, '--retry'))
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const lodash_merge_1 = __importDefault(require("lodash.merge"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const gherkin_1 = require("@cucumber/gherkin");
10
+ const formatters_1 = __importDefault(require("@cucumber/cucumber/lib/formatter/helpers/formatters"));
11
+ const version_1 = require("../version");
12
+ const ArgvParser = {
13
+ collect(val, memo = []) {
14
+ if (val) {
15
+ return [...memo, val];
16
+ }
17
+ return undefined;
18
+ },
19
+ mergeJson(option) {
20
+ return function (str, memo = {}) {
21
+ let val;
22
+ try {
23
+ val = JSON.parse(str);
24
+ }
25
+ catch (error) {
26
+ const e = error;
27
+ throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`);
28
+ }
29
+ if (typeof val !== 'object' || Array.isArray(val)) {
30
+ throw new Error(`${option} must be passed JSON of an object: ${str}`);
31
+ }
32
+ return (0, lodash_merge_1.default)(memo, val);
33
+ };
34
+ },
35
+ mergeTags(value, memo) {
36
+ return memo ? `${memo} and (${value})` : `(${value})`;
37
+ },
38
+ validateCountOption(value, optionName) {
39
+ const numericValue = parseInt(value);
40
+ if (isNaN(numericValue) || numericValue < 0) {
41
+ throw new Error(`${optionName} must be a non negative integer`);
42
+ }
43
+ return numericValue;
44
+ },
45
+ validateLanguage(value) {
46
+ if (!Object.keys(gherkin_1.dialects).includes(value)) {
47
+ throw new Error(`Unsupported ISO 639-1: ${value}`);
48
+ }
49
+ return value;
50
+ },
51
+ parse(argv) {
52
+ const program = new commander_1.Command(path_1.default.basename(argv[1]));
53
+ program
54
+ .storeOptionsAsProperties(false)
55
+ .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')
56
+ .version(version_1.version, '-v, --version')
57
+ .option('-b, --backtrace', 'show full backtrace for errors')
58
+ .option('-c, --config <PATH>', 'specify configuration file')
59
+ .option('-d, --dry-run', 'invoke formatters without executing steps')
60
+ .option('--debug-file <STRING>', 'path to a file with steps for debugging')
61
+ .option('--exit, --force-exit', 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit')
62
+ .option('--fail-fast', 'abort the run on first failure')
63
+ .option('-f, --format <TYPE[:PATH]>', 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\n' +
64
+ formatters_1.default.buildFormattersDocumentationString(), ArgvParser.collect)
65
+ .option('--format-options <JSON>', 'provide options for formatters (repeatable)', ArgvParser.mergeJson('--format-options'))
66
+ .option('--i18n-keywords <ISO 639-1>', 'list language keywords', ArgvParser.validateLanguage)
67
+ .option('--i18n-languages', 'list languages')
68
+ .option('-i, --import <GLOB|DIR|FILE>', 'import files before executing features (repeatable)', ArgvParser.collect)
69
+ .option('--language <ISO 639-1>', 'provide the default language for feature files')
70
+ .option('--name <REGEXP>', 'only execute the scenarios with name matching the expression (repeatable)', ArgvParser.collect)
71
+ .option('--order <TYPE[:SEED]>', 'run scenarios in the specified order. Type should be `defined` or `random`')
72
+ .option('-p, --profile <NAME>', 'specify the profile to use (repeatable)', ArgvParser.collect, [])
73
+ .option('--parallel <NUMBER_OF_WORKERS>', 'run in parallel with the given number of workers', val => ArgvParser.validateCountOption(val, '--parallel'))
74
+ .option('--publish', 'Publish a report to https://reports.cucumber.io')
75
+ .option('--publish-quiet', "Don't print information banner about publishing reports")
76
+ .option('-r, --require <GLOB|DIR|FILE>', 'require files before executing features (repeatable)', ArgvParser.collect)
77
+ .option('--require-module <NODE_MODULE>', 'require node modules before requiring files (repeatable)', ArgvParser.collect)
78
+ .option('--retry <NUMBER_OF_RETRIES>', 'specify the number of times to retry failing test cases (default: 0)', val => ArgvParser.validateCountOption(val, '--retry'))
79
79
  .option('--retry-tag-filter <EXPRESSION>', `only retries the features or scenarios with tags matching the expression (repeatable).
80
- This option requires '--retry' to be specified.`, ArgvParser.mergeTags)
81
- .option('--strict', 'fail if there are pending steps')
82
- .option('--no-strict', 'succeed even if there are pending steps')
83
- .option('-t, --tags <EXPRESSION>', 'only execute the features or scenarios with tags matching the expression (repeatable)', ArgvParser.mergeTags)
80
+ This option requires '--retry' to be specified.`, ArgvParser.mergeTags)
81
+ .option('--strict', 'fail if there are pending steps')
82
+ .option('--no-strict', 'succeed even if there are pending steps')
83
+ .option('-t, --tags <EXPRESSION>', 'only execute the features or scenarios with tags matching the expression (repeatable)', ArgvParser.mergeTags)
84
84
  .option('--transpiler <ESNODE|TSNODE|ESVUE|TSVUE>', `built-in transpiler to use. ESxxx transpilers use esbuild and TSxxx transpilers use typescript.\n
85
85
  Vue versions of the transpilers add a hook for .vue transforms and initialize jsdom globally.\n
86
- Default: ESNODE (esbuild without Vue support)`)
87
- .option('--world-parameters <JSON>', 'provide parameters that will be passed to the world constructor (repeatable)', ArgvParser.mergeJson('--world-parameters'));
88
- program.addHelpText('afterAll', 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md');
89
- program.parse(argv);
90
- const { config, i18nKeywords, i18nLanguages, profile, ...regularStuff } = program.opts();
91
- const configuration = regularStuff;
92
- if (program.args.length > 0) {
93
- configuration.paths = program.args;
94
- }
95
- return {
96
- options: {
97
- config,
98
- i18nKeywords,
99
- i18nLanguages,
100
- profile
101
- },
102
- configuration
103
- };
104
- }
105
- };
106
- exports.default = ArgvParser;
86
+ Default: ESNODE (esbuild without Vue support)`)
87
+ .option('--world-parameters <JSON>', 'provide parameters that will be passed to the world constructor (repeatable)', ArgvParser.mergeJson('--world-parameters'));
88
+ program.addHelpText('afterAll', 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md');
89
+ program.parse(argv);
90
+ const { config, i18nKeywords, i18nLanguages, profile, ...regularStuff } = program.opts();
91
+ const configuration = regularStuff;
92
+ if (program.args.length > 0) {
93
+ configuration.paths = program.args;
94
+ }
95
+ return {
96
+ options: {
97
+ config,
98
+ i18nKeywords,
99
+ i18nLanguages,
100
+ profile
101
+ },
102
+ configuration
103
+ };
104
+ }
105
+ };
106
+ exports.default = ArgvParser;
107
107
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJndi1wYXJzZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL2FyZ3YtcGFyc2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEseUNBQW9DO0FBQ3BDLGdFQUFpQztBQUNqQyxnREFBd0I7QUFDeEIsK0NBQTZDO0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ksRUFBRSxhQUFhLEVBQUUsT0FBTyxFQUFFLEdBQUcsWUFBWSxFQUFFLEdBQW9CLE9BQU8sQ0FBQyxJQUFJLEVBQUUsQ0FBQztRQUMxRyxNQUFNLGFBQWEsR0FBa0MsWUFBWSxDQUFDO1FBQ2xFLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxNQUFNLEdBQUcsQ0FBQyxFQUFFO1lBQzVCLGFBQWEsQ0FBQyxLQUFLLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQztTQUNuQztRQUVELE9BQU87WUFDTixPQUFPLEVBQUU7Z0JBQ1IsTUFBTTtnQkFDTixZQUFZO2dCQUNaLGFBQWE7Z0JBQ2IsT0FBTzthQUNQO1lBQ0QsYUFBYTtTQUNiLENBQUM7SUFDSCxDQUFDO0NBQ0QsQ0FBQztBQUVGLGtCQUFlLFVBQVUsQ0FBQyJ9
@@ -1,22 +1,22 @@
1
- /// <reference types="node" />
2
- import { IFormatterStream } from '@cucumber/cucumber/lib/formatter';
3
- export interface ICliRunResult {
4
- shouldAdvertisePublish: boolean;
5
- shouldExitImmediately: boolean;
6
- success: boolean;
7
- }
8
- export default class Cli {
9
- private readonly argv;
10
- private readonly cwd;
11
- private readonly stdout;
12
- private readonly stderr;
13
- private readonly env;
14
- constructor({ argv, cwd, stdout, stderr, env }: {
15
- argv: string[];
16
- cwd: string;
17
- stdout: IFormatterStream;
18
- stderr: IFormatterStream;
19
- env: NodeJS.ProcessEnv;
20
- });
21
- run(): Promise<ICliRunResult>;
22
- }
1
+ /// <reference types="node" />
2
+ import { IFormatterStream } from '@cucumber/cucumber/lib/formatter';
3
+ export interface ICliRunResult {
4
+ shouldAdvertisePublish: boolean;
5
+ shouldExitImmediately: boolean;
6
+ success: boolean;
7
+ }
8
+ export default class Cli {
9
+ private readonly argv;
10
+ private readonly cwd;
11
+ private readonly stdout;
12
+ private readonly stderr;
13
+ private readonly env;
14
+ constructor({ argv, cwd, stdout, stderr, env }: {
15
+ argv: string[];
16
+ cwd: string;
17
+ stdout: IFormatterStream;
18
+ stderr: IFormatterStream;
19
+ env: NodeJS.ProcessEnv;
20
+ });
21
+ run(): Promise<ICliRunResult>;
22
+ }