@cucumber/cucumber 7.3.2 → 8.0.0-rc.3

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 (261) hide show
  1. package/README.md +88 -51
  2. package/api/index.d.ts +6 -0
  3. package/lib/api/convert_configuration.d.ts +4 -0
  4. package/lib/api/convert_configuration.js +64 -0
  5. package/lib/api/convert_configuration.js.map +1 -0
  6. package/lib/api/environment.d.ts +2 -0
  7. package/lib/api/environment.js +13 -0
  8. package/lib/api/environment.js.map +1 -0
  9. package/lib/api/formatters.d.ts +16 -0
  10. package/lib/api/formatters.js +72 -0
  11. package/lib/api/formatters.js.map +1 -0
  12. package/lib/api/gherkin.d.ts +21 -0
  13. package/lib/api/gherkin.js +65 -0
  14. package/lib/api/gherkin.js.map +1 -0
  15. package/lib/api/index.d.ts +11 -0
  16. package/lib/api/index.js +24 -0
  17. package/lib/api/index.js.map +1 -0
  18. package/lib/api/load_configuration.d.ts +9 -0
  19. package/lib/api/load_configuration.js +32 -0
  20. package/lib/api/load_configuration.js.map +1 -0
  21. package/lib/api/load_sources.d.ts +9 -0
  22. package/lib/api/load_sources.js +53 -0
  23. package/lib/api/load_sources.js.map +1 -0
  24. package/lib/api/load_support.d.ts +10 -0
  25. package/lib/api/load_support.js +28 -0
  26. package/lib/api/load_support.js.map +1 -0
  27. package/lib/api/paths.d.ts +7 -0
  28. package/lib/api/paths.js +99 -0
  29. package/lib/api/paths.js.map +1 -0
  30. package/lib/api/run_cucumber.d.ts +11 -0
  31. package/lib/api/run_cucumber.js +108 -0
  32. package/lib/api/run_cucumber.js.map +1 -0
  33. package/lib/api/runtime.d.ts +20 -0
  34. package/lib/api/runtime.js +36 -0
  35. package/lib/api/runtime.js.map +1 -0
  36. package/lib/api/support.d.ts +9 -0
  37. package/lib/api/support.js +21 -0
  38. package/lib/api/support.js.map +1 -0
  39. package/lib/api/types.d.ts +168 -0
  40. package/lib/api/types.js +3 -0
  41. package/lib/api/types.js.map +1 -0
  42. package/lib/api/wrapper.mjs +6 -0
  43. package/lib/cli/helpers.d.ts +16 -9
  44. package/lib/cli/helpers.js +49 -32
  45. package/lib/cli/helpers.js.map +1 -1
  46. package/lib/cli/i18n.js +7 -7
  47. package/lib/cli/i18n.js.map +1 -1
  48. package/lib/cli/index.d.ts +6 -23
  49. package/lib/cli/index.js +38 -197
  50. package/lib/cli/index.js.map +1 -1
  51. package/lib/cli/install_validator.js +1 -1
  52. package/lib/cli/install_validator.js.map +1 -1
  53. package/lib/cli/publish_banner.js +6 -6
  54. package/lib/cli/publish_banner.js.map +1 -1
  55. package/lib/cli/run.js +15 -7
  56. package/lib/cli/run.js.map +1 -1
  57. package/lib/cli/validate_node_engine_version.d.ts +7 -0
  58. package/lib/cli/validate_node_engine_version.js +20 -0
  59. package/lib/cli/validate_node_engine_version.js.map +1 -0
  60. package/lib/configuration/argv_parser.d.ts +20 -0
  61. package/lib/{cli → configuration}/argv_parser.js +52 -53
  62. package/lib/configuration/argv_parser.js.map +1 -0
  63. package/lib/configuration/check_schema.d.ts +2 -0
  64. package/lib/configuration/check_schema.js +56 -0
  65. package/lib/configuration/check_schema.js.map +1 -0
  66. package/lib/configuration/default_configuration.d.ts +2 -0
  67. package/lib/configuration/default_configuration.js +27 -0
  68. package/lib/configuration/default_configuration.js.map +1 -0
  69. package/lib/configuration/from_file.d.ts +2 -0
  70. package/lib/configuration/from_file.js +68 -0
  71. package/lib/configuration/from_file.js.map +1 -0
  72. package/lib/configuration/helpers.d.ts +1 -0
  73. package/lib/configuration/helpers.js +11 -0
  74. package/lib/configuration/helpers.js.map +1 -0
  75. package/lib/configuration/index.d.ts +7 -0
  76. package/lib/configuration/index.js +25 -0
  77. package/lib/configuration/index.js.map +1 -0
  78. package/lib/configuration/locate_file.d.ts +1 -0
  79. package/lib/configuration/locate_file.js +19 -0
  80. package/lib/configuration/locate_file.js.map +1 -0
  81. package/lib/configuration/merge_configurations.d.ts +2 -0
  82. package/lib/configuration/merge_configurations.js +48 -0
  83. package/lib/configuration/merge_configurations.js.map +1 -0
  84. package/lib/configuration/option_splitter.d.ts +3 -0
  85. package/lib/{cli → configuration}/option_splitter.js +3 -2
  86. package/lib/configuration/option_splitter.js.map +1 -0
  87. package/lib/configuration/types.d.ts +25 -0
  88. package/lib/configuration/types.js +3 -0
  89. package/lib/configuration/types.js.map +1 -0
  90. package/lib/configuration/validate_configuration.d.ts +2 -0
  91. package/lib/configuration/validate_configuration.js +10 -0
  92. package/lib/configuration/validate_configuration.js.map +1 -0
  93. package/lib/formatter/builder.d.ts +7 -7
  94. package/lib/formatter/builder.js +48 -55
  95. package/lib/formatter/builder.js.map +1 -1
  96. package/lib/formatter/get_color_fns.js +15 -16
  97. package/lib/formatter/get_color_fns.js.map +1 -1
  98. package/lib/formatter/helpers/event_data_collector.d.ts +2 -1
  99. package/lib/formatter/helpers/event_data_collector.js +16 -15
  100. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  101. package/lib/formatter/helpers/formatters.d.ts +6 -0
  102. package/lib/formatter/helpers/formatters.js +41 -0
  103. package/lib/formatter/helpers/formatters.js.map +1 -0
  104. package/lib/formatter/helpers/gherkin_document_parser.js +29 -42
  105. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
  106. package/lib/formatter/helpers/issue_helpers.d.ts +4 -4
  107. package/lib/formatter/helpers/issue_helpers.js +8 -9
  108. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  109. package/lib/formatter/helpers/keyword_type.js +2 -6
  110. package/lib/formatter/helpers/keyword_type.js.map +1 -1
  111. package/lib/formatter/helpers/location_helpers.js +1 -1
  112. package/lib/formatter/helpers/location_helpers.js.map +1 -1
  113. package/lib/formatter/helpers/pickle_parser.js +9 -18
  114. package/lib/formatter/helpers/pickle_parser.js.map +1 -1
  115. package/lib/formatter/helpers/step_argument_formatter.js +1 -1
  116. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
  117. package/lib/formatter/helpers/summary_helpers.js +8 -7
  118. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  119. package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
  120. package/lib/formatter/helpers/test_case_attempt_formatter.js +20 -19
  121. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  122. package/lib/formatter/helpers/test_case_attempt_parser.d.ts +1 -2
  123. package/lib/formatter/helpers/test_case_attempt_parser.js +18 -21
  124. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  125. package/lib/formatter/helpers/usage_helpers/index.d.ts +1 -2
  126. package/lib/formatter/helpers/usage_helpers/index.js +29 -43
  127. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  128. package/lib/formatter/html_formatter.d.ts +1 -0
  129. package/lib/formatter/html_formatter.js +5 -4
  130. package/lib/formatter/html_formatter.js.map +1 -1
  131. package/lib/formatter/http_stream.js +7 -7
  132. package/lib/formatter/http_stream.js.map +1 -1
  133. package/lib/formatter/index.d.ts +15 -2
  134. package/lib/formatter/index.js +2 -0
  135. package/lib/formatter/index.js.map +1 -1
  136. package/lib/formatter/json_formatter.d.ts +1 -0
  137. package/lib/formatter/json_formatter.js +25 -20
  138. package/lib/formatter/json_formatter.js.map +1 -1
  139. package/lib/formatter/message_formatter.d.ts +1 -0
  140. package/lib/formatter/message_formatter.js +1 -0
  141. package/lib/formatter/message_formatter.js.map +1 -1
  142. package/lib/formatter/progress_bar_formatter.d.ts +1 -0
  143. package/lib/formatter/progress_bar_formatter.js +18 -17
  144. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  145. package/lib/formatter/progress_formatter.d.ts +1 -0
  146. package/lib/formatter/progress_formatter.js +3 -2
  147. package/lib/formatter/progress_formatter.js.map +1 -1
  148. package/lib/formatter/publish.d.ts +1 -0
  149. package/lib/formatter/publish.js +5 -0
  150. package/lib/formatter/publish.js.map +1 -0
  151. package/lib/formatter/rerun_formatter.d.ts +1 -0
  152. package/lib/formatter/rerun_formatter.js +15 -11
  153. package/lib/formatter/rerun_formatter.js.map +1 -1
  154. package/lib/formatter/snippets_formatter.d.ts +1 -0
  155. package/lib/formatter/snippets_formatter.js +3 -3
  156. package/lib/formatter/snippets_formatter.js.map +1 -1
  157. package/lib/formatter/step_definition_snippet_builder/index.js +2 -2
  158. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
  159. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
  160. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  161. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
  162. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
  163. package/lib/formatter/summary_formatter.d.ts +1 -0
  164. package/lib/formatter/summary_formatter.js +11 -11
  165. package/lib/formatter/summary_formatter.js.map +1 -1
  166. package/lib/formatter/usage_formatter.d.ts +1 -0
  167. package/lib/formatter/usage_formatter.js +9 -10
  168. package/lib/formatter/usage_formatter.js.map +1 -1
  169. package/lib/formatter/usage_json_formatter.d.ts +1 -0
  170. package/lib/formatter/usage_json_formatter.js +3 -3
  171. package/lib/formatter/usage_json_formatter.js.map +1 -1
  172. package/lib/importer.js +13 -0
  173. package/lib/index.d.ts +4 -0
  174. package/lib/index.js +9 -1
  175. package/lib/index.js.map +1 -1
  176. package/lib/models/data_table.js +9 -7
  177. package/lib/models/data_table.js.map +1 -1
  178. package/lib/models/pickle_order.d.ts +1 -0
  179. package/lib/models/pickle_order.js +3 -0
  180. package/lib/models/pickle_order.js.map +1 -0
  181. package/lib/models/step_definition.js +4 -5
  182. package/lib/models/step_definition.js.map +1 -1
  183. package/lib/pickle_filter.js +13 -13
  184. package/lib/pickle_filter.js.map +1 -1
  185. package/lib/runtime/assemble_test_cases.js +3 -3
  186. package/lib/runtime/assemble_test_cases.js.map +1 -1
  187. package/lib/runtime/attachment_manager/index.js +4 -4
  188. package/lib/runtime/attachment_manager/index.js.map +1 -1
  189. package/lib/runtime/helpers.d.ts +1 -0
  190. package/lib/runtime/helpers.js +42 -4
  191. package/lib/runtime/helpers.js.map +1 -1
  192. package/lib/runtime/index.d.ts +7 -7
  193. package/lib/runtime/index.js +12 -65
  194. package/lib/runtime/index.js.map +1 -1
  195. package/lib/runtime/parallel/command_types.d.ts +3 -2
  196. package/lib/runtime/parallel/command_types.js.map +1 -1
  197. package/lib/runtime/parallel/coordinator.d.ts +32 -12
  198. package/lib/runtime/parallel/coordinator.js +82 -38
  199. package/lib/runtime/parallel/coordinator.js.map +1 -1
  200. package/lib/runtime/parallel/run_worker.js +1 -1
  201. package/lib/runtime/parallel/run_worker.js.map +1 -1
  202. package/lib/runtime/parallel/worker.d.ts +2 -4
  203. package/lib/runtime/parallel/worker.js +18 -33
  204. package/lib/runtime/parallel/worker.js.map +1 -1
  205. package/lib/runtime/run_test_run_hooks.d.ts +3 -0
  206. package/lib/runtime/run_test_run_hooks.js +28 -0
  207. package/lib/runtime/run_test_run_hooks.js.map +1 -0
  208. package/lib/runtime/step_runner.js +5 -7
  209. package/lib/runtime/step_runner.js.map +1 -1
  210. package/lib/runtime/stopwatch.js +4 -4
  211. package/lib/runtime/stopwatch.js.map +1 -1
  212. package/lib/runtime/test_case_runner.d.ts +3 -3
  213. package/lib/runtime/test_case_runner.js +19 -28
  214. package/lib/runtime/test_case_runner.js.map +1 -1
  215. package/lib/stack_trace_filter.js +6 -7
  216. package/lib/stack_trace_filter.js.map +1 -1
  217. package/lib/step_arguments.js +2 -2
  218. package/lib/step_arguments.js.map +1 -1
  219. package/lib/support_code_library_builder/{build_helpers.d.ts → build_parameter_type.d.ts} +0 -2
  220. package/lib/support_code_library_builder/build_parameter_type.js +13 -0
  221. package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
  222. package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
  223. package/lib/support_code_library_builder/get_definition_line_and_uri.js +30 -0
  224. package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
  225. package/lib/support_code_library_builder/index.d.ts +4 -2
  226. package/lib/support_code_library_builder/index.js +43 -34
  227. package/lib/support_code_library_builder/index.js.map +1 -1
  228. package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
  229. package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
  230. package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
  231. package/lib/support_code_library_builder/types.d.ts +10 -0
  232. package/lib/support_code_library_builder/types.js.map +1 -1
  233. package/lib/support_code_library_builder/validate_arguments.js +14 -19
  234. package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
  235. package/lib/time.d.ts +1 -0
  236. package/lib/time.js +17 -2
  237. package/lib/time.js.map +1 -1
  238. package/lib/user_code_runner.js +10 -17
  239. package/lib/user_code_runner.js.map +1 -1
  240. package/lib/value_checker.d.ts +2 -2
  241. package/lib/value_checker.js.map +1 -1
  242. package/lib/version.d.ts +1 -0
  243. package/lib/version.js +6 -0
  244. package/lib/version.js.map +1 -0
  245. package/lib/wrapper.mjs +42 -0
  246. package/package.json +98 -70
  247. package/lib/cli/argv_parser.d.ts +0 -51
  248. package/lib/cli/argv_parser.js.map +0 -1
  249. package/lib/cli/configuration_builder.d.ts +0 -46
  250. package/lib/cli/configuration_builder.js +0 -161
  251. package/lib/cli/configuration_builder.js.map +0 -1
  252. package/lib/cli/option_splitter.d.ts +0 -4
  253. package/lib/cli/option_splitter.js.map +0 -1
  254. package/lib/cli/profile_loader.d.ts +0 -6
  255. package/lib/cli/profile_loader.js +0 -42
  256. package/lib/cli/profile_loader.js.map +0 -1
  257. package/lib/support_code_library_builder/build_helpers.js +0 -41
  258. package/lib/support_code_library_builder/build_helpers.js.map +0 -1
  259. package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
  260. package/lib/support_code_library_builder/finalize_helpers.js +0 -26
  261. package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
package/lib/time.js CHANGED
@@ -19,7 +19,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.durationBetweenTimestamps = void 0;
22
+ exports.wrapPromiseWithTimeout = exports.durationBetweenTimestamps = void 0;
23
+ const perf_hooks_1 = require("perf_hooks");
23
24
  const messages = __importStar(require("@cucumber/messages"));
24
25
  let previousTimestamp;
25
26
  const methods = {
@@ -34,13 +35,14 @@ const methods = {
34
35
  },
35
36
  setInterval: setInterval.bind(global),
36
37
  setTimeout: setTimeout.bind(global),
38
+ performance: perf_hooks_1.performance,
37
39
  };
38
40
  if (typeof setImmediate !== 'undefined') {
39
41
  methods.setImmediate = setImmediate.bind(global);
40
42
  methods.clearImmediate = clearImmediate.bind(global);
41
43
  }
42
44
  function getTimestamp() {
43
- return new methods.Date().getTime();
45
+ return methods.performance.now();
44
46
  }
45
47
  function durationBetweenTimestamps(startedTimestamp, finishedTimestamp) {
46
48
  const durationMillis = messages.TimeConversion.timestampToMillisecondsSinceEpoch(finishedTimestamp) -
@@ -48,5 +50,18 @@ function durationBetweenTimestamps(startedTimestamp, finishedTimestamp) {
48
50
  return messages.TimeConversion.millisecondsToDuration(durationMillis);
49
51
  }
50
52
  exports.durationBetweenTimestamps = durationBetweenTimestamps;
53
+ async function wrapPromiseWithTimeout(promise, timeoutInMilliseconds, timeoutMessage = '') {
54
+ let timeoutId;
55
+ if (timeoutMessage === '') {
56
+ timeoutMessage = `Action did not complete within ${timeoutInMilliseconds} milliseconds`;
57
+ }
58
+ const timeoutPromise = new Promise((resolve, reject) => {
59
+ timeoutId = methods.setTimeout(() => {
60
+ reject(new Error(timeoutMessage));
61
+ }, timeoutInMilliseconds);
62
+ });
63
+ return await Promise.race([promise, timeoutPromise]).finally(() => methods.clearTimeout(timeoutId));
64
+ }
65
+ exports.wrapPromiseWithTimeout = wrapPromiseWithTimeout;
51
66
  exports.default = methods;
52
67
  //# sourceMappingURL=time.js.map
package/lib/time.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAE9C,IAAI,iBAAyB,CAAA;AAE7B,MAAM,OAAO,GAAQ;IACnB,WAAW;QACT,iBAAiB,GAAG,YAAY,EAAE,CAAA;IACpC,CAAC;IACD,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IACvC,IAAI;IACJ,SAAS;QACP,OAAO,YAAY,EAAE,GAAG,iBAAiB,CAAA;IAC3C,CAAC;IACD,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;CACpC,CAAA;AAED,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACvC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAChD,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;CACrD;AAED,SAAS,YAAY;IACnB,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;AACrC,CAAC;AAED,SAAgB,yBAAyB,CACvC,gBAAoC,EACpC,iBAAqC;IAErC,MAAM,cAAc,GAClB,QAAQ,CAAC,cAAc,CAAC,iCAAiC,CACvD,iBAAiB,CAClB;QACD,QAAQ,CAAC,cAAc,CAAC,iCAAiC,CAAC,gBAAgB,CAAC,CAAA;IAC7E,OAAO,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAA;AACvE,CAAC;AAVD,8DAUC;AAED,kBAAe,OAAO,CAAA","sourcesContent":["import * as messages from '@cucumber/messages'\n\nlet previousTimestamp: number\n\nconst methods: any = {\n beginTiming() {\n previousTimestamp = getTimestamp()\n },\n clearInterval: clearInterval.bind(global),\n clearTimeout: clearTimeout.bind(global),\n Date,\n endTiming() {\n return getTimestamp() - previousTimestamp\n },\n setInterval: setInterval.bind(global),\n setTimeout: setTimeout.bind(global),\n}\n\nif (typeof setImmediate !== 'undefined') {\n methods.setImmediate = setImmediate.bind(global)\n methods.clearImmediate = clearImmediate.bind(global)\n}\n\nfunction getTimestamp(): number {\n return new methods.Date().getTime()\n}\n\nexport function durationBetweenTimestamps(\n startedTimestamp: messages.Timestamp,\n finishedTimestamp: messages.Timestamp\n): messages.Duration {\n const durationMillis =\n messages.TimeConversion.timestampToMillisecondsSinceEpoch(\n finishedTimestamp\n ) -\n messages.TimeConversion.timestampToMillisecondsSinceEpoch(startedTimestamp)\n return messages.TimeConversion.millisecondsToDuration(durationMillis)\n}\n\nexport default methods\n"]}
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6DAA8C;AAE9C,IAAI,iBAAyB,CAAA;AAE7B,MAAM,OAAO,GAAQ;IACnB,WAAW;QACT,iBAAiB,GAAG,YAAY,EAAE,CAAA;IACpC,CAAC;IACD,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IACvC,IAAI;IACJ,SAAS;QACP,OAAO,YAAY,EAAE,GAAG,iBAAiB,CAAA;IAC3C,CAAC;IACD,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;IACnC,WAAW,EAAX,wBAAW;CACZ,CAAA;AAED,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACvC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAChD,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;CACrD;AAED,SAAS,YAAY;IACnB,OAAO,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;AAClC,CAAC;AAED,SAAgB,yBAAyB,CACvC,gBAAoC,EACpC,iBAAqC;IAErC,MAAM,cAAc,GAClB,QAAQ,CAAC,cAAc,CAAC,iCAAiC,CACvD,iBAAiB,CAClB;QACD,QAAQ,CAAC,cAAc,CAAC,iCAAiC,CAAC,gBAAgB,CAAC,CAAA;IAC7E,OAAO,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAA;AACvE,CAAC;AAVD,8DAUC;AAEM,KAAK,UAAU,sBAAsB,CAC1C,OAAmB,EACnB,qBAA6B,EAC7B,iBAAyB,EAAE;IAE3B,IAAI,SAAyB,CAAA;IAC7B,IAAI,cAAc,KAAK,EAAE,EAAE;QACzB,cAAc,GAAG,kCAAkC,qBAAqB,eAAe,CAAA;KACxF;IACD,MAAM,cAAc,GAAG,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxD,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE;YAClC,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAA;QACnC,CAAC,EAAE,qBAAqB,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAChE,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAChC,CAAA;AACH,CAAC;AAjBD,wDAiBC;AAED,kBAAe,OAAO,CAAA","sourcesContent":["import { performance } from 'perf_hooks'\nimport * as messages from '@cucumber/messages'\n\nlet previousTimestamp: number\n\nconst methods: any = {\n beginTiming() {\n previousTimestamp = getTimestamp()\n },\n clearInterval: clearInterval.bind(global),\n clearTimeout: clearTimeout.bind(global),\n Date,\n endTiming() {\n return getTimestamp() - previousTimestamp\n },\n setInterval: setInterval.bind(global),\n setTimeout: setTimeout.bind(global),\n performance,\n}\n\nif (typeof setImmediate !== 'undefined') {\n methods.setImmediate = setImmediate.bind(global)\n methods.clearImmediate = clearImmediate.bind(global)\n}\n\nfunction getTimestamp(): number {\n return methods.performance.now()\n}\n\nexport function durationBetweenTimestamps(\n startedTimestamp: messages.Timestamp,\n finishedTimestamp: messages.Timestamp\n): messages.Duration {\n const durationMillis =\n messages.TimeConversion.timestampToMillisecondsSinceEpoch(\n finishedTimestamp\n ) -\n messages.TimeConversion.timestampToMillisecondsSinceEpoch(startedTimestamp)\n return messages.TimeConversion.millisecondsToDuration(durationMillis)\n}\n\nexport async function wrapPromiseWithTimeout<T>(\n promise: Promise<T>,\n timeoutInMilliseconds: number,\n timeoutMessage: string = ''\n): Promise<T> {\n let timeoutId: NodeJS.Timeout\n if (timeoutMessage === '') {\n timeoutMessage = `Action did not complete within ${timeoutInMilliseconds} milliseconds`\n }\n const timeoutPromise = new Promise<T>((resolve, reject) => {\n timeoutId = methods.setTimeout(() => {\n reject(new Error(timeoutMessage))\n }, timeoutInMilliseconds)\n })\n return await Promise.race([promise, timeoutPromise]).finally(() =>\n methods.clearTimeout(timeoutId)\n )\n}\n\nexport default methods\n"]}
@@ -3,8 +3,7 @@ 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 bluebird_1 = __importDefault(require("bluebird"));
7
- const time_1 = __importDefault(require("./time"));
6
+ const time_1 = require("./time");
8
7
  const uncaught_exception_manager_1 = __importDefault(require("./uncaught_exception_manager"));
9
8
  const util_1 = __importDefault(require("util"));
10
9
  const value_checker_1 = require("./value_checker");
@@ -12,7 +11,7 @@ const UserCodeRunner = {
12
11
  async run({ argsArray, thisArg, fn, timeoutInMilliseconds, }) {
13
12
  const callbackPromise = new Promise((resolve, reject) => {
14
13
  argsArray.push((error, result) => {
15
- if (value_checker_1.doesHaveValue(error)) {
14
+ if ((0, value_checker_1.doesHaveValue)(error)) {
16
15
  reject(error);
17
16
  }
18
17
  else {
@@ -30,7 +29,7 @@ const UserCodeRunner = {
30
29
  }
31
30
  const racingPromises = [];
32
31
  const callbackInterface = fn.length === argsArray.length;
33
- const promiseInterface = value_checker_1.doesHaveValue(fnReturn) && typeof fnReturn.then === 'function';
32
+ const promiseInterface = (0, value_checker_1.doesHaveValue)(fnReturn) && typeof fnReturn.then === 'function';
34
33
  if (callbackInterface && promiseInterface) {
35
34
  return {
36
35
  error: new Error('function uses multiple asynchronous interfaces: callback and promise\n' +
@@ -53,34 +52,28 @@ const UserCodeRunner = {
53
52
  uncaught_exception_manager_1.default.registerHandler(exceptionHandler);
54
53
  });
55
54
  racingPromises.push(uncaughtExceptionPromise);
56
- let timeoutId;
55
+ let finalPromise = Promise.race(racingPromises);
57
56
  if (timeoutInMilliseconds >= 0) {
58
- const timeoutPromise = new Promise((resolve, reject) => {
59
- timeoutId = time_1.default.setTimeout(() => {
60
- const timeoutMessage = 'function timed out, ensure the ' +
61
- (callbackInterface ? 'callback is executed' : 'promise resolves') +
62
- ` within ${timeoutInMilliseconds.toString()} milliseconds`;
63
- reject(new Error(timeoutMessage));
64
- }, timeoutInMilliseconds);
65
- });
66
- racingPromises.push(timeoutPromise);
57
+ const timeoutMessage = 'function timed out, ensure the ' +
58
+ (callbackInterface ? 'callback is executed' : 'promise resolves') +
59
+ ` within ${timeoutInMilliseconds.toString()} milliseconds`;
60
+ finalPromise = (0, time_1.wrapPromiseWithTimeout)(finalPromise, timeoutInMilliseconds, timeoutMessage);
67
61
  }
68
62
  let error, result;
69
63
  try {
70
- result = await bluebird_1.default.race(racingPromises);
64
+ result = await finalPromise;
71
65
  }
72
66
  catch (e) {
73
67
  if (e instanceof Error) {
74
68
  error = e;
75
69
  }
76
- else if (value_checker_1.doesHaveValue(e)) {
70
+ else if ((0, value_checker_1.doesHaveValue)(e)) {
77
71
  error = util_1.default.format(e);
78
72
  }
79
73
  else {
80
74
  error = new Error('Promise rejected without a reason');
81
75
  }
82
76
  }
83
- time_1.default.clearTimeout(timeoutId);
84
77
  uncaught_exception_manager_1.default.unregisterHandler(exceptionHandler);
85
78
  return { error, result };
86
79
  },
@@ -1 +1 @@
1
- {"version":3,"file":"user_code_runner.js","sourceRoot":"","sources":["../src/user_code_runner.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+B;AAC/B,kDAAyB;AACzB,8FAAmE;AACnE,gDAAuB;AACvB,mDAA+C;AAc/C,MAAM,cAAc,GAAG;IACrB,KAAK,CAAC,GAAG,CAAC,EACR,SAAS,EACT,OAAO,EACP,EAAE,EACF,qBAAqB,GACT;QACZ,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtD,SAAS,CAAC,IAAI,CAAC,CAAC,KAAY,EAAE,MAAoB,EAAE,EAAE;gBACpD,IAAI,6BAAa,CAAC,KAAK,CAAC,EAAE;oBACxB,MAAM,CAAC,KAAK,CAAC,CAAA;iBACd;qBAAM;oBACL,OAAO,CAAC,MAAM,CAAC,CAAA;iBAChB;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAA;QACZ,IAAI;YACF,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YACrD,OAAO,EAAE,KAAK,EAAE,CAAA;SACjB;QAED,MAAM,cAAc,GAAG,EAAE,CAAA;QACzB,MAAM,iBAAiB,GAAG,EAAE,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,CAAA;QACxD,MAAM,gBAAgB,GACpB,6BAAa,CAAC,QAAQ,CAAC,IAAI,OAA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;QAED,IAAI,KAAK,EAAE,MAAM,CAAA;QACjB,IAAI;YACF,MAAM,GAAG,MAAM,kBAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;SAC7C;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,GAAG,CAAC,CAAA;aACV;iBAAM,IAAI,6BAAa,CAAC,CAAC,CAAC,EAAE;gBAC3B,KAAK,GAAG,cAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;aACvB;iBAAM;gBACL,KAAK,GAAG,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;aACvD;SACF;QAED,cAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;QAC5B,oCAAwB,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;QAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IAC1B,CAAC;CACF,CAAA;AAED,kBAAe,cAAc,CAAA","sourcesContent":["import bluebird from 'bluebird'\nimport Time from './time'\nimport UncaughtExceptionManager from './uncaught_exception_manager'\nimport util from 'util'\nimport { doesHaveValue } from './value_checker'\n\nexport interface IRunRequest {\n argsArray: any[]\n thisArg: any\n fn: Function\n timeoutInMilliseconds: number\n}\n\nexport interface IRunResponse {\n error?: any\n result?: any\n}\n\nconst UserCodeRunner = {\n async run({\n argsArray,\n thisArg,\n fn,\n timeoutInMilliseconds,\n }: IRunRequest): Promise<IRunResponse> {\n const callbackPromise = new Promise((resolve, reject) => {\n argsArray.push((error: Error, result: IRunResponse) => {\n if (doesHaveValue(error)) {\n reject(error)\n } else {\n resolve(result)\n }\n })\n })\n\n let fnReturn\n try {\n fnReturn = fn.apply(thisArg, argsArray)\n } catch (e) {\n const error = e instanceof Error ? e : util.format(e)\n return { error }\n }\n\n const racingPromises = []\n const callbackInterface = fn.length === argsArray.length\n const promiseInterface =\n doesHaveValue(fnReturn) && typeof fnReturn.then === 'function'\n\n if (callbackInterface && promiseInterface) {\n return {\n error: new Error(\n 'function uses multiple asynchronous interfaces: callback and promise\\n' +\n 'to use the callback interface: do not return a promise\\n' +\n 'to use the promise interface: remove the last argument to the function'\n ),\n }\n } else if (callbackInterface) {\n racingPromises.push(callbackPromise)\n } else if (promiseInterface) {\n racingPromises.push(fnReturn)\n } else {\n return { result: fnReturn }\n }\n\n let exceptionHandler\n const uncaughtExceptionPromise = new Promise((resolve, reject) => {\n exceptionHandler = reject\n UncaughtExceptionManager.registerHandler(exceptionHandler)\n })\n racingPromises.push(uncaughtExceptionPromise)\n\n let timeoutId\n if (timeoutInMilliseconds >= 0) {\n const timeoutPromise = new Promise((resolve, reject) => {\n timeoutId = Time.setTimeout(() => {\n const timeoutMessage =\n 'function timed out, ensure the ' +\n (callbackInterface ? 'callback is executed' : 'promise resolves') +\n ` within ${timeoutInMilliseconds.toString()} milliseconds`\n reject(new Error(timeoutMessage))\n }, timeoutInMilliseconds)\n })\n racingPromises.push(timeoutPromise)\n }\n\n let error, result\n try {\n result = await bluebird.race(racingPromises)\n } catch (e) {\n if (e instanceof Error) {\n error = e\n } else if (doesHaveValue(e)) {\n error = util.format(e)\n } else {\n error = new Error('Promise rejected without a reason')\n }\n }\n\n Time.clearTimeout(timeoutId)\n UncaughtExceptionManager.unregisterHandler(exceptionHandler)\n\n return { error, result }\n },\n}\n\nexport default UserCodeRunner\n"]}
1
+ {"version":3,"file":"user_code_runner.js","sourceRoot":"","sources":["../src/user_code_runner.ts"],"names":[],"mappings":";;;;;AAAA,iCAA+C;AAC/C,8FAAmE;AACnE,gDAAuB;AACvB,mDAA+C;AAc/C,MAAM,cAAc,GAAG;IACrB,KAAK,CAAC,GAAG,CAAC,EACR,SAAS,EACT,OAAO,EACP,EAAE,EACF,qBAAqB,GACT;QACZ,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtD,SAAS,CAAC,IAAI,CAAC,CAAC,KAAY,EAAE,MAAoB,EAAE,E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M,CAAA;YACzB,oCAAwB,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAA;QAC5D,CAAC,CAAC,CAAA;QACF,cAAc,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;QAE7C,IAAI,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAC/C,IAAI,qBAAqB,IAAI,CAAC,EAAE;YAC9B,MAAM,cAAc,GAClB,iCAAiC;gBACjC,CAAC,iBAAiB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,kBAAkB,CAAC;gBACjE,WAAW,qBAAqB,CAAC,QAAQ,EAAE,eAAe,CAAA;YAC5D,YAAY,GAAG,IAAA,6BAAsB,EACnC,YAAY,EACZ,qBAAqB,EACrB,cAAc,CACf,CAAA;SACF;QAED,IAAI,KAAK,EAAE,MAAM,CAAA;QACjB,IAAI;YACF,MAAM,GAAG,MAAM,YAAY,CAAA;SAC5B;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtB,KAAK,GAAG,CAAC,CAAA;aACV;iBAAM,IAAI,IAAA,6BAAa,EAAC,CAAC,CAAC,EAAE;gBAC3B,KAAK,GAAG,cAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;aACvB;iBAAM;gBACL,KAAK,GAAG,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;aACvD;SACF;QAED,oCAAwB,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;QAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IAC1B,CAAC;CACF,CAAA;AAED,kBAAe,cAAc,CAAA","sourcesContent":["import { wrapPromiseWithTimeout } from './time'\nimport UncaughtExceptionManager from './uncaught_exception_manager'\nimport util from 'util'\nimport { doesHaveValue } from './value_checker'\n\nexport interface IRunRequest {\n argsArray: any[]\n thisArg: any\n fn: Function\n timeoutInMilliseconds: number\n}\n\nexport interface IRunResponse {\n error?: any\n result?: any\n}\n\nconst UserCodeRunner = {\n async run({\n argsArray,\n thisArg,\n fn,\n timeoutInMilliseconds,\n }: IRunRequest): Promise<IRunResponse> {\n const callbackPromise = new Promise((resolve, reject) => {\n argsArray.push((error: Error, result: IRunResponse) => {\n if (doesHaveValue(error)) {\n reject(error)\n } else {\n resolve(result)\n }\n })\n })\n\n let fnReturn\n try {\n fnReturn = fn.apply(thisArg, argsArray)\n } catch (e) {\n const error = e instanceof Error ? e : util.format(e)\n return { error }\n }\n\n const racingPromises = []\n const callbackInterface = fn.length === argsArray.length\n const promiseInterface =\n doesHaveValue(fnReturn) && typeof fnReturn.then === 'function'\n\n if (callbackInterface && promiseInterface) {\n return {\n error: new Error(\n 'function uses multiple asynchronous interfaces: callback and promise\\n' +\n 'to use the callback interface: do not return a promise\\n' +\n 'to use the promise interface: remove the last argument to the function'\n ),\n }\n } else if (callbackInterface) {\n racingPromises.push(callbackPromise)\n } else if (promiseInterface) {\n racingPromises.push(fnReturn)\n } else {\n return { result: fnReturn }\n }\n\n let exceptionHandler\n const uncaughtExceptionPromise = new Promise((resolve, reject) => {\n exceptionHandler = reject\n UncaughtExceptionManager.registerHandler(exceptionHandler)\n })\n racingPromises.push(uncaughtExceptionPromise)\n\n let finalPromise = Promise.race(racingPromises)\n if (timeoutInMilliseconds >= 0) {\n const timeoutMessage =\n 'function timed out, ensure the ' +\n (callbackInterface ? 'callback is executed' : 'promise resolves') +\n ` within ${timeoutInMilliseconds.toString()} milliseconds`\n finalPromise = wrapPromiseWithTimeout(\n finalPromise,\n timeoutInMilliseconds,\n timeoutMessage\n )\n }\n\n let error, result\n try {\n result = await finalPromise\n } catch (e) {\n if (e instanceof Error) {\n error = e\n } else if (doesHaveValue(e)) {\n error = util.format(e)\n } else {\n error = new Error('Promise rejected without a reason')\n }\n }\n\n UncaughtExceptionManager.unregisterHandler(exceptionHandler)\n\n return { error, result }\n },\n}\n\nexport default UserCodeRunner\n"]}
@@ -1,3 +1,3 @@
1
- export declare function doesHaveValue(value: any): boolean;
2
- export declare function doesNotHaveValue(value: any): boolean;
1
+ export declare function doesHaveValue<T>(value: T): boolean;
2
+ export declare function doesNotHaveValue<T>(value: T): boolean;
3
3
  export declare function valueOrDefault<T>(value: T, defaultValue: T): T;
@@ -1 +1 @@
1
- {"version":3,"file":"value_checker.js","sourceRoot":"","sources":["../src/value_checker.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAC,KAAU;IACtC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;AACjC,CAAC;AAFD,sCAEC;AAED,SAAgB,gBAAgB,CAAC,KAAU;IACzC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAA;AAC9C,CAAC;AAFD,4CAEC;AAED,SAAgB,cAAc,CAAI,KAAQ,EAAE,YAAe;IACzD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAA;KACb;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AALD,wCAKC","sourcesContent":["export function doesHaveValue(value: any): boolean {\n return !doesNotHaveValue(value)\n}\n\nexport function doesNotHaveValue(value: any): boolean {\n return value === null || value === undefined\n}\n\nexport function valueOrDefault<T>(value: T, defaultValue: T): T {\n if (doesHaveValue(value)) {\n return value\n }\n return defaultValue\n}\n"]}
1
+ {"version":3,"file":"value_checker.js","sourceRoot":"","sources":["../src/value_checker.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAI,KAAQ;IACvC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;AACjC,CAAC;AAFD,sCAEC;AAED,SAAgB,gBAAgB,CAAI,KAAQ;IAC1C,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAA;AAC9C,CAAC;AAFD,4CAEC;AAED,SAAgB,cAAc,CAAI,KAAQ,EAAE,YAAe;IACzD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAA;KACb;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AALD,wCAKC","sourcesContent":["export function doesHaveValue<T>(value: T): boolean {\n return !doesNotHaveValue(value)\n}\n\nexport function doesNotHaveValue<T>(value: T): boolean {\n return value === null || value === undefined\n}\n\nexport function valueOrDefault<T>(value: T, defaultValue: T): T {\n if (doesHaveValue(value)) {\n return value\n }\n return defaultValue\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const version = "8.0.0-rc.3";
package/lib/version.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.version = void 0;
4
+ // generated by genversion
5
+ exports.version = '8.0.0-rc.3';
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AACb,QAAA,OAAO,GAAG,YAAY,CAAA","sourcesContent":["// generated by genversion\nexport const version = '8.0.0-rc.3'\n"]}
@@ -0,0 +1,42 @@
1
+ import cucumber from './index.js'
2
+
3
+ export const Cli = cucumber.Cli
4
+ export const parseGherkinMessageStream = cucumber.parseGherkinMessageStream
5
+ export const PickleFilter = cucumber.PickleFilter
6
+ export const Runtime = cucumber.Runtime
7
+ export const supportCodeLibraryBuilder = cucumber.supportCodeLibraryBuilder
8
+ export const Status = cucumber.Status
9
+ export const DataTable = cucumber.DataTable
10
+ export const TestCaseHookDefinition = cucumber.TestCaseHookDefinition
11
+ export const version = cucumber.version
12
+
13
+ export const Formatter = cucumber.Formatter
14
+ export const FormatterBuilder = cucumber.FormatterBuilder
15
+ export const JsonFormatter = cucumber.JsonFormatter
16
+ export const ProgressFormatter = cucumber.ProgressFormatter
17
+ export const RerunFormatter = cucumber.RerunFormatter
18
+ export const SnippetsFormatter = cucumber.SnippetsFormatter
19
+ export const SummaryFormatter = cucumber.SummaryFormatter
20
+ export const UsageFormatter = cucumber.UsageFormatter
21
+ export const UsageJsonFormatter = cucumber.UsageJsonFormatter
22
+ export const formatterHelpers = cucumber.formatterHelpers
23
+
24
+ export const After = cucumber.After
25
+ export const AfterAll = cucumber.AfterAll
26
+ export const AfterStep = cucumber.AfterStep
27
+ export const Before = cucumber.Before
28
+ export const BeforeAll = cucumber.BeforeAll
29
+ export const BeforeStep = cucumber.BeforeStep
30
+ export const defineParameterType = cucumber.defineParameterType
31
+ export const defineStep = cucumber.defineStep
32
+ export const Given = cucumber.Given
33
+ export const setDefaultTimeout = cucumber.setDefaultTimeout
34
+ export const setDefinitionFunctionWrapper = cucumber.setDefinitionFunctionWrapper
35
+ export const setWorldConstructor = cucumber.setWorldConstructor
36
+ export const Then = cucumber.Then
37
+ export const When = cucumber.When
38
+
39
+ export const World = cucumber.World
40
+
41
+ export const wrapPromiseWithTimeout = cucumber.wrapPromiseWithTimeout
42
+
package/package.json CHANGED
@@ -8,11 +8,12 @@
8
8
  "gherkin",
9
9
  "tests"
10
10
  ],
11
- "version": "7.3.2",
11
+ "version": "8.0.0-rc.3",
12
12
  "homepage": "https://github.com/cucumber/cucumber-js",
13
13
  "author": "Julien Biezemans <jb@jbpros.com>",
14
14
  "contributors": [
15
15
  "Aaron Garvey",
16
+ "abelalmeida <abelalmeida@u.boisestate.edu>",
16
17
  "Adam Ark <Adam-ARK@users.noreply.github.com>",
17
18
  "Ádám Gólya <adam.golya@lab.coop>",
18
19
  "ahulab <alexbaluha@gmail.com>",
@@ -23,6 +24,7 @@
23
24
  "Artur Neumann <artur@jankaritech.com>",
24
25
  "Artur Pomadowski <artur.pomadowski@gmail.com>",
25
26
  "Aslak Hellesøy <aslak.hellesoy@gmail.com>",
27
+ "Aurélien Reeves <aurelien.reeves@smartbear.com>",
26
28
  "basemmerink <bas.emmerink@gmail.com>",
27
29
  "Ben Van Treese <vantreeseba@gmail.com>",
28
30
  "Benjamín Eidelman <beneidel+gh@gmail.com>",
@@ -65,6 +67,7 @@
65
67
  "Jayson Smith <github@nes.33mail.com>",
66
68
  "Jesse Harlin <harlinjesse@gmail.com>",
67
69
  "João Guilherme Farias Duda <jgfd@cin.ufpe.br>",
70
+ "Joaquín Sorianello <joac@users.noreply.github.com>",
68
71
  "Joey Jan <OverFlow636@users.noreply.github.com>",
69
72
  "John Krull <astrom.flux@gmail.com>",
70
73
  "John McLaughlin <john.mjhm@gmail.com>",
@@ -92,6 +95,7 @@
92
95
  "Leonardo <mondloslp@gmail.com>",
93
96
  "lopesc <lopesc@users.noreply.github.com>",
94
97
  "Lucas Cimon <lucas.cimon@gmail.com>",
98
+ "Ludek",
95
99
  "Lukas Degener <l.degener@tarent.de>",
96
100
  "Łukasz Gandecki <lgandecki@css.edu>",
97
101
  "M.P. Korstanje <mpkorstanje@users.noreply.github.com>",
@@ -121,6 +125,7 @@
121
125
  "Paul Jensen <paulbjensen@gmail.com>",
122
126
  "Paul Shannon (https://devpaul.com)",
123
127
  "please-rewrite <please-rewrite@users.noreply.github.com>",
128
+ "plocket <plocket@users.noreply.github.com>",
124
129
  "Renier Morales <renier@morales-rodriguez.net>",
125
130
  "Rick Lee-Morlang <rick@lee-morlang.com>",
126
131
  "RolandArgos <roland.ormrod@argos.co.uk>",
@@ -139,6 +144,7 @@
139
144
  "temyers <temyers@users.noreply.github.com>",
140
145
  "Tim Perry <tim.perry@softwire.com>",
141
146
  "Tom V <tom@toc.com>",
147
+ "Tomer Ben-Rachel <tomerpacific@gmail.com>",
142
148
  "Tristan Dunn <tristanzdunn@gmail.com>",
143
149
  "unknown <jharlin@NormanDev2.telogical.com>",
144
150
  "Valerio Innocenti Sedili <valerio.innocenti.ext@yoox.com>",
@@ -164,117 +170,138 @@
164
170
  "lib": "./lib"
165
171
  },
166
172
  "main": "./lib/index.js",
173
+ "exports": {
174
+ ".": {
175
+ "import": "./lib/wrapper.mjs",
176
+ "require": "./lib/index.js",
177
+ "types": "./lib/index.d.ts"
178
+ },
179
+ "./api": {
180
+ "import": "./lib/api/wrapper.mjs",
181
+ "require": "./lib/api/index.js",
182
+ "types": "./lib/api/index.d.ts"
183
+ },
184
+ "./lib/*": {
185
+ "require": "./lib/*.js"
186
+ },
187
+ "./package.json": "./package.json"
188
+ },
167
189
  "types": "./lib/index.d.ts",
168
190
  "engines": {
169
- "node": ">=10"
191
+ "node": "12 || 14 || >=16"
170
192
  },
171
193
  "dependencies": {
172
- "@cucumber/create-meta": "^5.0.0",
173
- "@cucumber/cucumber-expressions": "^12.1.1",
174
- "@cucumber/gherkin": "^19.0.3",
175
- "@cucumber/gherkin-streams": "^2.0.2",
176
- "@cucumber/html-formatter": "^15.0.2",
177
- "@cucumber/messages": "^16.0.1",
178
- "@cucumber/tag-expressions": "^3.0.1",
194
+ "@cspotcode/source-map-support": "^0.7.0",
195
+ "@cucumber/ci-environment": "9.0.0",
196
+ "@cucumber/cucumber-expressions": "15.0.2",
197
+ "@cucumber/gherkin": "22.0.0",
198
+ "@cucumber/gherkin-streams": "4.0.0",
199
+ "@cucumber/gherkin-utils": "^7.0.0",
200
+ "@cucumber/html-formatter": "18.0.0",
201
+ "@cucumber/messages": "17.1.1",
202
+ "@cucumber/tag-expressions": "4.1.0",
179
203
  "assertion-error-formatter": "^3.0.0",
180
- "bluebird": "^3.7.2",
181
204
  "capital-case": "^1.0.4",
205
+ "chalk": "^4.1.2",
182
206
  "cli-table3": "0.6.1",
183
- "colors": "1.4.0",
184
- "commander": "^7.0.0",
185
- "create-require": "^1.1.1",
207
+ "commander": "^9.0.0",
186
208
  "duration": "^0.2.2",
187
209
  "durations": "^3.4.2",
188
210
  "figures": "^3.2.0",
189
211
  "glob": "^7.1.6",
190
212
  "indent-string": "^4.0.0",
191
- "is-generator": "^1.0.3",
192
213
  "is-stream": "^2.0.0",
193
214
  "knuth-shuffle-seeded": "^1.0.6",
194
- "lodash": "^4.17.21",
215
+ "lodash.merge": "^4.6.2",
216
+ "lodash.mergewith": "^4.6.2",
195
217
  "mz": "^2.7.0",
196
218
  "progress": "^2.0.3",
197
219
  "resolve": "^1.19.0",
198
220
  "resolve-pkg": "^2.0.0",
221
+ "semver": "7.3.5",
199
222
  "stack-chain": "^2.0.0",
200
- "stacktrace-js": "^2.0.2",
201
223
  "string-argv": "^0.3.1",
202
224
  "tmp": "^0.2.1",
203
225
  "util-arity": "^1.1.0",
204
- "verror": "^1.10.0"
226
+ "verror": "^1.10.0",
227
+ "yup": "^0.32.11"
205
228
  },
206
229
  "devDependencies": {
207
- "@cucumber/compatibility-kit": "7.0.0",
208
- "@cucumber/message-streams": "2.0.0",
209
- "@cucumber/query": "10.0.0",
210
- "@sinonjs/fake-timers": "7.1.2",
211
- "@types/bluebird": "3.5.35",
212
- "@types/chai": "4.2.18",
230
+ "@cucumber/compatibility-kit": "9.1.2",
231
+ "@cucumber/message-streams": "3.0.0",
232
+ "@cucumber/query": "11.0.0",
233
+ "@microsoft/api-documenter": "^7.15.3",
234
+ "@microsoft/api-extractor": "^7.19.4",
235
+ "@sinonjs/fake-timers": "9.1.0",
236
+ "@types/chai": "4.3.0",
213
237
  "@types/dirty-chai": "2.0.2",
214
- "@types/express": "4.17.12",
215
- "@types/fs-extra": "9.0.11",
216
- "@types/glob": "7.1.3",
217
- "@types/lodash": "4.14.170",
218
- "@types/mocha": "8.2.2",
219
- "@types/mustache": "4.1.1",
220
- "@types/mz": "2.7.3",
221
- "@types/node": "14.17.1",
222
- "@types/progress": "2.0.3",
223
- "@types/resolve": "1.20.0",
224
- "@types/semver": "7.3.6",
225
- "@types/sinon-chai": "3.2.5",
226
- "@types/sinonjs__fake-timers": "6.0.2",
227
- "@types/stream-buffers": "3.0.3",
228
- "@types/tmp": "0.2.0",
229
- "@types/verror": "1.10.4",
230
- "@typescript-eslint/eslint-plugin": "4.26.0",
231
- "@typescript-eslint/parser": "4.26.0",
232
- "chai": "4.3.4",
233
- "chai-exclude": "2.0.3",
234
- "coffeescript": "2.5.1",
235
- "dependency-lint": "6.0.0",
238
+ "@types/express": "4.17.13",
239
+ "@types/fs-extra": "9.0.13",
240
+ "@types/glob": "7.2.0",
241
+ "@types/lodash.merge": "^4.6.6",
242
+ "@types/lodash.mergewith": "^4.6.6",
243
+ "@types/mocha": "9.1.0",
244
+ "@types/mustache": "4.1.2",
245
+ "@types/mz": "2.7.4",
246
+ "@types/node": "16.11.26",
247
+ "@types/progress": "2.0.5",
248
+ "@types/resolve": "1.20.1",
249
+ "@types/semver": "7.3.9",
250
+ "@types/sinon-chai": "3.2.8",
251
+ "@types/sinonjs__fake-timers": "8.1.1",
252
+ "@types/stream-buffers": "3.0.4",
253
+ "@types/tmp": "0.2.3",
254
+ "@types/verror": "1.10.5",
255
+ "@typescript-eslint/eslint-plugin": "5.13.0",
256
+ "@typescript-eslint/parser": "5.13.0",
257
+ "chai": "4.3.6",
258
+ "chai-exclude": "2.1.0",
259
+ "coffeescript": "2.6.1",
260
+ "dependency-lint": "7.1.0",
236
261
  "dirty-chai": "2.0.1",
237
- "eslint": "7.27.0",
238
- "eslint-config-prettier": "8.3.0",
239
- "eslint-config-standard-with-typescript": "20.0.0",
240
- "eslint-plugin-import": "2.23.4",
262
+ "eslint": "8.10.0",
263
+ "eslint-config-prettier": "8.4.0",
264
+ "eslint-plugin-import": "2.25.4",
241
265
  "eslint-plugin-node": "11.1.0",
242
- "eslint-plugin-prettier": "3.4.0",
243
- "eslint-plugin-promise": "5.1.0",
266
+ "eslint-plugin-prettier": "4.0.0",
244
267
  "eslint-plugin-standard": "4.1.0",
245
- "express": "4.17.1",
246
- "fs-extra": "9.1.0",
247
- "mocha": "8.4.0",
268
+ "express": "4.17.3",
269
+ "fs-extra": "10.0.1",
270
+ "genversion": "3.0.2",
271
+ "mocha": "9.2.1",
248
272
  "mustache": "4.2.0",
249
273
  "nyc": "15.1.0",
250
- "prettier": "2.3.0",
251
- "semver": "7.3.5",
252
- "sinon": "11.1.1",
274
+ "prettier": "2.5.1",
275
+ "reindent-template-literals": "1.1.0",
276
+ "shx": "0.3.4",
277
+ "sinon": "13.0.1",
253
278
  "sinon-chai": "3.7.0",
254
279
  "stream-buffers": "3.0.2",
255
280
  "stream-to-string": "1.2.0",
256
- "ts-node": "9.1.1",
257
- "tsd": "0.14.0",
258
- "typescript": "4.3.2"
281
+ "strip-ansi": "6.0.1",
282
+ "ts-node": "10.6.0",
283
+ "tsd": "0.19.1",
284
+ "typescript": "4.6.2"
259
285
  },
260
286
  "scripts": {
261
- "build-local": "tsc -p tsconfig.node.json",
287
+ "build-local": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/ && shx cp src/api/wrapper.mjs lib/api/",
262
288
  "cck-test": "mocha 'compatibility/**/*_spec.ts'",
289
+ "docs:ci": "api-extractor run --verbose",
290
+ "docs:local": "api-extractor run --verbose --local && api-documenter markdown --input-folder ./tmp/api-extractor --output-folder ./docs/api",
263
291
  "feature-test": "node ./bin/cucumber-js",
264
- "html-formatter": "node ./bin/cucumber-js --profile htmlFormatter",
265
292
  "lint-autofix": "eslint --fix \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",
266
293
  "lint-code": "eslint \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",
267
294
  "lint-dependencies": "dependency-lint",
268
- "lint": "yarn run lint-code && yarn run lint-dependencies",
269
- "prelint-autofix": "yarn build-local",
270
- "prelint-code": "yarn build-local",
271
- "precck-test": "yarn run build-local",
272
- "prefeature-test": "yarn run build-local",
295
+ "lint": "npm run lint-code && npm run lint-dependencies",
296
+ "prelint-autofix": "npm run build-local",
297
+ "prelint-code": "npm run build-local",
298
+ "precck-test": "npm run build-local",
299
+ "prefeature-test": "npm run build-local",
273
300
  "prepublishOnly": "rm -rf lib && npm run build-local",
274
- "pretest-coverage": "yarn build-local",
275
- "pretypes-test": "yarn build-local",
301
+ "pretest-coverage": "npm run build-local",
302
+ "pretypes-test": "npm run build-local",
276
303
  "test-coverage": "nyc --silent mocha 'src/**/*_spec.ts' 'compatibility/**/*_spec.ts' && nyc --silent --no-clean node ./bin/cucumber-js && nyc report --reporter=lcov",
277
- "test": "yarn run lint && yarn run types-test && yarn run unit-test && yarn run cck-test && yarn run feature-test",
304
+ "test": "npm run lint && npm run docs:ci && npm run types-test && npm run unit-test && npm run cck-test && npm run feature-test",
278
305
  "types-test": "tsd",
279
306
  "unit-test": "mocha 'src/**/*_spec.ts'",
280
307
  "update-dependencies": "npx npm-check-updates --upgrade"
@@ -284,6 +311,7 @@
284
311
  },
285
312
  "license": "MIT",
286
313
  "files": [
314
+ "api/",
287
315
  "bin/",
288
316
  "lib/"
289
317
  ]
@@ -1,51 +0,0 @@
1
- import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax';
2
- export interface IParsedArgvFormatRerunOptions {
3
- separator?: string;
4
- }
5
- export interface IParsedArgvFormatOptions {
6
- colorsEnabled?: boolean;
7
- rerun?: IParsedArgvFormatRerunOptions;
8
- snippetInterface?: SnippetInterface;
9
- snippetSyntax?: string;
10
- [customKey: string]: any;
11
- }
12
- export interface IParsedArgvOptions {
13
- backtrace: boolean;
14
- dryRun: boolean;
15
- exit: boolean;
16
- failFast: boolean;
17
- format: string[];
18
- formatOptions: IParsedArgvFormatOptions;
19
- i18nKeywords: string;
20
- i18nLanguages: boolean;
21
- language: string;
22
- name: string[];
23
- order: string;
24
- parallel: number;
25
- predictableIds: boolean;
26
- profile: string[];
27
- publish: boolean;
28
- publishQuiet: boolean;
29
- require: string[];
30
- requireModule: string[];
31
- retry: number;
32
- retryTagFilter: string;
33
- strict: boolean;
34
- tags: string;
35
- worldParameters: object;
36
- }
37
- export interface IParsedArgv {
38
- args: string[];
39
- options: IParsedArgvOptions;
40
- }
41
- declare const ArgvParser: {
42
- collect<T>(val: T, memo: T[]): T[];
43
- mergeJson(option: string): (str: string, memo: object) => object;
44
- mergeTags(value: string, memo: string): string;
45
- validateCountOption(value: string, optionName: string): number;
46
- validateLanguage(value: string): string;
47
- validateRetryOptions(options: IParsedArgvOptions): void;
48
- parse(argv: string[]): IParsedArgv;
49
- lint(fullArgv: string[]): void;
50
- };
51
- export default Argv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ACA,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,46 +0,0 @@
1
- import { IParsedArgvFormatOptions } from './argv_parser';
2
- import { IPickleFilterOptions } from '../pickle_filter';
3
- import { IRuntimeOptions } from '../runtime';
4
- export interface IConfigurationFormat {
5
- outputTo: string;
6
- type: string;
7
- }
8
- export interface IConfiguration {
9
- featureDefaultLanguage: string;
10
- featurePaths: string[];
11
- formats: IConfigurationFormat[];
12
- formatOptions: IParsedArgvFormatOptions;
13
- publishing: boolean;
14
- listI18nKeywordsFor: string;
15
- listI18nLanguages: boolean;
16
- order: string;
17
- parallel: number;
18
- pickleFilterOptions: IPickleFilterOptions;
19
- predictableIds: boolean;
20
- profiles: string[];
21
- runtimeOptions: IRuntimeOptions;
22
- shouldExitImmediately: boolean;
23
- supportCodePaths: string[];
24
- supportCodeRequiredModules: string[];
25
- suppressPublishAdvertisement: boolean;
26
- }
27
- export interface INewConfigurationBuilderOptions {
28
- argv: string[];
29
- cwd: string;
30
- }
31
- export default class ConfigurationBuilder {
32
- static build(options: INewConfigurationBuilderOptions): Promise<IConfiguration>;
33
- private readonly cwd;
34
- private readonly args;
35
- private readonly options;
36
- constructor({ argv, cwd }: INewConfigurationBuilderOptions);
37
- build(): Promise<IConfiguration>;
38
- expandPaths(unexpandedPaths: string[], defaultExtension: string): Promise<string[]>;
39
- expandFeaturePaths(featurePaths: string[]): Promise<string[]>;
40
- getFeatureDirectoryPaths(featurePaths: string[]): string[];
41
- isPublishing(): boolean;
42
- isPublishAdvertisementSuppressed(): boolean;
43
- getFormats(): IConfigurationFormat[];
44
- isTruthyString(s: string | undefined): boolean;
45
- getUnexpandedFeaturePaths(): Promise<string[]>;
46
- }