@cucumber/cucumber 7.3.0 → 8.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/README.md +11 -4
  2. package/lib/cli/argv_parser.d.ts +3 -3
  3. package/lib/cli/argv_parser.js +19 -19
  4. package/lib/cli/argv_parser.js.map +1 -1
  5. package/lib/cli/configuration_builder.d.ts +5 -46
  6. package/lib/cli/configuration_builder.js +61 -150
  7. package/lib/cli/configuration_builder.js.map +1 -1
  8. package/lib/cli/helpers.d.ts +5 -3
  9. package/lib/cli/helpers.js +42 -15
  10. package/lib/cli/helpers.js.map +1 -1
  11. package/lib/cli/i18n.js +7 -7
  12. package/lib/cli/i18n.js.map +1 -1
  13. package/lib/cli/index.d.ts +4 -23
  14. package/lib/cli/index.js +18 -193
  15. package/lib/cli/index.js.map +1 -1
  16. package/lib/cli/install_validator.js +1 -1
  17. package/lib/cli/install_validator.js.map +1 -1
  18. package/lib/cli/option_splitter.js +1 -0
  19. package/lib/cli/option_splitter.js.map +1 -1
  20. package/lib/cli/profile_loader.d.ts +3 -2
  21. package/lib/cli/profile_loader.js +20 -13
  22. package/lib/cli/profile_loader.js.map +1 -1
  23. package/lib/cli/publish_banner.js +1 -1
  24. package/lib/cli/publish_banner.js.map +1 -1
  25. package/lib/cli/run.js +3 -4
  26. package/lib/cli/run.js.map +1 -1
  27. package/lib/configuration/index.d.ts +1 -0
  28. package/lib/configuration/index.js +14 -0
  29. package/lib/configuration/index.js.map +1 -0
  30. package/lib/configuration/types.d.ts +29 -0
  31. package/lib/configuration/types.js +3 -0
  32. package/lib/configuration/types.js.map +1 -0
  33. package/lib/formatter/builder.d.ts +5 -4
  34. package/lib/formatter/builder.js +41 -55
  35. package/lib/formatter/builder.js.map +1 -1
  36. package/lib/formatter/get_color_fns.d.ts +4 -0
  37. package/lib/formatter/get_color_fns.js +11 -4
  38. package/lib/formatter/get_color_fns.js.map +1 -1
  39. package/lib/formatter/helpers/event_data_collector.d.ts +2 -1
  40. package/lib/formatter/helpers/event_data_collector.js +16 -15
  41. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  42. package/lib/formatter/helpers/formatters.d.ts +6 -0
  43. package/lib/formatter/helpers/formatters.js +41 -0
  44. package/lib/formatter/helpers/formatters.js.map +1 -0
  45. package/lib/formatter/helpers/gherkin_document_parser.js +29 -42
  46. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
  47. package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
  48. package/lib/formatter/helpers/issue_helpers.js +6 -7
  49. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  50. package/lib/formatter/helpers/keyword_type.js +2 -6
  51. package/lib/formatter/helpers/keyword_type.js.map +1 -1
  52. package/lib/formatter/helpers/location_helpers.js +1 -1
  53. package/lib/formatter/helpers/location_helpers.js.map +1 -1
  54. package/lib/formatter/helpers/pickle_parser.js +9 -18
  55. package/lib/formatter/helpers/pickle_parser.js.map +1 -1
  56. package/lib/formatter/helpers/step_argument_formatter.js +1 -1
  57. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
  58. package/lib/formatter/helpers/summary_helpers.js +8 -7
  59. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  60. package/lib/formatter/helpers/test_case_attempt_formatter.js +12 -12
  61. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  62. package/lib/formatter/helpers/test_case_attempt_parser.js +17 -20
  63. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  64. package/lib/formatter/helpers/usage_helpers/index.js +26 -40
  65. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  66. package/lib/formatter/html_formatter.d.ts +1 -0
  67. package/lib/formatter/html_formatter.js +5 -4
  68. package/lib/formatter/html_formatter.js.map +1 -1
  69. package/lib/formatter/http_stream.js +7 -7
  70. package/lib/formatter/http_stream.js.map +1 -1
  71. package/lib/formatter/index.d.ts +1 -0
  72. package/lib/formatter/index.js.map +1 -1
  73. package/lib/formatter/json_formatter.d.ts +1 -0
  74. package/lib/formatter/json_formatter.js +25 -20
  75. package/lib/formatter/json_formatter.js.map +1 -1
  76. package/lib/formatter/message_formatter.d.ts +1 -0
  77. package/lib/formatter/message_formatter.js +1 -0
  78. package/lib/formatter/message_formatter.js.map +1 -1
  79. package/lib/formatter/progress_bar_formatter.d.ts +1 -0
  80. package/lib/formatter/progress_bar_formatter.js +17 -16
  81. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  82. package/lib/formatter/progress_formatter.d.ts +1 -0
  83. package/lib/formatter/progress_formatter.js +3 -2
  84. package/lib/formatter/progress_formatter.js.map +1 -1
  85. package/lib/formatter/publish.d.ts +1 -0
  86. package/lib/formatter/publish.js +5 -0
  87. package/lib/formatter/publish.js.map +1 -0
  88. package/lib/formatter/rerun_formatter.d.ts +1 -0
  89. package/lib/formatter/rerun_formatter.js +15 -11
  90. package/lib/formatter/rerun_formatter.js.map +1 -1
  91. package/lib/formatter/snippets_formatter.d.ts +1 -0
  92. package/lib/formatter/snippets_formatter.js +3 -2
  93. package/lib/formatter/snippets_formatter.js.map +1 -1
  94. package/lib/formatter/step_definition_snippet_builder/index.js +2 -2
  95. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
  96. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
  97. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  98. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
  99. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
  100. package/lib/formatter/summary_formatter.d.ts +1 -0
  101. package/lib/formatter/summary_formatter.js +10 -10
  102. package/lib/formatter/summary_formatter.js.map +1 -1
  103. package/lib/formatter/usage_formatter.d.ts +1 -0
  104. package/lib/formatter/usage_formatter.js +9 -9
  105. package/lib/formatter/usage_formatter.js.map +1 -1
  106. package/lib/formatter/usage_json_formatter.d.ts +1 -0
  107. package/lib/formatter/usage_json_formatter.js +3 -2
  108. package/lib/formatter/usage_json_formatter.js.map +1 -1
  109. package/lib/importer.js +13 -0
  110. package/lib/index.d.ts +2 -0
  111. package/lib/index.js +6 -1
  112. package/lib/index.js.map +1 -1
  113. package/lib/models/data_table.js +9 -7
  114. package/lib/models/data_table.js.map +1 -1
  115. package/lib/models/step_definition.js +4 -5
  116. package/lib/models/step_definition.js.map +1 -1
  117. package/lib/pickle_filter.js +13 -13
  118. package/lib/pickle_filter.js.map +1 -1
  119. package/lib/run/formatters.d.ts +14 -0
  120. package/lib/run/formatters.js +76 -0
  121. package/lib/run/formatters.js.map +1 -0
  122. package/lib/run/index.d.ts +2 -0
  123. package/lib/run/index.js +15 -0
  124. package/lib/run/index.js.map +1 -0
  125. package/lib/run/paths.d.ts +6 -0
  126. package/lib/run/paths.js +83 -0
  127. package/lib/run/paths.js.map +1 -0
  128. package/lib/run/runCucumber.d.ts +3 -0
  129. package/lib/run/runCucumber.js +88 -0
  130. package/lib/run/runCucumber.js.map +1 -0
  131. package/lib/run/runtime.d.ts +19 -0
  132. package/lib/run/runtime.js +58 -0
  133. package/lib/run/runtime.js.map +1 -0
  134. package/lib/run/support.d.ts +8 -0
  135. package/lib/run/support.js +26 -0
  136. package/lib/run/support.js.map +1 -0
  137. package/lib/run/types.d.ts +12 -0
  138. package/lib/run/types.js +3 -0
  139. package/lib/run/types.js.map +1 -0
  140. package/lib/runtime/assemble_test_cases.js +3 -3
  141. package/lib/runtime/assemble_test_cases.js.map +1 -1
  142. package/lib/runtime/attachment_manager/index.js +4 -4
  143. package/lib/runtime/attachment_manager/index.js.map +1 -1
  144. package/lib/runtime/helpers.d.ts +1 -0
  145. package/lib/runtime/helpers.js +42 -4
  146. package/lib/runtime/helpers.js.map +1 -1
  147. package/lib/runtime/index.d.ts +5 -3
  148. package/lib/runtime/index.js +22 -46
  149. package/lib/runtime/index.js.map +1 -1
  150. package/lib/runtime/parallel/coordinator.d.ts +6 -5
  151. package/lib/runtime/parallel/coordinator.js +19 -22
  152. package/lib/runtime/parallel/coordinator.js.map +1 -1
  153. package/lib/runtime/parallel/run_worker.js +1 -1
  154. package/lib/runtime/parallel/run_worker.js.map +1 -1
  155. package/lib/runtime/parallel/worker.js +21 -13
  156. package/lib/runtime/parallel/worker.js.map +1 -1
  157. package/lib/runtime/step_runner.js +5 -7
  158. package/lib/runtime/step_runner.js.map +1 -1
  159. package/lib/runtime/stopwatch.js +4 -4
  160. package/lib/runtime/stopwatch.js.map +1 -1
  161. package/lib/runtime/test_case_runner.d.ts +3 -3
  162. package/lib/runtime/test_case_runner.js +19 -28
  163. package/lib/runtime/test_case_runner.js.map +1 -1
  164. package/lib/stack_trace_filter.js +6 -7
  165. package/lib/stack_trace_filter.js.map +1 -1
  166. package/lib/step_arguments.js +2 -2
  167. package/lib/step_arguments.js.map +1 -1
  168. package/lib/support_code_library_builder/{build_helpers.d.ts → build_parameter_type.d.ts} +0 -2
  169. package/lib/support_code_library_builder/build_parameter_type.js +13 -0
  170. package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
  171. package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
  172. package/lib/support_code_library_builder/get_definition_line_and_uri.js +30 -0
  173. package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
  174. package/lib/support_code_library_builder/index.js +18 -31
  175. package/lib/support_code_library_builder/index.js.map +1 -1
  176. package/lib/support_code_library_builder/types.d.ts +2 -1
  177. package/lib/support_code_library_builder/types.js.map +1 -1
  178. package/lib/support_code_library_builder/validate_arguments.js +14 -19
  179. package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
  180. package/lib/time.d.ts +1 -0
  181. package/lib/time.js +17 -2
  182. package/lib/time.js.map +1 -1
  183. package/lib/user_code_runner.js +10 -17
  184. package/lib/user_code_runner.js.map +1 -1
  185. package/lib/value_checker.d.ts +2 -2
  186. package/lib/value_checker.js.map +1 -1
  187. package/lib/version.d.ts +1 -0
  188. package/lib/version.js +6 -0
  189. package/lib/version.js.map +1 -0
  190. package/lib/wrapper.mjs +38 -0
  191. package/package.json +77 -67
  192. package/CHANGELOG.md +0 -1908
  193. package/lib/support_code_library_builder/build_helpers.js +0 -41
  194. package/lib/support_code_library_builder/build_helpers.js.map +0 -1
  195. package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
  196. package/lib/support_code_library_builder/finalize_helpers.js +0 -26
  197. package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.buildParameterType = exports.getDefinitionLineAndUri = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const cucumber_expressions_1 = require("@cucumber/cucumber-expressions");
9
- const path_1 = __importDefault(require("path"));
10
- const stacktrace_js_1 = __importDefault(require("stacktrace-js"));
11
- const stack_trace_filter_1 = require("../stack_trace_filter");
12
- const value_checker_1 = require("../value_checker");
13
- function getDefinitionLineAndUri(cwd) {
14
- let line;
15
- let uri;
16
- const stackframes = stacktrace_js_1.default.getSync();
17
- const stackframe = lodash_1.default.find(stackframes, (frame) => {
18
- return !stack_trace_filter_1.isFileNameInCucumber(frame.getFileName());
19
- });
20
- if (value_checker_1.doesHaveValue(stackframe)) {
21
- line = stackframe.getLineNumber();
22
- uri = stackframe.getFileName();
23
- if (value_checker_1.doesHaveValue(uri)) {
24
- uri = path_1.default.relative(cwd, uri);
25
- }
26
- }
27
- return {
28
- line: value_checker_1.valueOrDefault(line, 0),
29
- uri: value_checker_1.valueOrDefault(uri, 'unknown'),
30
- };
31
- }
32
- exports.getDefinitionLineAndUri = getDefinitionLineAndUri;
33
- function buildParameterType({ name, regexp, transformer, useForSnippets, preferForRegexpMatch, }) {
34
- if (typeof useForSnippets !== 'boolean')
35
- useForSnippets = true;
36
- if (typeof preferForRegexpMatch !== 'boolean')
37
- preferForRegexpMatch = false;
38
- return new cucumber_expressions_1.ParameterType(name, regexp, null, transformer, useForSnippets, preferForRegexpMatch);
39
- }
40
- exports.buildParameterType = buildParameterType;
41
- //# sourceMappingURL=build_helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build_helpers.js","sourceRoot":"","sources":["../../src/support_code_library_builder/build_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AACtB,yEAA8D;AAC9D,gDAAuB;AACvB,kEAAsC;AACtC,8DAA4D;AAC5D,oDAAgE;AAIhE,SAAgB,uBAAuB,CAAC,GAAW;IACjD,IAAI,IAAY,CAAA;IAChB,IAAI,GAAW,CAAA;IACf,MAAM,WAAW,GAAG,uBAAU,CAAC,OAAO,EAAE,CAAA;IACxC,MAAM,UAAU,GAAG,gBAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;QAC/C,OAAO,CAAC,yCAAoB,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;IACF,IAAI,6BAAa,CAAC,UAAU,CAAC,EAAE;QAC7B,IAAI,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;QACjC,GAAG,GAAG,UAAU,CAAC,WAAW,EAAE,CAAA;QAC9B,IAAI,6BAAa,CAAC,GAAG,CAAC,EAAE;YACtB,GAAG,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;SAC9B;KACF;IACD,OAAO;QACL,IAAI,EAAE,8BAAc,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7B,GAAG,EAAE,8BAAc,CAAC,GAAG,EAAE,SAAS,CAAC;KACpC,CAAA;AACH,CAAC;AAlBD,0DAkBC;AAED,SAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,MAAM,EACN,WAAW,EACX,cAAc,EACd,oBAAoB,GACU;IAC9B,IAAI,OAAO,cAAc,KAAK,SAAS;QAAE,cAAc,GAAG,IAAI,CAAA;IAC9D,IAAI,OAAO,oBAAoB,KAAK,SAAS;QAAE,oBAAoB,GAAG,KAAK,CAAA;IAC3E,OAAO,IAAI,oCAAa,CACtB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,WAAW,EACX,cAAc,EACd,oBAAoB,CACrB,CAAA;AACH,CAAC;AAjBD,gDAiBC","sourcesContent":["import _ from 'lodash'\nimport { ParameterType } from '@cucumber/cucumber-expressions'\nimport path from 'path'\nimport StackTrace from 'stacktrace-js'\nimport { isFileNameInCucumber } from '../stack_trace_filter'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport { ILineAndUri } from '../types'\nimport { IParameterTypeDefinition } from './types'\n\nexport function getDefinitionLineAndUri(cwd: string): ILineAndUri {\n let line: number\n let uri: string\n const stackframes = StackTrace.getSync()\n const stackframe = _.find(stackframes, (frame) => {\n return !isFileNameInCucumber(frame.getFileName())\n })\n if (doesHaveValue(stackframe)) {\n line = stackframe.getLineNumber()\n uri = stackframe.getFileName()\n if (doesHaveValue(uri)) {\n uri = path.relative(cwd, uri)\n }\n }\n return {\n line: valueOrDefault(line, 0),\n uri: valueOrDefault(uri, 'unknown'),\n }\n}\n\nexport function buildParameterType({\n name,\n regexp,\n transformer,\n useForSnippets,\n preferForRegexpMatch,\n}: IParameterTypeDefinition<any>): ParameterType<any> {\n if (typeof useForSnippets !== 'boolean') useForSnippets = true\n if (typeof preferForRegexpMatch !== 'boolean') preferForRegexpMatch = false\n return new ParameterType(\n name,\n regexp,\n null,\n transformer,\n useForSnippets,\n preferForRegexpMatch\n )\n}\n"]}
@@ -1,10 +0,0 @@
1
- export interface IDefinitionConfig {
2
- code: any;
3
- line: number;
4
- uri: string;
5
- }
6
- export interface IValidateNoGeneratorFunctionsRequest {
7
- cwd: string;
8
- definitionConfigs: IDefinitionConfig[];
9
- }
10
- export declare function validateNoGeneratorFunctions({ cwd, definitionConfigs, }: IValidateNoGeneratorFunctionsRequest): void;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateNoGeneratorFunctions = void 0;
7
- const is_generator_1 = __importDefault(require("is-generator"));
8
- const path_1 = __importDefault(require("path"));
9
- function validateNoGeneratorFunctions({ cwd, definitionConfigs, }) {
10
- const generatorDefinitionConfigs = definitionConfigs.filter((definitionConfig) => is_generator_1.default.fn(definitionConfig.code));
11
- if (generatorDefinitionConfigs.length > 0) {
12
- const references = generatorDefinitionConfigs
13
- .map((definitionConfig) => `${path_1.default.relative(cwd, definitionConfig.uri)}:${definitionConfig.line.toString()}`)
14
- .join('\n ');
15
- const message = `
16
- The following hook/step definitions use generator functions:
17
-
18
- ${references}
19
-
20
- Use 'this.setDefinitionFunctionWrapper(fn)' to wrap them in a function that returns a promise.
21
- `;
22
- throw new Error(message);
23
- }
24
- }
25
- exports.validateNoGeneratorFunctions = validateNoGeneratorFunctions;
26
- //# sourceMappingURL=finalize_helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"finalize_helpers.js","sourceRoot":"","sources":["../../src/support_code_library_builder/finalize_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAsC;AACtC,gDAAuB;AAavB,SAAgB,4BAA4B,CAAC,EAC3C,GAAG,EACH,iBAAiB,GACoB;IACrC,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,MAAM,CACzD,CAAC,gBAAgB,EAAE,EAAE,CAAC,sBAAW,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAC5D,CAAA;IACD,IAAI,0BAA0B,CAAC,MAAM,GAAG,CAAC,EAAE;QACzC,MAAM,UAAU,GAAG,0BAA0B;aAC1C,GAAG,CACF,CAAC,gBAAgB,EAAE,EAAE,CACnB,GAAG,cAAI,CAAC,QAAQ,CACd,GAAG,EACH,gBAAgB,CAAC,GAAG,CACrB,IAAI,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAC1C;aACA,IAAI,CAAC,MAAM,CAAC,CAAA;QACf,MAAM,OAAO,GAAG;;;UAGV,UAAU;;;OAGb,CAAA;QACH,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;KACzB;AACH,CAAC;AA1BD,oEA0BC","sourcesContent":["import isGenerator from 'is-generator'\nimport path from 'path'\n\nexport interface IDefinitionConfig {\n code: any\n line: number\n uri: string\n}\n\nexport interface IValidateNoGeneratorFunctionsRequest {\n cwd: string\n definitionConfigs: IDefinitionConfig[]\n}\n\nexport function validateNoGeneratorFunctions({\n cwd,\n definitionConfigs,\n}: IValidateNoGeneratorFunctionsRequest): void {\n const generatorDefinitionConfigs = definitionConfigs.filter(\n (definitionConfig) => isGenerator.fn(definitionConfig.code)\n )\n if (generatorDefinitionConfigs.length > 0) {\n const references = generatorDefinitionConfigs\n .map(\n (definitionConfig) =>\n `${path.relative(\n cwd,\n definitionConfig.uri\n )}:${definitionConfig.line.toString()}`\n )\n .join('\\n ')\n const message = `\n The following hook/step definitions use generator functions:\n\n ${references}\n\n Use 'this.setDefinitionFunctionWrapper(fn)' to wrap them in a function that returns a promise.\n `\n throw new Error(message)\n }\n}\n"]}