@cucumber/cucumber 11.2.0 → 11.3.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 (196) hide show
  1. package/lib/api/convert_configuration.d.ts +0 -1
  2. package/lib/api/convert_configuration.js +1 -2
  3. package/lib/api/convert_configuration.js.map +1 -1
  4. package/lib/api/formatters.d.ts +0 -2
  5. package/lib/api/formatters.js +1 -2
  6. package/lib/api/formatters.js.map +1 -1
  7. package/lib/api/gherkin.js +1 -2
  8. package/lib/api/gherkin.js.map +1 -1
  9. package/lib/api/load_configuration.js +1 -2
  10. package/lib/api/load_configuration.js.map +1 -1
  11. package/lib/api/load_sources.js +1 -2
  12. package/lib/api/load_sources.js.map +1 -1
  13. package/lib/api/load_support.js +1 -2
  14. package/lib/api/load_support.js.map +1 -1
  15. package/lib/api/plugins.js +3 -4
  16. package/lib/api/plugins.js.map +1 -1
  17. package/lib/api/run_cucumber.js +1 -2
  18. package/lib/api/run_cucumber.js.map +1 -1
  19. package/lib/api/support.js +1 -2
  20. package/lib/api/support.js.map +1 -1
  21. package/lib/api/test_helpers.js +2 -3
  22. package/lib/api/test_helpers.js.map +1 -1
  23. package/lib/assemble/assemble_test_cases.d.ts +0 -1
  24. package/lib/assemble/assemble_test_cases.js +1 -2
  25. package/lib/assemble/assemble_test_cases.js.map +1 -1
  26. package/lib/cli/helpers.d.ts +0 -2
  27. package/lib/cli/helpers.js +20 -11
  28. package/lib/cli/helpers.js.map +1 -1
  29. package/lib/cli/i18n.js +2 -3
  30. package/lib/cli/i18n.js.map +1 -1
  31. package/lib/cli/index.d.ts +0 -1
  32. package/lib/cli/index.js.map +1 -1
  33. package/lib/cli/install_validator.js +1 -2
  34. package/lib/cli/install_validator.js.map +1 -1
  35. package/lib/cli/run.js +1 -1
  36. package/lib/cli/run.js.map +1 -1
  37. package/lib/cli/validate_node_engine_version.js +1 -2
  38. package/lib/cli/validate_node_engine_version.js.map +1 -1
  39. package/lib/configuration/argv_parser.js.map +1 -1
  40. package/lib/configuration/check_schema.js +18 -9
  41. package/lib/configuration/check_schema.js.map +1 -1
  42. package/lib/configuration/from_file.js +1 -2
  43. package/lib/configuration/from_file.js.map +1 -1
  44. package/lib/configuration/helpers.js +1 -2
  45. package/lib/configuration/helpers.js.map +1 -1
  46. package/lib/configuration/locate_file.js +1 -2
  47. package/lib/configuration/locate_file.js.map +1 -1
  48. package/lib/configuration/merge_configurations.js +1 -2
  49. package/lib/configuration/merge_configurations.js.map +1 -1
  50. package/lib/configuration/parse_configuration.js +1 -2
  51. package/lib/configuration/parse_configuration.js.map +1 -1
  52. package/lib/configuration/split_format_descriptor.js +1 -2
  53. package/lib/configuration/split_format_descriptor.js.map +1 -1
  54. package/lib/configuration/validate_configuration.js +1 -2
  55. package/lib/configuration/validate_configuration.js.map +1 -1
  56. package/lib/environment/console_logger.d.ts +0 -1
  57. package/lib/environment/console_logger.js.map +1 -1
  58. package/lib/environment/make_environment.js +1 -2
  59. package/lib/environment/make_environment.js.map +1 -1
  60. package/lib/environment/types.d.ts +0 -1
  61. package/lib/filter_stack_trace.js +2 -3
  62. package/lib/filter_stack_trace.js.map +1 -1
  63. package/lib/formatter/builder.d.ts +1 -5
  64. package/lib/formatter/builder.js.map +1 -1
  65. package/lib/formatter/builtin/html.js +1 -4
  66. package/lib/formatter/builtin/html.js.map +1 -1
  67. package/lib/formatter/builtin/index.d.ts +1 -1
  68. package/lib/formatter/create_stream.d.ts +0 -1
  69. package/lib/formatter/create_stream.js +1 -2
  70. package/lib/formatter/create_stream.js.map +1 -1
  71. package/lib/formatter/find_class_or_plugin.js +1 -2
  72. package/lib/formatter/find_class_or_plugin.js.map +1 -1
  73. package/lib/formatter/get_color_fns.d.ts +0 -2
  74. package/lib/formatter/get_color_fns.js +1 -1
  75. package/lib/formatter/get_color_fns.js.map +1 -1
  76. package/lib/formatter/helpers/duration_helpers.js +2 -3
  77. package/lib/formatter/helpers/duration_helpers.js.map +1 -1
  78. package/lib/formatter/helpers/event_data_collector.d.ts +0 -1
  79. package/lib/formatter/helpers/event_data_collector.js +17 -7
  80. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  81. package/lib/formatter/helpers/gherkin_document_parser.js +4 -5
  82. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
  83. package/lib/formatter/helpers/index.js +17 -7
  84. package/lib/formatter/helpers/index.js.map +1 -1
  85. package/lib/formatter/helpers/issue_helpers.js +6 -7
  86. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  87. package/lib/formatter/helpers/keyword_type.js +3 -3
  88. package/lib/formatter/helpers/keyword_type.js.map +1 -1
  89. package/lib/formatter/helpers/location_helpers.js +1 -2
  90. package/lib/formatter/helpers/location_helpers.js.map +1 -1
  91. package/lib/formatter/helpers/pickle_parser.js +4 -5
  92. package/lib/formatter/helpers/pickle_parser.js.map +1 -1
  93. package/lib/formatter/helpers/step_argument_formatter.js +1 -2
  94. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
  95. package/lib/formatter/helpers/summary_helpers.js +18 -9
  96. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  97. package/lib/formatter/helpers/test_case_attempt_formatter.js +18 -9
  98. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  99. package/lib/formatter/helpers/test_case_attempt_parser.js +18 -9
  100. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  101. package/lib/formatter/helpers/usage_helpers/index.js +18 -9
  102. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  103. package/lib/formatter/import_code.js +1 -2
  104. package/lib/formatter/import_code.js.map +1 -1
  105. package/lib/formatter/index.d.ts +0 -2
  106. package/lib/formatter/json_formatter.js +17 -7
  107. package/lib/formatter/json_formatter.js.map +1 -1
  108. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  109. package/lib/formatter/progress_formatter.js +17 -7
  110. package/lib/formatter/progress_formatter.js.map +1 -1
  111. package/lib/formatter/rerun_formatter.js +17 -7
  112. package/lib/formatter/rerun_formatter.js.map +1 -1
  113. package/lib/formatter/resolve_implementation.js +1 -2
  114. package/lib/formatter/resolve_implementation.js.map +1 -1
  115. package/lib/formatter/snippets_formatter.js +17 -7
  116. package/lib/formatter/snippets_formatter.js.map +1 -1
  117. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
  118. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  119. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +1 -1
  120. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
  121. package/lib/formatter/summary_formatter.js.map +1 -1
  122. package/lib/formatter/usage_formatter.js +17 -7
  123. package/lib/formatter/usage_formatter.js.map +1 -1
  124. package/lib/formatter/usage_json_formatter.js.map +1 -1
  125. package/lib/index.d.ts +4 -4
  126. package/lib/index.js +17 -7
  127. package/lib/index.js.map +1 -1
  128. package/lib/models/data_table.js.map +1 -1
  129. package/lib/models/step_definition.js.map +1 -1
  130. package/lib/paths/paths.js +1 -2
  131. package/lib/paths/paths.js.map +1 -1
  132. package/lib/pickle_filter.js.map +1 -1
  133. package/lib/plugin/plugin_manager.js +1 -1
  134. package/lib/plugin/plugin_manager.js.map +1 -1
  135. package/lib/publish/publish_plugin.js +46 -16
  136. package/lib/publish/publish_plugin.js.map +1 -1
  137. package/lib/runtime/attachment_manager/index.d.ts +0 -2
  138. package/lib/runtime/attachment_manager/index.js +17 -7
  139. package/lib/runtime/attachment_manager/index.js.map +1 -1
  140. package/lib/runtime/coordinator.d.ts +0 -1
  141. package/lib/runtime/format_error.js +1 -2
  142. package/lib/runtime/format_error.js.map +1 -1
  143. package/lib/runtime/helpers.js +20 -11
  144. package/lib/runtime/helpers.js.map +1 -1
  145. package/lib/runtime/make_runtime.d.ts +0 -1
  146. package/lib/runtime/make_runtime.js +1 -2
  147. package/lib/runtime/make_runtime.js.map +1 -1
  148. package/lib/runtime/parallel/adapter.d.ts +0 -2
  149. package/lib/runtime/parallel/adapter.js.map +1 -1
  150. package/lib/runtime/parallel/run_worker.js.map +1 -1
  151. package/lib/runtime/parallel/worker.js.map +1 -1
  152. package/lib/runtime/run_test_run_hooks.js.map +1 -1
  153. package/lib/runtime/scope/make_proxy.js +1 -2
  154. package/lib/runtime/scope/make_proxy.js.map +1 -1
  155. package/lib/runtime/scope/test_case_scope.js +2 -2
  156. package/lib/runtime/scope/test_case_scope.js.map +1 -1
  157. package/lib/runtime/scope/test_run_scope.js +2 -2
  158. package/lib/runtime/scope/test_run_scope.js.map +1 -1
  159. package/lib/runtime/serial/adapter.d.ts +0 -1
  160. package/lib/runtime/serial/adapter.js.map +1 -1
  161. package/lib/runtime/step_runner.js +18 -9
  162. package/lib/runtime/step_runner.js.map +1 -1
  163. package/lib/runtime/stopwatch.js.map +1 -1
  164. package/lib/runtime/test_case_runner.d.ts +0 -1
  165. package/lib/runtime/test_case_runner.js +17 -7
  166. package/lib/runtime/test_case_runner.js.map +1 -1
  167. package/lib/runtime/worker.d.ts +0 -1
  168. package/lib/runtime/worker.js.map +1 -1
  169. package/lib/step_arguments.js +1 -2
  170. package/lib/step_arguments.js.map +1 -1
  171. package/lib/support_code_library_builder/build_parameter_type.js +1 -2
  172. package/lib/support_code_library_builder/build_parameter_type.js.map +1 -1
  173. package/lib/support_code_library_builder/get_definition_line_and_uri.js +1 -2
  174. package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
  175. package/lib/support_code_library_builder/index.js.map +1 -1
  176. package/lib/support_code_library_builder/parallel_can_assign_helpers.js +1 -2
  177. package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -1
  178. package/lib/support_code_library_builder/validate_arguments.js +1 -1
  179. package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
  180. package/lib/time.d.ts +0 -2
  181. package/lib/time.js +19 -10
  182. package/lib/time.js.map +1 -1
  183. package/lib/try_require.js +1 -1
  184. package/lib/try_require.js.map +1 -1
  185. package/lib/tsconfig.node.tsbuildinfo +1 -0
  186. package/lib/uncaught_exception_manager.d.ts +0 -1
  187. package/lib/user_code_runner.js.map +1 -1
  188. package/lib/value_checker.js +3 -4
  189. package/lib/value_checker.js.map +1 -1
  190. package/lib/version.d.ts +1 -1
  191. package/lib/version.js +1 -1
  192. package/lib/version.js.map +1 -1
  193. package/package.json +49 -51
  194. package/lib/publish/http_stream.d.ts +0 -30
  195. package/lib/publish/http_stream.js +0 -117
  196. package/lib/publish/http_stream.js.map +0 -1
package/lib/time.js CHANGED
@@ -15,15 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.wrapPromiseWithTimeout = exports.durationBetweenTimestamps = void 0;
36
+ exports.durationBetweenTimestamps = durationBetweenTimestamps;
37
+ exports.wrapPromiseWithTimeout = wrapPromiseWithTimeout;
27
38
  const node_perf_hooks_1 = require("node:perf_hooks");
28
39
  const messages = __importStar(require("@cucumber/messages"));
29
40
  const methods = {
@@ -43,7 +54,6 @@ function durationBetweenTimestamps(startedTimestamp, finishedTimestamp) {
43
54
  messages.TimeConversion.timestampToMillisecondsSinceEpoch(startedTimestamp);
44
55
  return messages.TimeConversion.millisecondsToDuration(durationMillis);
45
56
  }
46
- exports.durationBetweenTimestamps = durationBetweenTimestamps;
47
57
  async function wrapPromiseWithTimeout(promise, timeoutInMilliseconds, timeoutMessage = '') {
48
58
  let timeoutId;
49
59
  if (timeoutMessage === '') {
@@ -56,6 +66,5 @@ async function wrapPromiseWithTimeout(promise, timeoutInMilliseconds, timeoutMes
56
66
  });
57
67
  return await Promise.race([promise, timeoutPromise]).finally(() => methods.clearTimeout(timeoutId));
58
68
  }
59
- exports.wrapPromiseWithTimeout = wrapPromiseWithTimeout;
60
69
  exports.default = methods;
61
70
  //# 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,qDAA6C;AAC7C,6DAA8C;AAa9C,MAAM,OAAO,GAAqC;IAChD,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IACvC,IAAI;IACJ,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;IACnC,WAAW,EAAX,6BAAW;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,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,SAAwC,CAAA;IAC5C,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 'node:perf_hooks'\nimport * as messages from '@cucumber/messages'\n\ninterface ProtectedTimingBuiltins {\n clearImmediate: typeof clearImmediate\n clearInterval: typeof clearInterval\n clearTimeout: typeof clearTimeout\n Date: typeof Date\n setImmediate: typeof setImmediate\n setInterval: typeof setInterval\n setTimeout: typeof setTimeout\n performance: typeof performance\n}\n\nconst methods: Partial<ProtectedTimingBuiltins> = {\n clearInterval: clearInterval.bind(global),\n clearTimeout: clearTimeout.bind(global),\n Date,\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\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: ReturnType<typeof setTimeout>\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"]}
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,8DAUC;AAED,wDAiBC;AAzDD,qDAA6C;AAC7C,6DAA8C;AAa9C,MAAM,OAAO,GAAqC;IAChD,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IACvC,IAAI;IACJ,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;IACnC,WAAW,EAAX,6BAAW;CACZ,CAAA;AAED,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE,CAAC;IACxC,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAChD,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACtD,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;AAEM,KAAK,UAAU,sBAAsB,CAC1C,OAAmB,EACnB,qBAA6B,EAC7B,iBAAyB,EAAE;IAE3B,IAAI,SAAwC,CAAA;IAC5C,IAAI,cAAc,KAAK,EAAE,EAAE,CAAC;QAC1B,cAAc,GAAG,kCAAkC,qBAAqB,eAAe,CAAA;IACzF,CAAC;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;AAED,kBAAe,OAAO,CAAA","sourcesContent":["import { performance } from 'node:perf_hooks'\nimport * as messages from '@cucumber/messages'\n\ninterface ProtectedTimingBuiltins {\n clearImmediate: typeof clearImmediate\n clearInterval: typeof clearInterval\n clearTimeout: typeof clearTimeout\n Date: typeof Date\n setImmediate: typeof setImmediate\n setInterval: typeof setInterval\n setTimeout: typeof setTimeout\n performance: typeof performance\n}\n\nconst methods: Partial<ProtectedTimingBuiltins> = {\n clearInterval: clearInterval.bind(global),\n clearTimeout: clearTimeout.bind(global),\n Date,\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\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: ReturnType<typeof setTimeout>\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"]}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = tryRequire;
3
4
  /**
4
5
  * Provides a try guarded require call that will throw a more detailed error when
5
6
  * the ERR_REQUIRE_ESM error code is encountered.
@@ -24,5 +25,4 @@ function tryRequire(path) {
24
25
  }
25
26
  }
26
27
  }
27
- exports.default = tryRequire;
28
28
  //# sourceMappingURL=try_require.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"try_require.js","sourceRoot":"","sources":["../src/try_require.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,SAAwB,UAAU,CAAC,IAAY;IAC7C,IAAI;QACF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;KACrB;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE;YACpC,MAAM,KAAK,CACT,2CAA2C,IAAI;oGAC6C,EAC5F,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;SACF;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,0BAA0B,EAAE;YACpD,MAAM,KAAK,CACT,+DAA+D,IAAI;uGAC4B,EAC/F,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;SACF;aAAM;YACL,MAAM,KAAK,CAAA;SACZ;KACF;AACH,CAAC;AApBD,6BAoBC","sourcesContent":["/**\n * Provides a try guarded require call that will throw a more detailed error when\n * the ERR_REQUIRE_ESM error code is encountered.\n *\n * @param {string} path File path to require from.\n */\nexport default function tryRequire(path: string) {\n try {\n return require(path)\n } catch (error) {\n if (error.code === 'ERR_REQUIRE_ESM') {\n throw Error(\n `Cucumber expected a CommonJS module at '${path}' but found an ES module.\n Either change the file to CommonJS syntax or use the --import directive instead of --require.`,\n { cause: error }\n )\n } else if (error.code === 'ERR_REQUIRE_ASYNC_MODULE') {\n throw Error(\n `Cucumber expected a CommonJS module or simple ES module at '${path}' but found an async ES module.\n Either change the file so it can be required or use the --import directive instead of --require.`,\n { cause: error }\n )\n } else {\n throw error\n }\n }\n}\n"]}
1
+ {"version":3,"file":"try_require.js","sourceRoot":"","sources":["../src/try_require.ts"],"names":[],"mappings":";;AAMA,6BAoBC;AA1BD;;;;;GAKG;AACH,SAAwB,UAAU,CAAC,IAAY;IAC7C,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACrC,MAAM,KAAK,CACT,2CAA2C,IAAI;oGAC6C,EAC5F,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,0BAA0B,EAAE,CAAC;YACrD,MAAM,KAAK,CACT,+DAA+D,IAAI;uGAC4B,EAC/F,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/**\n * Provides a try guarded require call that will throw a more detailed error when\n * the ERR_REQUIRE_ESM error code is encountered.\n *\n * @param {string} path File path to require from.\n */\nexport default function tryRequire(path: string) {\n try {\n return require(path)\n } catch (error) {\n if (error.code === 'ERR_REQUIRE_ESM') {\n throw Error(\n `Cucumber expected a CommonJS module at '${path}' but found an ES module.\n Either change the file to CommonJS syntax or use the --import directive instead of --require.`,\n { cause: error }\n )\n } else if (error.code === 'ERR_REQUIRE_ASYNC_MODULE') {\n throw Error(\n `Cucumber expected a CommonJS module or simple ES module at '${path}' but found an async ES module.\n Either change the file so it can be required or use the --import directive instead of --require.`,\n { cause: error }\n )\n } else {\n throw error\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"root":["../src/filter_stack_trace.ts","../src/index.ts","../src/pickle_filter.ts","../src/step_arguments.ts","../src/time.ts","../src/try_require.ts","../src/uncaught_exception_manager.ts","../src/user_code_runner.ts","../src/value_checker.ts","../src/version.ts","../src/api/convert_configuration.ts","../src/api/formatters.ts","../src/api/gherkin.ts","../src/api/index.ts","../src/api/load_configuration.ts","../src/api/load_sources.ts","../src/api/load_support.ts","../src/api/plugins.ts","../src/api/run_cucumber.ts","../src/api/support.ts","../src/api/test_helpers.ts","../src/api/types.ts","../src/assemble/assemble_test_cases.ts","../src/assemble/index.ts","../src/assemble/types.ts","../src/cli/helpers.ts","../src/cli/i18n.ts","../src/cli/index.ts","../src/cli/install_validator.ts","../src/cli/run.ts","../src/cli/validate_node_engine_version.ts","../src/configuration/argv_parser.ts","../src/configuration/check_schema.ts","../src/configuration/default_configuration.ts","../src/configuration/from_file.ts","../src/configuration/helpers.ts","../src/configuration/index.ts","../src/configuration/locate_file.ts","../src/configuration/merge_configurations.ts","../src/configuration/parse_configuration.ts","../src/configuration/split_format_descriptor.ts","../src/configuration/types.ts","../src/configuration/validate_configuration.ts","../src/environment/console_logger.ts","../src/environment/index.ts","../src/environment/make_environment.ts","../src/environment/types.ts","../src/filter/filter_plugin.ts","../src/filter/index.ts","../src/filter/types.ts","../src/formatter/builder.ts","../src/formatter/create_stream.ts","../src/formatter/find_class_or_plugin.ts","../src/formatter/get_color_fns.ts","../src/formatter/import_code.ts","../src/formatter/index.ts","../src/formatter/json_formatter.ts","../src/formatter/progress_bar_formatter.ts","../src/formatter/progress_formatter.ts","../src/formatter/rerun_formatter.ts","../src/formatter/resolve_implementation.ts","../src/formatter/snippets_formatter.ts","../src/formatter/summary_formatter.ts","../src/formatter/usage_formatter.ts","../src/formatter/usage_json_formatter.ts","../src/formatter/builtin/html.ts","../src/formatter/builtin/index.ts","../src/formatter/builtin/message.ts","../src/formatter/helpers/duration_helpers.ts","../src/formatter/helpers/event_data_collector.ts","../src/formatter/helpers/formatters.ts","../src/formatter/helpers/gherkin_document_parser.ts","../src/formatter/helpers/index.ts","../src/formatter/helpers/issue_helpers.ts","../src/formatter/helpers/keyword_type.ts","../src/formatter/helpers/location_helpers.ts","../src/formatter/helpers/pickle_parser.ts","../src/formatter/helpers/step_argument_formatter.ts","../src/formatter/helpers/summary_helpers.ts","../src/formatter/helpers/test_case_attempt_formatter.ts","../src/formatter/helpers/test_case_attempt_parser.ts","../src/formatter/helpers/usage_helpers/index.ts","../src/formatter/step_definition_snippet_builder/index.ts","../src/formatter/step_definition_snippet_builder/javascript_snippet_syntax.ts","../src/formatter/step_definition_snippet_builder/snippet_syntax.ts","../src/models/data_table.ts","../src/models/definition.ts","../src/models/gherkin_step_keyword.ts","../src/models/step_definition.ts","../src/models/test_case_hook_definition.ts","../src/models/test_run_hook_definition.ts","../src/models/test_step_hook_definition.ts","../src/paths/index.ts","../src/paths/paths.ts","../src/paths/types.ts","../src/plugin/events.ts","../src/plugin/index.ts","../src/plugin/plugin_manager.ts","../src/plugin/types.ts","../src/publish/index.ts","../src/publish/publish_plugin.ts","../src/publish/types.ts","../src/runtime/coordinator.ts","../src/runtime/format_error.ts","../src/runtime/helpers.ts","../src/runtime/index.ts","../src/runtime/make_runtime.ts","../src/runtime/run_test_run_hooks.ts","../src/runtime/step_runner.ts","../src/runtime/stopwatch.ts","../src/runtime/test_case_runner.ts","../src/runtime/types.ts","../src/runtime/worker.ts","../src/runtime/attachment_manager/index.ts","../src/runtime/parallel/adapter.ts","../src/runtime/parallel/run_worker.ts","../src/runtime/parallel/types.ts","../src/runtime/parallel/worker.ts","../src/runtime/scope/index.ts","../src/runtime/scope/make_proxy.ts","../src/runtime/scope/test_case_scope.ts","../src/runtime/scope/test_run_scope.ts","../src/runtime/serial/adapter.ts","../src/support_code_library_builder/build_parameter_type.ts","../src/support_code_library_builder/context.ts","../src/support_code_library_builder/get_definition_line_and_uri.ts","../src/support_code_library_builder/index.ts","../src/support_code_library_builder/parallel_can_assign_helpers.ts","../src/support_code_library_builder/sourced_parameter_type_registry.ts","../src/support_code_library_builder/types.ts","../src/support_code_library_builder/validate_arguments.ts","../src/support_code_library_builder/world.ts","../src/types/index.ts","../src/types/assertion-error-formatter/index.d.ts","../src/types/is-generator/index.d.ts","../src/types/knuth-shuffle-seeded/index.d.ts","../src/types/stack-chain/index.d.ts","../src/types/supports-color/index.d.ts"],"version":"5.8.3"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import UncaughtExceptionListener = NodeJS.UncaughtExceptionListener;
3
2
  declare const UncaughtExceptionManager: {
4
3
  registerHandler(handler: UncaughtExceptionListener): void;
@@ -1 +1 @@
1
- {"version":3,"file":"user_code_runner.js","sourceRoot":"","sources":["../src/user_code_runner.ts"],"names":[],"mapp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gB,CAAC,CAAA;QAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IAC1B,CAAC;CACF,CAAA;AAED,kBAAe,cAAc,CAAA","sourcesContent":["import util from 'node:util'\nimport { wrapPromiseWithTimeout } from './time'\nimport UncaughtExceptionManager from './uncaught_exception_manager'\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
+ {"version":3,"file":"user_code_runner.js","sourceRoot":"","sources":["../src/user_code_runner.ts"],"names":[],"mappings":";;;;;AAAA,0DAA4B;AAC5B,iCAA+C;AAC/C,8FAAmE;AACnE,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,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,MAAM,CAAC,KAAK,CAAC,CAAA;gBACf,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,MAAM,CAAC,CAAA;gBACjB,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAA;QACZ,IAAI,CAAC;YACH,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;QACzC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YACrD,OAAO,EAAE,KAAK,EAAE,CAAA;QAClB,CAAC;QAED,MAA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EACZ,qBAAqB,EACrB,cAAc,CACf,CAAA;QACH,CAAC;QAED,IAAI,KAAK,EAAE,MAAM,CAAA;QACjB,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,YAAY,CAAA;QAC7B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;gBACvB,KAAK,GAAG,CAAC,CAAA;YACX,CAAC;iBAAM,IAAI,IAAA,6BAAa,EAAC,CAAC,CAAC,EAAE,CAAC;gBAC5B,KAAK,GAAG,mBAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YACxB,CAAC;iBAAM,CAAC;gBACN,KAAK,GAAG,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;YACxD,CAAC;QACH,CAAC;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 util from 'node:util'\nimport { wrapPromiseWithTimeout } from './time'\nimport UncaughtExceptionManager from './uncaught_exception_manager'\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,19 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.valueOrDefault = exports.doesNotHaveValue = exports.doesHaveValue = void 0;
3
+ exports.doesHaveValue = doesHaveValue;
4
+ exports.doesNotHaveValue = doesNotHaveValue;
5
+ exports.valueOrDefault = valueOrDefault;
4
6
  function doesHaveValue(value) {
5
7
  return !doesNotHaveValue(value);
6
8
  }
7
- exports.doesHaveValue = doesHaveValue;
8
9
  function doesNotHaveValue(value) {
9
10
  return value === null || value === undefined;
10
11
  }
11
- exports.doesNotHaveValue = doesNotHaveValue;
12
12
  function valueOrDefault(value, defaultValue) {
13
13
  if (doesHaveValue(value)) {
14
14
  return value;
15
15
  }
16
16
  return defaultValue;
17
17
  }
18
- exports.valueOrDefault = valueOrDefault;
19
18
  //# sourceMappingURL=value_checker.js.map
@@ -1 +1 @@
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"]}
1
+ {"version":3,"file":"value_checker.js","sourceRoot":"","sources":["../src/value_checker.ts"],"names":[],"mappings":";;AAAA,sCAEC;AAED,4CAEC;AAED,wCAKC;AAbD,SAAgB,aAAa,CAAI,KAAQ;IACvC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;AACjC,CAAC;AAED,SAAgB,gBAAgB,CAAI,KAAQ;IAC1C,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAA;AAC9C,CAAC;AAED,SAAgB,cAAc,CAAI,KAAQ,EAAE,YAAe;IACzD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC","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"]}
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "11.2.0";
1
+ export declare const version = "11.3.0";
package/lib/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '11.2.0';
5
+ exports.version = '11.3.0';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '11.2.0'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '11.3.0'\n"]}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "gherkin",
9
9
  "tests"
10
10
  ],
11
- "version": "11.2.0",
11
+ "version": "11.3.0",
12
12
  "funding": "https://opencollective.com/cucumber",
13
13
  "homepage": "https://github.com/cucumber/cucumber-js",
14
14
  "author": "Julien Biezemans <jb@jbpros.com>",
@@ -220,16 +220,16 @@
220
220
  "@cucumber/cucumber-expressions": "18.0.1",
221
221
  "@cucumber/gherkin": "30.0.4",
222
222
  "@cucumber/gherkin-streams": "5.0.1",
223
- "@cucumber/gherkin-utils": "9.0.0",
224
- "@cucumber/html-formatter": "21.7.0",
223
+ "@cucumber/gherkin-utils": "9.2.0",
224
+ "@cucumber/html-formatter": "21.10.1",
225
225
  "@cucumber/junit-xml-formatter": "0.7.1",
226
226
  "@cucumber/message-streams": "4.0.1",
227
- "@cucumber/messages": "27.0.2",
228
- "@cucumber/tag-expressions": "6.1.1",
227
+ "@cucumber/messages": "27.2.0",
228
+ "@cucumber/tag-expressions": "6.1.2",
229
229
  "assertion-error-formatter": "^3.0.0",
230
230
  "capital-case": "^1.0.4",
231
231
  "chalk": "^4.1.2",
232
- "cli-table3": "0.6.3",
232
+ "cli-table3": "0.6.5",
233
233
  "commander": "^10.0.0",
234
234
  "debug": "^4.3.4",
235
235
  "error-stack-parser": "^2.1.4",
@@ -242,77 +242,75 @@
242
242
  "knuth-shuffle-seeded": "^1.0.6",
243
243
  "lodash.merge": "^4.6.2",
244
244
  "lodash.mergewith": "^4.6.2",
245
- "luxon": "3.2.1",
245
+ "luxon": "3.6.1",
246
246
  "mime": "^3.0.0",
247
247
  "mkdirp": "^2.1.5",
248
248
  "mz": "^2.7.0",
249
249
  "progress": "^2.0.3",
250
250
  "read-package-up": "^11.0.0",
251
- "resolve-pkg": "^2.0.0",
252
- "semver": "7.5.3",
251
+ "semver": "7.7.1",
253
252
  "string-argv": "0.3.1",
254
253
  "supports-color": "^8.1.1",
255
- "tmp": "0.2.3",
256
- "type-fest": "^4.8.3",
254
+ "type-fest": "^4.41.0",
257
255
  "util-arity": "^1.1.0",
258
256
  "yaml": "^2.2.2",
259
- "yup": "1.2.0"
257
+ "yup": "1.6.1"
260
258
  },
261
259
  "devDependencies": {
262
- "@cucumber/compatibility-kit": "17.0.0",
263
- "@cucumber/query": "13.0.3",
264
- "@microsoft/api-extractor": "7.39.0",
265
- "@sinonjs/fake-timers": "10.0.2",
266
- "@types/chai": "4.3.4",
267
- "@types/debug": "4.1.7",
268
- "@types/dirty-chai": "2.0.2",
269
- "@types/express": "4.17.15",
260
+ "@cucumber/compatibility-kit": "17.0.1",
261
+ "@cucumber/query": "13.2.0",
262
+ "@microsoft/api-extractor": "7.52.7",
263
+ "@sinonjs/fake-timers": "14.0.0",
264
+ "@types/chai": "4.3.20",
265
+ "@types/debug": "4.1.12",
266
+ "@types/dirty-chai": "2.0.5",
267
+ "@types/express": "5.0.1",
270
268
  "@types/fs-extra": "9.0.13",
271
269
  "@types/glob": "8.1.0",
272
- "@types/has-ansi": "5.0.0",
273
- "@types/lodash.merge": "4.6.7",
274
- "@types/lodash.mergewith": "4.6.7",
275
- "@types/luxon": "3.2.0",
276
- "@types/mocha": "10.0.1",
277
- "@types/mustache": "4.2.2",
278
- "@types/mz": "2.7.4",
279
- "@types/node": "20.8.3",
280
- "@types/progress": "2.0.5",
281
- "@types/semver": "7.5.0",
282
- "@types/sinon-chai": "3.2.9",
283
- "@types/sinonjs__fake-timers": "8.1.2",
284
- "@types/stream-buffers": "3.0.4",
285
- "@types/tmp": "0.2.3",
286
- "@typescript-eslint/eslint-plugin": "6.7.4",
287
- "@typescript-eslint/parser": "6.7.4",
288
- "chai": "4.3.7",
289
- "chai-exclude": "2.1.0",
270
+ "@types/has-ansi": "5.0.2",
271
+ "@types/lodash.merge": "4.6.9",
272
+ "@types/lodash.mergewith": "4.6.9",
273
+ "@types/luxon": "3.6.2",
274
+ "@types/mocha": "10.0.10",
275
+ "@types/mustache": "4.2.5",
276
+ "@types/mz": "2.7.8",
277
+ "@types/node": "20.17.46",
278
+ "@types/progress": "2.0.7",
279
+ "@types/semver": "7.7.0",
280
+ "@types/sinon-chai": "3.2.12",
281
+ "@types/sinonjs__fake-timers": "8.1.5",
282
+ "@types/stream-buffers": "3.0.7",
283
+ "@types/tmp": "0.2.6",
284
+ "@typescript-eslint/eslint-plugin": "6.21.0",
285
+ "@typescript-eslint/parser": "6.21.0",
286
+ "chai": "4.5.0",
287
+ "chai-exclude": "2.1.1",
290
288
  "coffeescript": "2.7.0",
291
289
  "dependency-lint": "7.1.0",
292
290
  "dirty-chai": "2.0.1",
293
- "eslint": "8.51.0",
294
- "eslint-config-prettier": "9.0.0",
295
- "eslint-plugin-import": "2.28.1",
296
- "eslint-plugin-node": "11.1.0",
291
+ "eslint": "8.57.1",
292
+ "eslint-config-prettier": "10.1.5",
293
+ "eslint-plugin-import": "2.31.0",
294
+ "eslint-plugin-n": "17.17.0",
297
295
  "eslint-plugin-standard": "5.0.0",
298
296
  "eslint-plugin-unicorn": "^48.0.1",
299
297
  "express": "^4.21.0",
300
298
  "fs-extra": "10.1.0",
301
- "genversion": "3.1.1",
299
+ "genversion": "3.2.0",
302
300
  "mocha": "^11.0.1",
303
301
  "mustache": "4.2.0",
304
302
  "nyc": "15.1.0",
305
- "prettier": "3.0.3",
303
+ "prettier": "3.5.3",
306
304
  "reindent-template-literals": "1.1.0",
307
305
  "shx": "0.3.4",
308
- "sinon": "15.0.1",
306
+ "sinon": "15.2.0",
309
307
  "sinon-chai": "3.7.0",
310
- "stream-to-string": "1.2.0",
311
- "ts-node": "10.9.1",
312
- "tsd": "0.25.0",
313
- "typedoc": "^0.26.11",
314
- "typedoc-plugin-extras": "^3.1.0",
315
- "typescript": "^4.9.5"
308
+ "stream-to-string": "1.2.1",
309
+ "tmp": "0.2.3",
310
+ "ts-node": "10.9.2",
311
+ "tsd": "0.32.0",
312
+ "typedoc": "^0.28.0",
313
+ "typescript": "^5.8.3"
316
314
  },
317
315
  "overrides": {
318
316
  "ansi-regex": "^5.0.1"
@@ -1,30 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- import { Transform } from 'node:stream';
5
- import http from 'node:http';
6
- type HttpMethod = 'GET' | 'POST' | 'PUT';
7
- /**
8
- * This Writable writes data to a HTTP/HTTPS URL.
9
- *
10
- * It has special handling for https://reports.cucumber.io/
11
- * which uses an API where the first request is a `GET`,
12
- * and if the response is 202 with a Location header, issues
13
- * a PUT request to that URL.
14
- *
15
- * 3xx redirects are not currently followed.
16
- */
17
- export default class HttpStream extends Transform {
18
- private readonly url;
19
- private readonly method;
20
- private readonly headers;
21
- private tempFilePath;
22
- private tempFile;
23
- constructor(url: string, method: HttpMethod, headers: http.OutgoingHttpHeaders);
24
- _write(chunk: any, encoding: BufferEncoding, callback: (err?: Error | null) => void): void;
25
- _final(callback: (error?: Error | null) => void): void;
26
- private pushResponseBody;
27
- private emitErrorUnlessHttp2xx;
28
- private sendHttpRequest;
29
- }
30
- export {};
@@ -1,117 +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
- const node_stream_1 = require("node:stream");
7
- const node_fs_1 = __importDefault(require("node:fs"));
8
- const node_http_1 = __importDefault(require("node:http"));
9
- const node_https_1 = __importDefault(require("node:https"));
10
- const tmp_1 = __importDefault(require("tmp"));
11
- const value_checker_1 = require("../value_checker");
12
- /**
13
- * This Writable writes data to a HTTP/HTTPS URL.
14
- *
15
- * It has special handling for https://reports.cucumber.io/
16
- * which uses an API where the first request is a `GET`,
17
- * and if the response is 202 with a Location header, issues
18
- * a PUT request to that URL.
19
- *
20
- * 3xx redirects are not currently followed.
21
- */
22
- class HttpStream extends node_stream_1.Transform {
23
- url;
24
- method;
25
- headers;
26
- tempFilePath;
27
- tempFile;
28
- constructor(url, method, headers) {
29
- super({
30
- readableObjectMode: true,
31
- });
32
- this.url = url;
33
- this.method = method;
34
- this.headers = headers;
35
- }
36
- _write(chunk, encoding, callback) {
37
- if (this.tempFile === undefined) {
38
- tmp_1.default.file((err, name, fd) => {
39
- if ((0, value_checker_1.doesHaveValue)(err))
40
- return callback(err);
41
- this.tempFilePath = name;
42
- this.tempFile = node_fs_1.default.createWriteStream(name, { fd });
43
- this.tempFile.write(chunk, encoding, callback);
44
- });
45
- }
46
- else {
47
- this.tempFile.write(chunk, encoding, callback);
48
- }
49
- }
50
- _final(callback) {
51
- this.tempFile.end(() => {
52
- this.sendHttpRequest(this.url, this.method, this.headers, (err1, res1) => {
53
- if ((0, value_checker_1.doesHaveValue)(err1))
54
- return callback(err1);
55
- this.pushResponseBody(res1, () => {
56
- this.emitErrorUnlessHttp2xx(res1, this.url, this.method);
57
- if (res1.statusCode === 202 &&
58
- res1.headers.location !== undefined) {
59
- this.sendHttpRequest(res1.headers.location, 'PUT', {}, (err2, res2) => {
60
- if ((0, value_checker_1.doesHaveValue)(err2))
61
- return callback(err2);
62
- this.emitErrorUnlessHttp2xx(res2, res1.headers.location, 'PUT');
63
- callback();
64
- });
65
- }
66
- else {
67
- callback();
68
- }
69
- });
70
- });
71
- });
72
- }
73
- pushResponseBody(res, done) {
74
- let body = Buffer.alloc(0);
75
- res.on('data', (chunk) => {
76
- body = Buffer.concat([body, chunk]);
77
- });
78
- res.on('end', () => {
79
- this.push(body.toString('utf-8'));
80
- done();
81
- });
82
- }
83
- emitErrorUnlessHttp2xx(res, url, method) {
84
- if (res.statusCode >= 300)
85
- this.emit('error', new Error(`Unexpected http status ${res.statusCode} from ${method} ${url}`));
86
- }
87
- sendHttpRequest(url, method, headers, callback) {
88
- const httpx = (0, value_checker_1.doesHaveValue)(url.match(/^https:/)) ? node_https_1.default : node_http_1.default;
89
- const additionalHttpHeaders = {};
90
- const upload = method === 'PUT' || method === 'POST';
91
- if (upload) {
92
- additionalHttpHeaders['Content-Length'] = node_fs_1.default.statSync(this.tempFilePath).size;
93
- }
94
- const allHeaders = { ...headers, ...additionalHttpHeaders };
95
- const req = httpx.request(url, {
96
- method,
97
- headers: allHeaders,
98
- });
99
- req.on('error', (err) => this.emit('error', err));
100
- req.on('response', (res) => {
101
- res.on('error', (err) => this.emit('error', err));
102
- callback(null, res);
103
- });
104
- if (upload) {
105
- (0, node_stream_1.pipeline)(node_fs_1.default.createReadStream(this.tempFilePath), req, (err) => {
106
- if ((0, value_checker_1.doesHaveValue)(err)) {
107
- this.emit('error', err);
108
- }
109
- });
110
- }
111
- else {
112
- req.end();
113
- }
114
- }
115
- }
116
- exports.default = HttpStream;
117
- //# sourceMappingURL=http_stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"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,GAAG,EAAE,EAAE;YACzB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;YACjD,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACrB,CAAC,CAAC,CAAA;QAEF,IAAI,MAAM,EAAE;YACV,IAAA,sBAAQ,EAAC,iBAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC5D,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,EAAE;oBACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;iBACxB;YACH,CAAC,CAAC,CAAA;SACH;aAAM;YACL,GAAG,CAAC,GAAG,EAAE,CAAA;SACV;IACH,CAAC;CACF;AAlID,6BAkIC","sourcesContent":["import { pipeline, Transform, Writable } from 'node:stream'\nimport fs from 'node:fs'\nimport http from 'node:http'\nimport https from 'node:https'\nimport tmp from 'tmp'\nimport { doesHaveValue } from '../value_checker'\n\ntype HttpMethod = 'GET' | 'POST' | 'PUT'\n\n/**\n * This Writable writes data to a HTTP/HTTPS URL.\n *\n * It has special handling for https://reports.cucumber.io/\n * which uses an API where the first request is a `GET`,\n * and if the response is 202 with a Location header, issues\n * a PUT request to that URL.\n *\n * 3xx redirects are not currently followed.\n */\nexport default class HttpStream extends Transform {\n private tempFilePath: string\n private tempFile: Writable\n\n constructor(\n private readonly url: string,\n private readonly method: HttpMethod,\n private readonly headers: http.OutgoingHttpHeaders\n ) {\n super({\n readableObjectMode: true,\n })\n }\n\n _write(\n chunk: any,\n encoding: BufferEncoding,\n callback: (err?: Error | null) => void\n ): void {\n if (this.tempFile === undefined) {\n tmp.file((err, name, fd) => {\n if (doesHaveValue(err)) return callback(err)\n this.tempFilePath = name\n this.tempFile = fs.createWriteStream(name, { fd })\n this.tempFile.write(chunk, encoding, callback)\n })\n } else {\n this.tempFile.write(chunk, encoding, callback)\n }\n }\n\n _final(callback: (error?: Error | null) => void): void {\n this.tempFile.end(() => {\n this.sendHttpRequest(\n this.url,\n this.method,\n this.headers,\n (err1, res1) => {\n if (doesHaveValue(err1)) return callback(err1)\n this.pushResponseBody(res1, () => {\n this.emitErrorUnlessHttp2xx(res1, this.url, this.method)\n if (\n res1.statusCode === 202 &&\n res1.headers.location !== undefined\n ) {\n this.sendHttpRequest(\n res1.headers.location,\n 'PUT',\n {},\n (err2, res2) => {\n if (doesHaveValue(err2)) return callback(err2)\n this.emitErrorUnlessHttp2xx(\n res2,\n res1.headers.location,\n 'PUT'\n )\n callback()\n }\n )\n } else {\n callback()\n }\n })\n }\n )\n })\n }\n\n private pushResponseBody(res: http.IncomingMessage, done: () => void): void {\n let body = Buffer.alloc(0)\n res.on('data', (chunk) => {\n body = Buffer.concat([body, chunk])\n })\n res.on('end', () => {\n this.push(body.toString('utf-8'))\n done()\n })\n }\n\n private emitErrorUnlessHttp2xx(\n res: http.IncomingMessage,\n url: string,\n method: string\n ): void {\n if (res.statusCode >= 300)\n this.emit(\n 'error',\n new Error(\n `Unexpected http status ${res.statusCode} from ${method} ${url}`\n )\n )\n }\n\n private sendHttpRequest(\n url: string,\n method: HttpMethod,\n headers: http.OutgoingHttpHeaders,\n callback: (err?: Error | null, res?: http.IncomingMessage) => void\n ): void {\n const httpx = doesHaveValue(url.match(/^https:/)) ? https : http\n const additionalHttpHeaders: http.OutgoingHttpHeaders = {}\n\n const upload = method === 'PUT' || method === 'POST'\n if (upload) {\n additionalHttpHeaders['Content-Length'] = fs.statSync(\n this.tempFilePath\n ).size\n }\n\n const allHeaders = { ...headers, ...additionalHttpHeaders }\n const req = httpx.request(url, {\n method,\n headers: allHeaders,\n })\n req.on('error', (err) => this.emit('error', err))\n req.on('response', (res) => {\n res.on('error', (err) => this.emit('error', err))\n callback(null, res)\n })\n\n if (upload) {\n pipeline(fs.createReadStream(this.tempFilePath), req, (err) => {\n if (doesHaveValue(err)) {\n this.emit('error', err)\n }\n })\n } else {\n req.end()\n }\n }\n}\n"]}