@cucumber/cucumber 11.1.1 → 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 (231) hide show
  1. package/README.md +9 -7
  2. package/lib/api/convert_configuration.d.ts +1 -2
  3. package/lib/api/convert_configuration.js +1 -2
  4. package/lib/api/convert_configuration.js.map +1 -1
  5. package/lib/api/formatters.d.ts +1 -3
  6. package/lib/api/formatters.js +2 -3
  7. package/lib/api/formatters.js.map +1 -1
  8. package/lib/api/gherkin.js +1 -2
  9. package/lib/api/gherkin.js.map +1 -1
  10. package/lib/api/index.d.ts +1 -0
  11. package/lib/api/index.js.map +1 -1
  12. package/lib/api/load_configuration.d.ts +2 -1
  13. package/lib/api/load_configuration.js +3 -4
  14. package/lib/api/load_configuration.js.map +1 -1
  15. package/lib/api/load_sources.d.ts +2 -1
  16. package/lib/api/load_sources.js +4 -5
  17. package/lib/api/load_sources.js.map +1 -1
  18. package/lib/api/load_support.d.ts +2 -1
  19. package/lib/api/load_support.js +4 -5
  20. package/lib/api/load_support.js.map +1 -1
  21. package/lib/api/plugins.d.ts +5 -5
  22. package/lib/api/plugins.js +12 -13
  23. package/lib/api/plugins.js.map +1 -1
  24. package/lib/api/run_cucumber.d.ts +2 -1
  25. package/lib/api/run_cucumber.js +4 -5
  26. package/lib/api/run_cucumber.js.map +1 -1
  27. package/lib/api/support.d.ts +1 -1
  28. package/lib/api/support.js +1 -2
  29. package/lib/api/support.js.map +1 -1
  30. package/lib/api/test_helpers.d.ts +1 -1
  31. package/lib/api/test_helpers.js +2 -3
  32. package/lib/api/test_helpers.js.map +1 -1
  33. package/lib/api/types.d.ts +0 -35
  34. package/lib/api/types.js.map +1 -1
  35. package/lib/assemble/assemble_test_cases.d.ts +1 -7
  36. package/lib/assemble/assemble_test_cases.js +3 -3
  37. package/lib/assemble/assemble_test_cases.js.map +1 -1
  38. package/lib/cli/helpers.d.ts +1 -3
  39. package/lib/cli/helpers.js +61 -33
  40. package/lib/cli/helpers.js.map +1 -1
  41. package/lib/cli/i18n.js +2 -3
  42. package/lib/cli/i18n.js.map +1 -1
  43. package/lib/cli/index.d.ts +0 -1
  44. package/lib/cli/index.js.map +1 -1
  45. package/lib/cli/install_validator.js +1 -2
  46. package/lib/cli/install_validator.js.map +1 -1
  47. package/lib/cli/run.js +1 -1
  48. package/lib/cli/run.js.map +1 -1
  49. package/lib/cli/validate_node_engine_version.js +1 -2
  50. package/lib/cli/validate_node_engine_version.js.map +1 -1
  51. package/lib/configuration/argv_parser.js.map +1 -1
  52. package/lib/configuration/check_schema.js +18 -9
  53. package/lib/configuration/check_schema.js.map +1 -1
  54. package/lib/configuration/from_file.d.ts +1 -1
  55. package/lib/configuration/from_file.js +3 -4
  56. package/lib/configuration/from_file.js.map +1 -1
  57. package/lib/configuration/helpers.js +1 -2
  58. package/lib/configuration/helpers.js.map +1 -1
  59. package/lib/configuration/locate_file.js +1 -2
  60. package/lib/configuration/locate_file.js.map +1 -1
  61. package/lib/configuration/merge_configurations.js +1 -2
  62. package/lib/configuration/merge_configurations.js.map +1 -1
  63. package/lib/configuration/parse_configuration.d.ts +1 -1
  64. package/lib/configuration/parse_configuration.js +1 -2
  65. package/lib/configuration/parse_configuration.js.map +1 -1
  66. package/lib/configuration/split_format_descriptor.d.ts +1 -1
  67. package/lib/configuration/split_format_descriptor.js +1 -2
  68. package/lib/configuration/split_format_descriptor.js.map +1 -1
  69. package/lib/configuration/validate_configuration.d.ts +1 -1
  70. package/lib/configuration/validate_configuration.js +1 -2
  71. package/lib/configuration/validate_configuration.js.map +1 -1
  72. package/lib/environment/console_logger.d.ts +11 -0
  73. package/lib/{api → environment}/console_logger.js +6 -6
  74. package/lib/environment/console_logger.js.map +1 -0
  75. package/lib/environment/index.d.ts +2 -0
  76. package/lib/environment/index.js +19 -0
  77. package/lib/environment/index.js.map +1 -0
  78. package/lib/environment/make_environment.d.ts +2 -0
  79. package/lib/{api/environment.js → environment/make_environment.js} +3 -4
  80. package/lib/environment/make_environment.js.map +1 -0
  81. package/lib/environment/types.d.ts +41 -0
  82. package/lib/{logger.js → environment/types.js} +1 -1
  83. package/lib/environment/types.js.map +1 -0
  84. package/lib/filter_stack_trace.js +2 -3
  85. package/lib/filter_stack_trace.js.map +1 -1
  86. package/lib/formatter/builder.d.ts +1 -5
  87. package/lib/formatter/builder.js.map +1 -1
  88. package/lib/formatter/builtin/html.js +1 -4
  89. package/lib/formatter/builtin/html.js.map +1 -1
  90. package/lib/formatter/builtin/index.d.ts +1 -1
  91. package/lib/formatter/create_stream.d.ts +1 -2
  92. package/lib/formatter/create_stream.js +1 -2
  93. package/lib/formatter/create_stream.js.map +1 -1
  94. package/lib/formatter/find_class_or_plugin.js +1 -2
  95. package/lib/formatter/find_class_or_plugin.js.map +1 -1
  96. package/lib/formatter/get_color_fns.d.ts +0 -2
  97. package/lib/formatter/get_color_fns.js +1 -1
  98. package/lib/formatter/get_color_fns.js.map +1 -1
  99. package/lib/formatter/helpers/duration_helpers.js +2 -3
  100. package/lib/formatter/helpers/duration_helpers.js.map +1 -1
  101. package/lib/formatter/helpers/event_data_collector.d.ts +0 -1
  102. package/lib/formatter/helpers/event_data_collector.js +17 -7
  103. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  104. package/lib/formatter/helpers/gherkin_document_parser.js +4 -5
  105. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
  106. package/lib/formatter/helpers/index.js +17 -7
  107. package/lib/formatter/helpers/index.js.map +1 -1
  108. package/lib/formatter/helpers/issue_helpers.js +6 -7
  109. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  110. package/lib/formatter/helpers/keyword_type.js +3 -3
  111. package/lib/formatter/helpers/keyword_type.js.map +1 -1
  112. package/lib/formatter/helpers/location_helpers.js +1 -2
  113. package/lib/formatter/helpers/location_helpers.js.map +1 -1
  114. package/lib/formatter/helpers/pickle_parser.js +4 -5
  115. package/lib/formatter/helpers/pickle_parser.js.map +1 -1
  116. package/lib/formatter/helpers/step_argument_formatter.js +1 -2
  117. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
  118. package/lib/formatter/helpers/summary_helpers.js +18 -9
  119. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  120. package/lib/formatter/helpers/test_case_attempt_formatter.js +18 -9
  121. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  122. package/lib/formatter/helpers/test_case_attempt_parser.js +18 -9
  123. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  124. package/lib/formatter/helpers/usage_helpers/index.js +18 -9
  125. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  126. package/lib/formatter/import_code.js +1 -2
  127. package/lib/formatter/import_code.js.map +1 -1
  128. package/lib/formatter/index.d.ts +0 -2
  129. package/lib/formatter/json_formatter.js +17 -7
  130. package/lib/formatter/json_formatter.js.map +1 -1
  131. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  132. package/lib/formatter/progress_formatter.js +17 -7
  133. package/lib/formatter/progress_formatter.js.map +1 -1
  134. package/lib/formatter/rerun_formatter.js +17 -7
  135. package/lib/formatter/rerun_formatter.js.map +1 -1
  136. package/lib/formatter/resolve_implementation.js +1 -2
  137. package/lib/formatter/resolve_implementation.js.map +1 -1
  138. package/lib/formatter/snippets_formatter.js +17 -7
  139. package/lib/formatter/snippets_formatter.js.map +1 -1
  140. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
  141. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  142. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +1 -1
  143. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
  144. package/lib/formatter/summary_formatter.js.map +1 -1
  145. package/lib/formatter/usage_formatter.js +17 -7
  146. package/lib/formatter/usage_formatter.js.map +1 -1
  147. package/lib/formatter/usage_json_formatter.js.map +1 -1
  148. package/lib/index.d.ts +4 -4
  149. package/lib/index.js +17 -7
  150. package/lib/index.js.map +1 -1
  151. package/lib/models/data_table.js.map +1 -1
  152. package/lib/models/step_definition.js.map +1 -1
  153. package/lib/paths/paths.d.ts +1 -1
  154. package/lib/paths/paths.js +1 -2
  155. package/lib/paths/paths.js.map +1 -1
  156. package/lib/pickle_filter.js.map +1 -1
  157. package/lib/plugin/plugin_manager.d.ts +5 -4
  158. package/lib/plugin/plugin_manager.js +14 -6
  159. package/lib/plugin/plugin_manager.js.map +1 -1
  160. package/lib/plugin/types.d.ts +4 -3
  161. package/lib/plugin/types.js.map +1 -1
  162. package/lib/publish/publish_plugin.js +46 -16
  163. package/lib/publish/publish_plugin.js.map +1 -1
  164. package/lib/runtime/attachment_manager/index.d.ts +0 -2
  165. package/lib/runtime/attachment_manager/index.js +17 -7
  166. package/lib/runtime/attachment_manager/index.js.map +1 -1
  167. package/lib/runtime/coordinator.d.ts +0 -1
  168. package/lib/runtime/coordinator.js +4 -6
  169. package/lib/runtime/coordinator.js.map +1 -1
  170. package/lib/runtime/format_error.js +1 -2
  171. package/lib/runtime/format_error.js.map +1 -1
  172. package/lib/runtime/helpers.js +20 -11
  173. package/lib/runtime/helpers.js.map +1 -1
  174. package/lib/runtime/make_runtime.d.ts +3 -3
  175. package/lib/runtime/make_runtime.js +1 -2
  176. package/lib/runtime/make_runtime.js.map +1 -1
  177. package/lib/runtime/parallel/adapter.d.ts +2 -4
  178. package/lib/runtime/parallel/adapter.js.map +1 -1
  179. package/lib/runtime/parallel/run_worker.js.map +1 -1
  180. package/lib/runtime/parallel/worker.js.map +1 -1
  181. package/lib/runtime/run_test_run_hooks.js.map +1 -1
  182. package/lib/runtime/scope/make_proxy.js +1 -2
  183. package/lib/runtime/scope/make_proxy.js.map +1 -1
  184. package/lib/runtime/scope/test_case_scope.js +2 -2
  185. package/lib/runtime/scope/test_case_scope.js.map +1 -1
  186. package/lib/runtime/scope/test_run_scope.js +2 -2
  187. package/lib/runtime/scope/test_run_scope.js.map +1 -1
  188. package/lib/runtime/serial/adapter.d.ts +0 -1
  189. package/lib/runtime/serial/adapter.js.map +1 -1
  190. package/lib/runtime/step_runner.js +24 -13
  191. package/lib/runtime/step_runner.js.map +1 -1
  192. package/lib/runtime/stopwatch.js.map +1 -1
  193. package/lib/runtime/test_case_runner.d.ts +0 -1
  194. package/lib/runtime/test_case_runner.js +17 -7
  195. package/lib/runtime/test_case_runner.js.map +1 -1
  196. package/lib/runtime/worker.d.ts +0 -1
  197. package/lib/runtime/worker.js.map +1 -1
  198. package/lib/step_arguments.js +1 -2
  199. package/lib/step_arguments.js.map +1 -1
  200. package/lib/support_code_library_builder/build_parameter_type.js +1 -2
  201. package/lib/support_code_library_builder/build_parameter_type.js.map +1 -1
  202. package/lib/support_code_library_builder/get_definition_line_and_uri.js +1 -2
  203. package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
  204. package/lib/support_code_library_builder/index.js.map +1 -1
  205. package/lib/support_code_library_builder/parallel_can_assign_helpers.js +1 -2
  206. package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -1
  207. package/lib/support_code_library_builder/validate_arguments.js +1 -1
  208. package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
  209. package/lib/time.d.ts +0 -2
  210. package/lib/time.js +19 -10
  211. package/lib/time.js.map +1 -1
  212. package/lib/try_require.js +1 -1
  213. package/lib/try_require.js.map +1 -1
  214. package/lib/tsconfig.node.tsbuildinfo +1 -0
  215. package/lib/uncaught_exception_manager.d.ts +0 -1
  216. package/lib/user_code_runner.js.map +1 -1
  217. package/lib/value_checker.js +3 -4
  218. package/lib/value_checker.js.map +1 -1
  219. package/lib/version.d.ts +1 -1
  220. package/lib/version.js +1 -1
  221. package/lib/version.js.map +1 -1
  222. package/package.json +53 -55
  223. package/lib/api/console_logger.d.ts +0 -12
  224. package/lib/api/console_logger.js.map +0 -1
  225. package/lib/api/environment.d.ts +0 -7
  226. package/lib/api/environment.js.map +0 -1
  227. package/lib/logger.d.ts +0 -5
  228. package/lib/logger.js.map +0 -1
  229. package/lib/publish/http_stream.d.ts +0 -30
  230. package/lib/publish/http_stream.js +0 -117
  231. package/lib/publish/http_stream.js.map +0 -1
@@ -1,12 +1,13 @@
1
- import { IRunEnvironment } from '../api';
2
- import { ILogger } from '../logger';
1
+ import { UsableEnvironment } from '../environment';
3
2
  import { InternalPlugin, CoordinatorPluginEventValues, CoordinatorPluginEventKey, CoordinatorPluginTransformEventKey, Operation, FormatterPlugin } from './types';
4
3
  export declare class PluginManager {
4
+ private readonly environment;
5
5
  private handlers;
6
6
  private cleanupFns;
7
+ constructor(environment: UsableEnvironment);
7
8
  private register;
8
- initFormatter<OptionsType>(plugin: FormatterPlugin<OptionsType>, options: OptionsType, logger: ILogger, write: (buffer: string | Uint8Array) => void, directory?: string): Promise<void>;
9
- initCoordinator<OptionsType>(operation: Operation, plugin: InternalPlugin<OptionsType>, options: OptionsType, logger: ILogger, environment: Required<IRunEnvironment>): Promise<void>;
9
+ initFormatter<OptionsType>(plugin: FormatterPlugin<OptionsType>, options: OptionsType, write: (buffer: string | Uint8Array) => void, directory?: string): Promise<void>;
10
+ initCoordinator<OptionsType>(operation: Operation, plugin: InternalPlugin<OptionsType>, options: OptionsType): Promise<void>;
10
11
  emit<K extends CoordinatorPluginEventKey>(event: K, value: CoordinatorPluginEventValues[K]): void;
11
12
  transform<K extends CoordinatorPluginTransformEventKey>(event: K, value: CoordinatorPluginEventValues[K]): Promise<CoordinatorPluginEventValues[K]>;
12
13
  cleanup(): Promise<void>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PluginManager = void 0;
4
4
  class PluginManager {
5
+ environment;
5
6
  handlers = {
6
7
  message: [],
7
8
  'paths:resolve': [],
@@ -9,16 +10,19 @@ class PluginManager {
9
10
  'pickles:order': [],
10
11
  };
11
12
  cleanupFns = [];
13
+ constructor(environment) {
14
+ this.environment = environment;
15
+ }
12
16
  async register(event, handler) {
13
17
  this.handlers[event]?.push(handler);
14
18
  }
15
- async initFormatter(plugin, options, logger, write, directory) {
19
+ async initFormatter(plugin, options, write, directory) {
16
20
  const cleanupFn = await plugin.formatter({
17
21
  on: (key, handler) => this.register(key, handler),
18
22
  options: plugin.optionsKey
19
- ? options[plugin.optionsKey] ?? {}
23
+ ? (options[plugin.optionsKey] ?? {})
20
24
  : options,
21
- logger,
25
+ logger: this.environment.logger,
22
26
  write,
23
27
  directory,
24
28
  });
@@ -26,13 +30,17 @@ class PluginManager {
26
30
  this.cleanupFns.push(cleanupFn);
27
31
  }
28
32
  }
29
- async initCoordinator(operation, plugin, options, logger, environment) {
33
+ async initCoordinator(operation, plugin, options) {
30
34
  const cleanupFn = await plugin.coordinator({
31
35
  operation,
32
36
  on: this.register.bind(this),
33
37
  options,
34
- logger,
35
- environment,
38
+ logger: this.environment.logger,
39
+ environment: {
40
+ cwd: this.environment.cwd,
41
+ stderr: this.environment.stderr,
42
+ env: { ...this.environment.env },
43
+ },
36
44
  });
37
45
  if (typeof cleanupFn === 'function') {
38
46
  this.cleanupFns.push(cleanupFn);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin_manager.js","sourceRoot":"","sources":["../../src/plugin/plugin_manager.ts"],"names":[],"mappings":";;;AAiBA,MAAa,aAAa;IAChB,QAAQ,GAAoB;QAClC,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,EAAE;KACpB,CAAA;IACO,UAAU,GAAoB,EAAE,CAAA;IAEhC,KAAK,CAAC,QAAQ,CACpB,KAAQ,EACR,OAAyC;QAEzC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAoC,EACpC,OAAoB,EACpB,MAAe,EACf,KAA4C,EAC5C,SAAkB;QAElB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC;YACvC,EAAE,EAAE,CAAC,GAAG,E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Q,CAAA;aACvB;SACF;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE;YACvC,MAAM,SAAS,EAAE,CAAA;SAClB;IACH,CAAC;CACF;AAlFD,sCAkFC","sourcesContent":["import { IRunEnvironment } from '../api'\nimport { ILogger } from '../logger'\nimport {\n CoordinatorPluginEventHandler,\n InternalPlugin,\n PluginCleanup,\n CoordinatorPluginEventValues,\n CoordinatorPluginEventKey,\n CoordinatorPluginTransformEventKey,\n Operation,\n FormatterPlugin,\n} from './types'\n\ntype HandlerRegistry = {\n [K in CoordinatorPluginEventKey]: Array<CoordinatorPluginEventHandler<K>>\n}\n\nexport class PluginManager {\n private handlers: HandlerRegistry = {\n message: [],\n 'paths:resolve': [],\n 'pickles:filter': [],\n 'pickles:order': [],\n }\n private cleanupFns: PluginCleanup[] = []\n\n private async register<K extends CoordinatorPluginEventKey>(\n event: K,\n handler: CoordinatorPluginEventHandler<K>\n ) {\n this.handlers[event]?.push(handler)\n }\n\n async initFormatter<OptionsType>(\n plugin: FormatterPlugin<OptionsType>,\n options: OptionsType,\n logger: ILogger,\n write: (buffer: string | Uint8Array) => void,\n directory?: string\n ) {\n const cleanupFn = await plugin.formatter({\n on: (key, handler) => this.register(key, handler),\n options: plugin.optionsKey\n ? (options as any)[plugin.optionsKey] ?? ({} as OptionsType)\n : options,\n logger,\n write,\n directory,\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n async initCoordinator<OptionsType>(\n operation: Operation,\n plugin: InternalPlugin<OptionsType>,\n options: OptionsType,\n logger: ILogger,\n environment: Required<IRunEnvironment>\n ) {\n const cleanupFn = await plugin.coordinator({\n operation,\n on: this.register.bind(this),\n options,\n logger,\n environment,\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n emit<K extends CoordinatorPluginEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): void {\n this.handlers[event].forEach((handler) => handler(value))\n }\n\n async transform<K extends CoordinatorPluginTransformEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): Promise<CoordinatorPluginEventValues[K]> {\n let transformed = value\n for (const handler of this.handlers[event]) {\n const returned = await handler(transformed)\n if (typeof returned !== 'undefined') {\n transformed = returned\n }\n }\n return transformed\n }\n\n async cleanup(): Promise<void> {\n for (const cleanupFn of this.cleanupFns) {\n await cleanupFn()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"plugin_manager.js","sourceRoot":"","sources":["../../src/plugin/plugin_manager.ts"],"names":[],"mappings":";;;AAgBA,MAAa,aAAa;IASK;IARrB,QAAQ,GAAoB;QAClC,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,EAAE;KACpB,CAAA;IACO,UAAU,GAAoB,EAAE,CAAA;IAExC,YAA6B,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;IAAG,CAAC;IAEvD,KAAK,CAAC,QAAQ,CACpB,KAAQ,EACR,OAAyC;QAEzC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAoC,EACpC,OAAoB,EACpB,KAA4C,EAC5C,SAAkB;QAElB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC;YACvC,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;YACjD,OAAO,EAAE,MAAM,CAAC,UAAU;gBACxB,CAAC,CAAC,CAAE,OAAe,CAAC,MAAM,CAAC,UAAU,CAAC,IAAK,EAAkB,CAAC;gBAC9D,CAAC,CAAC,OAAO;YACX,MAAM,EAAE,IAAI,CAAC,WAAW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gBACpC,WAAW,GAAG,QAAQ,CAAA;YACxB,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,SAAS,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;CACF;AArFD,sCAqFC","sourcesContent":["import { UsableEnvironment } from '../environment'\nimport {\n CoordinatorPluginEventHandler,\n InternalPlugin,\n PluginCleanup,\n CoordinatorPluginEventValues,\n CoordinatorPluginEventKey,\n CoordinatorPluginTransformEventKey,\n Operation,\n FormatterPlugin,\n} from './types'\n\ntype HandlerRegistry = {\n [K in CoordinatorPluginEventKey]: Array<CoordinatorPluginEventHandler<K>>\n}\n\nexport class PluginManager {\n private handlers: HandlerRegistry = {\n message: [],\n 'paths:resolve': [],\n 'pickles:filter': [],\n 'pickles:order': [],\n }\n private cleanupFns: PluginCleanup[] = []\n\n constructor(private readonly environment: UsableEnvironment) {}\n\n private async register<K extends CoordinatorPluginEventKey>(\n event: K,\n handler: CoordinatorPluginEventHandler<K>\n ) {\n this.handlers[event]?.push(handler)\n }\n\n async initFormatter<OptionsType>(\n plugin: FormatterPlugin<OptionsType>,\n options: OptionsType,\n write: (buffer: string | Uint8Array) => void,\n directory?: string\n ) {\n const cleanupFn = await plugin.formatter({\n on: (key, handler) => this.register(key, handler),\n options: plugin.optionsKey\n ? ((options as any)[plugin.optionsKey] ?? ({} as OptionsType))\n : options,\n logger: this.environment.logger,\n write,\n directory,\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n async initCoordinator<OptionsType>(\n operation: Operation,\n plugin: InternalPlugin<OptionsType>,\n options: OptionsType\n ) {\n const cleanupFn = await plugin.coordinator({\n operation,\n on: this.register.bind(this),\n options,\n logger: this.environment.logger,\n environment: {\n cwd: this.environment.cwd,\n stderr: this.environment.stderr,\n env: { ...this.environment.env },\n },\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n emit<K extends CoordinatorPluginEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): void {\n this.handlers[event].forEach((handler) => handler(value))\n }\n\n async transform<K extends CoordinatorPluginTransformEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): Promise<CoordinatorPluginEventValues[K]> {\n let transformed = value\n for (const handler of this.handlers[event]) {\n const returned = await handler(transformed)\n if (typeof returned !== 'undefined') {\n transformed = returned\n }\n }\n return transformed\n }\n\n async cleanup(): Promise<void> {\n for (const cleanupFn of this.cleanupFns) {\n await cleanupFn()\n }\n }\n}\n"]}
@@ -1,11 +1,12 @@
1
1
  import { Envelope } from '@cucumber/messages';
2
2
  import { ArrayValues, Promisable } from 'type-fest';
3
- import { IRunEnvironment } from '../api';
4
- import { ILogger } from '../logger';
3
+ import { IRunEnvironment } from '../environment';
4
+ import { ILogger } from '../environment';
5
5
  import { IFilterablePickle } from '../filter';
6
6
  import { IResolvedPaths } from '../paths';
7
7
  import { coordinatorTransformKeys, coordinatorVoidKeys } from './events';
8
8
  export type Operation = 'loadSources' | 'loadSupport' | 'runCucumber';
9
+ export type CoordinatorPluginEnvironment = Required<Pick<IRunEnvironment, 'cwd' | 'stderr' | 'env'>>;
9
10
  export type CoordinatorPluginVoidEventKey = ArrayValues<typeof coordinatorVoidKeys>;
10
11
  export type CoordinatorPluginTransformEventKey = ArrayValues<typeof coordinatorTransformKeys>;
11
12
  export type CoordinatorPluginEventKey = CoordinatorPluginVoidEventKey | CoordinatorPluginTransformEventKey;
@@ -21,7 +22,7 @@ export interface CoordinatorPluginContext<OptionsType> {
21
22
  on: <EventKey extends CoordinatorPluginEventKey>(event: EventKey, handler: CoordinatorPluginEventHandler<EventKey>) => void;
22
23
  options: OptionsType;
23
24
  logger: ILogger;
24
- environment: Required<IRunEnvironment>;
25
+ environment: CoordinatorPluginEnvironment;
25
26
  }
26
27
  export type CoordinatorPluginFunction<OptionsType> = (context: CoordinatorPluginContext<OptionsType>) => Promisable<PluginCleanup | void>;
27
28
  export type PluginCleanup = () => Promisable<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Envelope } from '@cucumber/messages'\nimport { ArrayValues, Promisable } from 'type-fest'\nimport { IRunEnvironment } from '../api'\nimport { ILogger } from '../logger'\nimport { IFilterablePickle } from '../filter'\nimport { IResolvedPaths } from '../paths'\nimport { coordinatorTransformKeys, coordinatorVoidKeys } from './events'\n\nexport type Operation = 'loadSources' | 'loadSupport' | 'runCucumber'\n\nexport type CoordinatorPluginVoidEventKey = ArrayValues<\n typeof coordinatorVoidKeys\n>\nexport type CoordinatorPluginTransformEventKey = ArrayValues<\n typeof coordinatorTransformKeys\n>\nexport type CoordinatorPluginEventKey =\n | CoordinatorPluginVoidEventKey\n | CoordinatorPluginTransformEventKey\n\nexport type CoordinatorPluginEventValues = {\n // void\n message: Readonly<Envelope>\n 'paths:resolve': Readonly<IResolvedPaths>\n // transform\n 'pickles:filter': Readonly<Array<IFilterablePickle>>\n 'pickles:order': Readonly<Array<IFilterablePickle>>\n}\n\nexport type CoordinatorPluginEventHandler<K extends CoordinatorPluginEventKey> =\n (\n value: CoordinatorPluginEventValues[K]\n ) => K extends CoordinatorPluginTransformEventKey\n ? Promisable<CoordinatorPluginEventValues[K]>\n : void\n\nexport interface CoordinatorPluginContext<OptionsType> {\n operation: Operation\n on: <EventKey extends CoordinatorPluginEventKey>(\n event: EventKey,\n handler: CoordinatorPluginEventHandler<EventKey>\n ) => void\n options: OptionsType\n logger: ILogger\n environment: Required<IRunEnvironment>\n}\n\nexport type CoordinatorPluginFunction<OptionsType> = (\n context: CoordinatorPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport type PluginCleanup = () => Promisable<void>\n\n/**\n * A plugin to implement Cucumber built-in functionality.\n *\n * Uses the same events and mechanisms as user-authored plugins, but is free to require configuration and context from\n * inside of Cucumber as its `options`, whereas user-authored plugins will be limited to `pluginOptions` from the\n * project configuration.\n */\nexport interface InternalPlugin<OptionsType = any> {\n type: 'plugin'\n coordinator: CoordinatorPluginFunction<OptionsType>\n}\n\nexport interface FormatterPluginContext<OptionsType> {\n on: (key: 'message', handler: (value: Envelope) => void) => void\n options: OptionsType\n logger: ILogger\n write: (buffer: string | Uint8Array) => void\n directory?: string\n}\n\nexport type FormatterPluginFunction<OptionsType> = (\n context: FormatterPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport interface FormatterPlugin<OptionsType = any> {\n type: 'formatter'\n formatter: FormatterPluginFunction<OptionsType>\n optionsKey?: string\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Envelope } from '@cucumber/messages'\nimport { ArrayValues, Promisable } from 'type-fest'\nimport { IRunEnvironment } from '../environment'\nimport { ILogger } from '../environment'\nimport { IFilterablePickle } from '../filter'\nimport { IResolvedPaths } from '../paths'\nimport { coordinatorTransformKeys, coordinatorVoidKeys } from './events'\n\nexport type Operation = 'loadSources' | 'loadSupport' | 'runCucumber'\n\nexport type CoordinatorPluginEnvironment = Required<\n Pick<IRunEnvironment, 'cwd' | 'stderr' | 'env'>\n>\n\nexport type CoordinatorPluginVoidEventKey = ArrayValues<\n typeof coordinatorVoidKeys\n>\nexport type CoordinatorPluginTransformEventKey = ArrayValues<\n typeof coordinatorTransformKeys\n>\nexport type CoordinatorPluginEventKey =\n | CoordinatorPluginVoidEventKey\n | CoordinatorPluginTransformEventKey\n\nexport type CoordinatorPluginEventValues = {\n // void\n message: Readonly<Envelope>\n 'paths:resolve': Readonly<IResolvedPaths>\n // transform\n 'pickles:filter': Readonly<Array<IFilterablePickle>>\n 'pickles:order': Readonly<Array<IFilterablePickle>>\n}\n\nexport type CoordinatorPluginEventHandler<K extends CoordinatorPluginEventKey> =\n (\n value: CoordinatorPluginEventValues[K]\n ) => K extends CoordinatorPluginTransformEventKey\n ? Promisable<CoordinatorPluginEventValues[K]>\n : void\n\nexport interface CoordinatorPluginContext<OptionsType> {\n operation: Operation\n on: <EventKey extends CoordinatorPluginEventKey>(\n event: EventKey,\n handler: CoordinatorPluginEventHandler<EventKey>\n ) => void\n options: OptionsType\n logger: ILogger\n environment: CoordinatorPluginEnvironment\n}\n\nexport type CoordinatorPluginFunction<OptionsType> = (\n context: CoordinatorPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport type PluginCleanup = () => Promisable<void>\n\n/**\n * A plugin to implement Cucumber built-in functionality.\n *\n * Uses the same events and mechanisms as user-authored plugins, but is free to require configuration and context from\n * inside of Cucumber as its `options`, whereas user-authored plugins will be limited to `pluginOptions` from the\n * project configuration.\n */\nexport interface InternalPlugin<OptionsType = any> {\n type: 'plugin'\n coordinator: CoordinatorPluginFunction<OptionsType>\n}\n\nexport interface FormatterPluginContext<OptionsType> {\n on: (key: 'message', handler: (value: Envelope) => void) => void\n options: OptionsType\n logger: ILogger\n write: (buffer: string | Uint8Array) => void\n directory?: string\n}\n\nexport type FormatterPluginFunction<OptionsType> = (\n context: FormatterPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport interface FormatterPlugin<OptionsType = any> {\n type: 'formatter'\n formatter: FormatterPluginFunction<OptionsType>\n optionsKey?: string\n}\n"]}
@@ -4,11 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.publishPlugin = void 0;
7
- const node_stream_1 = require("node:stream");
8
7
  const node_util_1 = require("node:util");
8
+ const promises_1 = require("node:fs/promises");
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ const node_os_1 = require("node:os");
11
+ const node_fs_1 = require("node:fs");
9
12
  const supports_color_1 = require("supports-color");
10
13
  const has_ansi_1 = __importDefault(require("has-ansi"));
11
- const http_stream_1 = __importDefault(require("./http_stream"));
12
14
  const DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports';
13
15
  exports.publishPlugin = {
14
16
  type: 'plugin',
@@ -21,21 +23,49 @@ exports.publishPlugin = {
21
23
  if (token !== undefined) {
22
24
  headers.Authorization = `Bearer ${token}`;
23
25
  }
24
- const stream = new http_stream_1.default(url, 'GET', headers);
25
- const readerStream = new node_stream_1.Writable({
26
- objectMode: true,
27
- write: function (responseBody, encoding, writeCallback) {
28
- environment.stderr.write(sanitisePublishOutput(responseBody, environment.stderr) + '\n');
29
- writeCallback();
30
- },
31
- });
32
- stream.pipe(readerStream);
33
- stream.on('error', (error) => logger.error(error.message));
34
- on('message', (value) => stream.write(JSON.stringify(value) + '\n'));
35
- return () => new Promise((resolve) => {
36
- stream.on('finish', () => resolve());
37
- stream.end();
26
+ const touchResponse = await fetch(url, { headers });
27
+ const banner = await touchResponse.text();
28
+ if (!touchResponse.ok) {
29
+ return () => {
30
+ if (touchResponse.status < 500) {
31
+ environment.stderr.write(sanitisePublishOutput(banner, environment.stderr) + '\n');
32
+ }
33
+ else {
34
+ logger.error(`Failed to publish report to ${new URL(url).origin} with status ${touchResponse.status}`);
35
+ logger.debug(touchResponse);
36
+ }
37
+ };
38
+ }
39
+ const uploadUrl = touchResponse.headers.get('Location');
40
+ const tempDir = await (0, promises_1.mkdtemp)(node_path_1.default.join((0, node_os_1.tmpdir)(), `cucumber-js-publish-`));
41
+ const tempFilePath = node_path_1.default.join(tempDir, 'envelopes.ndjson');
42
+ const tempFileStream = (0, node_fs_1.createWriteStream)(tempFilePath, {
43
+ encoding: 'utf-8',
38
44
  });
45
+ on('message', (value) => tempFileStream.write(JSON.stringify(value) + '\n'));
46
+ return () => {
47
+ return new Promise((resolve) => {
48
+ tempFileStream.end(async () => {
49
+ const stats = await (0, promises_1.stat)(tempFilePath);
50
+ const uploadResponse = await fetch(uploadUrl, {
51
+ method: 'PUT',
52
+ headers: {
53
+ 'Content-Length': stats.size.toString(),
54
+ },
55
+ body: (0, node_fs_1.createReadStream)(tempFilePath, { encoding: 'utf-8' }),
56
+ duplex: 'half',
57
+ });
58
+ if (uploadResponse.ok) {
59
+ environment.stderr.write(sanitisePublishOutput(banner, environment.stderr) + '\n');
60
+ }
61
+ else {
62
+ logger.error(`Failed to upload report to ${new URL(uploadUrl).origin} with status ${uploadResponse.status}`);
63
+ logger.debug(uploadResponse);
64
+ }
65
+ resolve();
66
+ });
67
+ });
68
+ };
39
69
  },
40
70
  };
41
71
  /*
@@ -1 +1 @@
1
- {"version":3,"file":"publish_plugin.js","sourceRoot":"","sources":["../../src/publish/publish_plugin.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsC;AACtC,yCAAoD;AACpD,mDAA8C;AAC9C,wDAA8B;AAG9B,gEAAsC;AAEtC,MAAM,4BAA4B,GAAG,0CAA0C,CAAA;AAElE,QAAA,aAAa,GAA2C;IACnE,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,SAAS,CAAA;SACjB;QACD,MAAM,EAAE,GAAG,GAAG,4BAA4B,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;QAC7D,MAAM,OAAO,GAA8B,EAAE,CAAA;QAC7C,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAA;SAC1C;QACD,MAAM,MAAM,GAAG,IAAI,qBAAU,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;QAClD,MAAM,YAAY,GAAG,IAAI,sBAAQ,CAAC;YAChC,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE,UAAU,YAAoB,EAAE,QAAQ,EAAE,aAAa;gBAC5D,WAAW,CAAC,MAAM,CAAC,KAAK,CACtB,qBAAqB,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAC/D,CAAA;gBACD,aAAa,EAAE,CAAA;YACjB,CAAC;SACF,CAAC,CAAA;QACF,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACzB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;QACjE,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;QACpE,OAAO,GAAG,EAAE,CACV,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAC5B,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAA;YACpC,MAAM,CAAC,GAAG,EAAE,CAAA;QACd,CAAC,CAAC,CAAA;IACN,CAAC;CACF,CAAA;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAgB;IAC1D,IAAI,CAAC,IAAA,8BAAa,EAAC,MAAM,CAAC,IAAI,IAAA,kBAAO,EAAC,GAAG,CAAC,EAAE;QAC1C,OAAO,IAAA,oCAAwB,EAAC,GAAG,CAAC,CAAA;KACrC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { Writable } from 'node:stream'\nimport { stripVTControlCharacters } from 'node:util'\nimport { supportsColor } from 'supports-color'\nimport hasAnsi from 'has-ansi'\nimport { InternalPlugin } from '../plugin'\nimport { IPublishConfig } from './types'\nimport HttpStream from './http_stream'\n\nconst DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports'\n\nexport const publishPlugin: InternalPlugin<IPublishConfig | false> = {\n type: 'plugin',\n coordinator: async ({ on, logger, options, environment }) => {\n if (!options) {\n return undefined\n }\n const { url = DEFAULT_CUCUMBER_PUBLISH_URL, token } = options\n const headers: { [key: string]: string } = {}\n if (token !== undefined) {\n headers.Authorization = `Bearer ${token}`\n }\n const stream = new HttpStream(url, 'GET', headers)\n const readerStream = new Writable({\n objectMode: true,\n write: function (responseBody: string, encoding, writeCallback) {\n environment.stderr.write(\n sanitisePublishOutput(responseBody, environment.stderr) + '\\n'\n )\n writeCallback()\n },\n })\n stream.pipe(readerStream)\n stream.on('error', (error: Error) => logger.error(error.message))\n on('message', (value) => stream.write(JSON.stringify(value) + '\\n'))\n return () =>\n new Promise<void>((resolve) => {\n stream.on('finish', () => resolve())\n stream.end()\n })\n },\n}\n\n/*\nThis is because the Cucumber Reports service returns a pre-formatted console message\nincluding ANSI escapes, so if our stderr stream doesn't support those we need to\nstrip them back out. Ideally we should get structured data from the service and\ncompose the console message on this end.\n */\nfunction sanitisePublishOutput(raw: string, stderr: Writable) {\n if (!supportsColor(stderr) && hasAnsi(raw)) {\n return stripVTControlCharacters(raw)\n }\n return raw\n}\n"]}
1
+ {"version":3,"file":"publish_plugin.js","sourceRoot":"","sources":["../../src/publish/publish_plugin.ts"],"names":[],"mappings":";;;;;;AACA,yCAAoD;AACpD,+CAAgD;AAChD,0DAA4B;AAC5B,qCAAgC;AAChC,qCAA6D;AAC7D,mDAA8C;AAC9C,wDAA8B;AAI9B,MAAM,4BAA4B,GAAG,0CAA0C,CAAA;AAElE,QAAA,aAAa,GAA2C;IACnE,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,MAAM,EAAE,GAAG,GAAG,4BAA4B,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;QAC7D,MAAM,OAAO,GAA8B,EAAE,CAAA;QAC7C,IAAI,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OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { Writable } from 'node:stream'\nimport { stripVTControlCharacters } from 'node:util'\nimport { mkdtemp, stat } from 'node:fs/promises'\nimport path from 'node:path'\nimport { tmpdir } from 'node:os'\nimport { createReadStream, createWriteStream } from 'node:fs'\nimport { supportsColor } from 'supports-color'\nimport hasAnsi from 'has-ansi'\nimport { InternalPlugin } from '../plugin'\nimport { IPublishConfig } from './types'\n\nconst DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports'\n\nexport const publishPlugin: InternalPlugin<IPublishConfig | false> = {\n type: 'plugin',\n coordinator: async ({ on, logger, options, environment }) => {\n if (!options) {\n return undefined\n }\n const { url = DEFAULT_CUCUMBER_PUBLISH_URL, token } = options\n const headers: { [key: string]: string } = {}\n if (token !== undefined) {\n headers.Authorization = `Bearer ${token}`\n }\n const touchResponse = await fetch(url, { headers })\n const banner = await touchResponse.text()\n\n if (!touchResponse.ok) {\n return () => {\n if (touchResponse.status < 500) {\n environment.stderr.write(\n sanitisePublishOutput(banner, environment.stderr) + '\\n'\n )\n } else {\n logger.error(\n `Failed to publish report to ${new URL(url).origin} with status ${\n touchResponse.status\n }`\n )\n logger.debug(touchResponse)\n }\n }\n }\n\n const uploadUrl = touchResponse.headers.get('Location')\n const tempDir = await mkdtemp(path.join(tmpdir(), `cucumber-js-publish-`))\n const tempFilePath = path.join(tempDir, 'envelopes.ndjson')\n const tempFileStream = createWriteStream(tempFilePath, {\n encoding: 'utf-8',\n })\n on('message', (value) => tempFileStream.write(JSON.stringify(value) + '\\n'))\n\n return () => {\n return new Promise<void>((resolve) => {\n tempFileStream.end(async () => {\n const stats = await stat(tempFilePath)\n const uploadResponse = await fetch(uploadUrl, {\n method: 'PUT',\n headers: {\n 'Content-Length': stats.size.toString(),\n },\n body: createReadStream(tempFilePath, { encoding: 'utf-8' }),\n duplex: 'half',\n })\n if (uploadResponse.ok) {\n environment.stderr.write(\n sanitisePublishOutput(banner, environment.stderr) + '\\n'\n )\n } else {\n logger.error(\n `Failed to upload report to ${\n new URL(uploadUrl).origin\n } with status ${uploadResponse.status}`\n )\n logger.debug(uploadResponse)\n }\n resolve()\n })\n })\n }\n },\n}\n\n/*\nThis is because the Cucumber Reports service returns a pre-formatted console message\nincluding ANSI escapes, so if our stderr stream doesn't support those we need to\nstrip them back out. Ideally we should get structured data from the service and\ncompose the console message on this end.\n */\nfunction sanitisePublishOutput(raw: string, stderr: Writable) {\n if (!supportsColor(stderr) && hasAnsi(raw)) {\n return stripVTControlCharacters(raw)\n }\n return raw\n}\n"]}
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { Readable } from 'node:stream';
4
2
  import * as messages from '@cucumber/messages';
5
3
  export interface IAttachmentMedia {
@@ -15,13 +15,23 @@ 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
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/attachment_manager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0DAAgC;AAChC,6DAA8C;AAC9C,uDAAqE;AA2CrE,MAAqB,iBAAiB;IACnB,YAAY,CAAiB;IAE9C,YAAY,YAA6B;QACvC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAA;IACvD,CAAC;IAED,IAAI,CAAC,GAAG,GAAa;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,CAAA;IACrD,CAAC;IAED,MAAM,CACJ,IAAgC,EAChC,kBAAsD,EACtD,QAAqB;QAErB,MAAM,OAAO,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;QACpD,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACzB,IAAI,IAAA,gCAAgB,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE;gBACvC,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAA;aAC5D;YACD,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;SACvE;aAAM,IAAI,mBAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAClC,IAAI,IAAA,gCAAgB,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE;gBACvC,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAA;aAC5D;YACD,OAAO,IAAI,CAAC,sBAAsB,CAChC,IAAI,EACJ,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,QAAQ,EAChB,QAAQ,CACT,CAAA;SACF;aAAM,IAAI,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AAA;YACrB,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBAClB,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;gBACxE,OAAO,EAAE,CAAA;YACX,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;QACF,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,EAAE;YAC3B,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;SACjC;aAAM;YACL,OAAO,OAAO,CAAA;SACf;IACH,CAAC;IAED,sBAAsB,CACpB,IAAY,EACZ,KAAuB,EACvB,QAAiB;QAEjB,IAAI,CAAC,YAAY,CAAC;YAChB,IAAI;YACJ,KAAK;YACL,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClC,CAAC,CAAA;IACJ,CAAC;CACF;AApHD,oCAoHC;AAED,SAAS,gBAAgB,CACvB,kBAAsD;IAEtD,IAAI,CAAC,kBAAkB,EAAE;QACvB,OAAO,EAAE,CAAA;KACV;IACD,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;QAC1C,OAAO;YACL,SAAS,EAAE,kBAAkB;SAC9B,CAAA;KACF;IACD,OAAO,kBAAkB,CAAA;AAC3B,CAAC","sourcesContent":["import { Readable } from 'node:stream'\nimport isStream from 'is-stream'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\n\nexport interface IAttachmentMedia {\n encoding: messages.AttachmentContentEncoding\n contentType: string\n}\n\nexport interface IAttachment {\n data: string\n media: IAttachmentMedia\n fileName?: string\n}\n\nexport type IAttachFunction = (attachment: IAttachment) => void\n\nexport interface ICreateAttachmentOptions {\n mediaType: string\n fileName?: string\n}\nexport type ICreateStringAttachment = (\n data: string,\n mediaTypeOrOptions?: string | ICreateAttachmentOptions\n) => void\nexport type ICreateBufferAttachment = (\n data: Buffer,\n mediaTypeOrOptions: string | ICreateAttachmentOptions\n) => void\nexport type ICreateStreamAttachment = (\n data: Readable,\n mediaTypeOrOptions: string | ICreateAttachmentOptions\n) => Promise<void>\nexport type ICreateStreamAttachmentWithCallback = (\n data: Readable,\n mediaTypeOrOptions: string | ICreateAttachmentOptions,\n callback: () => void\n) => void\nexport type ICreateAttachment = ICreateStringAttachment &\n ICreateBufferAttachment &\n ICreateStreamAttachment &\n ICreateStreamAttachmentWithCallback\nexport type ICreateLog = (text: string) => void\nexport type ICreateLink = (text: string) => void\n\nexport default class AttachmentManager {\n private readonly onAttachment: IAttachFunction\n\n constructor(onAttachment: IAttachFunction) {\n this.onAttachment = onAttachment\n }\n\n log(text: string): void | Promise<void> {\n return this.create(text, 'text/x.cucumber.log+plain')\n }\n\n link(...url: string[]): void | Promise<void> {\n return this.create(url.join('\\n'), 'text/uri-list')\n }\n\n create(\n data: Buffer | Readable | string,\n mediaTypeOrOptions?: string | ICreateAttachmentOptions,\n callback?: () => void\n ): void | Promise<void> {\n const options = normaliseOptions(mediaTypeOrOptions)\n if (Buffer.isBuffer(data)) {\n if (doesNotHaveValue(options.mediaType)) {\n throw Error('Buffer attachments must specify a media type')\n }\n this.createBufferAttachment(data, options.mediaType, options.fileName)\n } else if (isStream.readable(data)) {\n if (doesNotHaveValue(options.mediaType)) {\n throw Error('Stream attachments must specify a media type')\n }\n return this.createStreamAttachment(\n data,\n options.mediaType,\n options.fileName,\n callback\n )\n } else if (typeof data === 'string') {\n if (doesNotHaveValue(options.mediaType)) {\n options.mediaType = 'text/plain'\n }\n if (options.mediaType.startsWith('base64:')) {\n this.createStringAttachment(\n data,\n {\n encoding: messages.AttachmentContentEncoding.BASE64,\n contentType: options.mediaType.replace('base64:', ''),\n },\n options.fileName\n )\n } else {\n this.createStringAttachment(\n data,\n {\n encoding: messages.AttachmentContentEncoding.IDENTITY,\n contentType: options.mediaType,\n },\n options.fileName\n )\n }\n } else {\n throw Error(\n 'Invalid attachment data: must be a buffer, readable stream, or string'\n )\n }\n }\n\n createBufferAttachment(\n data: Buffer,\n mediaType: string,\n fileName?: string\n ): void {\n this.createStringAttachment(\n data.toString('base64'),\n {\n encoding: messages.AttachmentContentEncoding.BASE64,\n contentType: mediaType,\n },\n fileName\n )\n }\n\n createStreamAttachment(\n data: Readable,\n mediaType: string,\n fileName?: string,\n callback?: () => void\n ): void | Promise<void> {\n const promise = new Promise<void>((resolve, reject) => {\n const buffers: Uint8Array[] = []\n data.on('data', (chunk) => {\n buffers.push(chunk)\n })\n data.on('end', () => {\n this.createBufferAttachment(Buffer.concat(buffers), mediaType, fileName)\n resolve()\n })\n data.on('error', reject)\n })\n if (doesHaveValue(callback)) {\n promise.then(callback, callback)\n } else {\n return promise\n }\n }\n\n createStringAttachment(\n data: string,\n media: IAttachmentMedia,\n fileName?: string\n ): void {\n this.onAttachment({\n data,\n media,\n ...(fileName ? { fileName } : {}),\n })\n }\n}\n\nfunction normaliseOptions(\n mediaTypeOrOptions?: string | ICreateAttachmentOptions\n): Partial<ICreateAttachmentOptions> {\n if (!mediaTypeOrOptions) {\n return {}\n }\n if (typeof mediaTypeOrOptions === 'string') {\n return {\n mediaType: mediaTypeOrOptions,\n }\n }\n return mediaTypeOrOptions\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/attachment_manager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0DAAgC;AAChC,6DAA8C;AAC9C,uDAAqE;AA2CrE,MAAqB,iBAAiB;IACnB,YAAY,CAAiB;IAE9C,YAAY,YAA6B;QACvC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,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,CAAA;YACF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;QACF,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAClC,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAA;QAChB,CAAC;IACH,CAAC;IAED,sBAAsB,CACpB,IAAY,EACZ,KAAuB,EACvB,QAAiB;QAEjB,IAAI,CAAC,YAAY,CAAC;YAChB,IAAI;YACJ,KAAK;YACL,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClC,CAAC,CAAA;IACJ,CAAC;CACF;AApHD,oCAoHC;AAED,SAAS,gBAAgB,CACvB,kBAAsD;IAEtD,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,OAAO,EAAE,CAAA;IACX,CAAC;IACD,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE,CAAC;QAC3C,OAAO;YACL,SAAS,EAAE,kBAAkB;SAC9B,CAAA;IACH,CAAC;IACD,OAAO,kBAAkB,CAAA;AAC3B,CAAC","sourcesContent":["import { Readable } from 'node:stream'\nimport isStream from 'is-stream'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\n\nexport interface IAttachmentMedia {\n encoding: messages.AttachmentContentEncoding\n contentType: string\n}\n\nexport interface IAttachment {\n data: string\n media: IAttachmentMedia\n fileName?: string\n}\n\nexport type IAttachFunction = (attachment: IAttachment) => void\n\nexport interface ICreateAttachmentOptions {\n mediaType: string\n fileName?: string\n}\nexport type ICreateStringAttachment = (\n data: string,\n mediaTypeOrOptions?: string | ICreateAttachmentOptions\n) => void\nexport type ICreateBufferAttachment = (\n data: Buffer,\n mediaTypeOrOptions: string | ICreateAttachmentOptions\n) => void\nexport type ICreateStreamAttachment = (\n data: Readable,\n mediaTypeOrOptions: string | ICreateAttachmentOptions\n) => Promise<void>\nexport type ICreateStreamAttachmentWithCallback = (\n data: Readable,\n mediaTypeOrOptions: string | ICreateAttachmentOptions,\n callback: () => void\n) => void\nexport type ICreateAttachment = ICreateStringAttachment &\n ICreateBufferAttachment &\n ICreateStreamAttachment &\n ICreateStreamAttachmentWithCallback\nexport type ICreateLog = (text: string) => void\nexport type ICreateLink = (text: string) => void\n\nexport default class AttachmentManager {\n private readonly onAttachment: IAttachFunction\n\n constructor(onAttachment: IAttachFunction) {\n this.onAttachment = onAttachment\n }\n\n log(text: string): void | Promise<void> {\n return this.create(text, 'text/x.cucumber.log+plain')\n }\n\n link(...url: string[]): void | Promise<void> {\n return this.create(url.join('\\n'), 'text/uri-list')\n }\n\n create(\n data: Buffer | Readable | string,\n mediaTypeOrOptions?: string | ICreateAttachmentOptions,\n callback?: () => void\n ): void | Promise<void> {\n const options = normaliseOptions(mediaTypeOrOptions)\n if (Buffer.isBuffer(data)) {\n if (doesNotHaveValue(options.mediaType)) {\n throw Error('Buffer attachments must specify a media type')\n }\n this.createBufferAttachment(data, options.mediaType, options.fileName)\n } else if (isStream.readable(data)) {\n if (doesNotHaveValue(options.mediaType)) {\n throw Error('Stream attachments must specify a media type')\n }\n return this.createStreamAttachment(\n data,\n options.mediaType,\n options.fileName,\n callback\n )\n } else if (typeof data === 'string') {\n if (doesNotHaveValue(options.mediaType)) {\n options.mediaType = 'text/plain'\n }\n if (options.mediaType.startsWith('base64:')) {\n this.createStringAttachment(\n data,\n {\n encoding: messages.AttachmentContentEncoding.BASE64,\n contentType: options.mediaType.replace('base64:', ''),\n },\n options.fileName\n )\n } else {\n this.createStringAttachment(\n data,\n {\n encoding: messages.AttachmentContentEncoding.IDENTITY,\n contentType: options.mediaType,\n },\n options.fileName\n )\n }\n } else {\n throw Error(\n 'Invalid attachment data: must be a buffer, readable stream, or string'\n )\n }\n }\n\n createBufferAttachment(\n data: Buffer,\n mediaType: string,\n fileName?: string\n ): void {\n this.createStringAttachment(\n data.toString('base64'),\n {\n encoding: messages.AttachmentContentEncoding.BASE64,\n contentType: mediaType,\n },\n fileName\n )\n }\n\n createStreamAttachment(\n data: Readable,\n mediaType: string,\n fileName?: string,\n callback?: () => void\n ): void | Promise<void> {\n const promise = new Promise<void>((resolve, reject) => {\n const buffers: Uint8Array[] = []\n data.on('data', (chunk) => {\n buffers.push(chunk)\n })\n data.on('end', () => {\n this.createBufferAttachment(Buffer.concat(buffers), mediaType, fileName)\n resolve()\n })\n data.on('error', reject)\n })\n if (doesHaveValue(callback)) {\n promise.then(callback, callback)\n } else {\n return promise\n }\n }\n\n createStringAttachment(\n data: string,\n media: IAttachmentMedia,\n fileName?: string\n ): void {\n this.onAttachment({\n data,\n media,\n ...(fileName ? { fileName } : {}),\n })\n }\n}\n\nfunction normaliseOptions(\n mediaTypeOrOptions?: string | ICreateAttachmentOptions\n): Partial<ICreateAttachmentOptions> {\n if (!mediaTypeOrOptions) {\n return {}\n }\n if (typeof mediaTypeOrOptions === 'string') {\n return {\n mediaType: mediaTypeOrOptions,\n }\n }\n return mediaTypeOrOptions\n}\n"]}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'node:events';
3
2
  import { IdGenerator } from '@cucumber/messages';
4
3
  import { SourcedPickle } from '../assemble';
@@ -17,20 +17,18 @@ class Coordinator {
17
17
  this.adapter = adapter;
18
18
  }
19
19
  async run() {
20
+ const testRunStartedId = this.newId();
20
21
  this.eventBroadcaster.emit('envelope', {
21
22
  testRunStarted: {
23
+ id: testRunStartedId,
22
24
  timestamp: (0, stopwatch_1.timestamp)(),
23
25
  },
24
26
  });
25
- const assembledTestCases = await (0, assemble_1.assembleTestCases)({
26
- eventBroadcaster: this.eventBroadcaster,
27
- newId: this.newId,
28
- sourcedPickles: this.sourcedPickles,
29
- supportCodeLibrary: this.supportCodeLibrary,
30
- });
27
+ const assembledTestCases = await (0, assemble_1.assembleTestCases)(testRunStartedId, this.eventBroadcaster, this.newId, this.sourcedPickles, this.supportCodeLibrary);
31
28
  const success = await this.adapter.run(assembledTestCases);
32
29
  this.eventBroadcaster.emit('envelope', {
33
30
  testRunFinished: {
31
+ testRunStartedId,
34
32
  timestamp: (0, stopwatch_1.timestamp)(),
35
33
  success,
36
34
  },
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/runtime/coordinator.ts"],"names":[],"mappings":";;;AAEA,0CAA8D;AAG9D,2CAAuC;AAGvC,MAAa,WAAW;IAEZ;IACA;IACA;IACA;IACA;IALV,YACU,gBAA8B,EAC9B,KAAwB,EACxB,cAA4C,EAC5C,kBAAsC,EACtC,OAAuB;QAJvB,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,UAAK,GAAL,KAAK,CAAmB;QACxB,mBAAc,GAAd,cAAc,CAA8B;QAC5C,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,YAAO,GAAP,OAAO,CAAgB;IAC9B,CAAC;IAEJ,KAAK,CAAC,GAAG;QACP,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,cAAc,EAAE;gBACd,SAAS,EAAE,IAAA,qBAAS,GAAE;aACvB;SACiB,CAAC,CAAA;QAErB,MAAM,kBAAkB,GAAG,MAAM,IAAA,4BAAiB,EAAC;YACjD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QAEF,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;QAE1D,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,eAAe,EAAE;gBACf,SAAS,EAAE,IAAA,qBAAS,GAAE;gBACtB,OAAO;aACR;SACiB,CAAC,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAlCD,kCAkCC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Envelope, IdGenerator } from '@cucumber/messages'\nimport { assembleTestCases, SourcedPickle } from '../assemble'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { RuntimeAdapter } from './types'\nimport { timestamp } from './stopwatch'\nimport { Runtime } from './index'\n\nexport class Coordinator implements Runtime {\n constructor(\n private eventBroadcaster: EventEmitter,\n private newId: IdGenerator.NewId,\n private sourcedPickles: ReadonlyArray<SourcedPickle>,\n private supportCodeLibrary: SupportCodeLibrary,\n private adapter: RuntimeAdapter\n ) {}\n\n async run(): Promise<boolean> {\n this.eventBroadcaster.emit('envelope', {\n testRunStarted: {\n timestamp: timestamp(),\n },\n } satisfies Envelope)\n\n const assembledTestCases = await assembleTestCases({\n eventBroadcaster: this.eventBroadcaster,\n newId: this.newId,\n sourcedPickles: this.sourcedPickles,\n supportCodeLibrary: this.supportCodeLibrary,\n })\n\n const success = await this.adapter.run(assembledTestCases)\n\n this.eventBroadcaster.emit('envelope', {\n testRunFinished: {\n timestamp: timestamp(),\n success,\n },\n } satisfies Envelope)\n\n return success\n }\n}\n"]}
1
+ {"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/runtime/coordinator.ts"],"names":[],"mappings":";;;AAEA,0CAA8D;AAG9D,2CAAuC;AAGvC,MAAa,WAAW;IAEZ;IACA;IACA;IACA;IACA;IALV,YACU,gBAA8B,EAC9B,KAAwB,EACxB,cAA4C,EAC5C,kBAAsC,EACtC,OAAuB;QAJvB,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,UAAK,GAAL,KAAK,CAAmB;QACxB,mBAAc,GAAd,cAAc,CAA8B;QAC5C,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,YAAO,GAAP,OAAO,CAAgB;IAC9B,CAAC;IAEJ,KAAK,CAAC,GAAG;QACP,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QAErC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,cAAc,EAAE;gBACd,EAAE,EAAE,gBAAgB;gBACpB,SAAS,EAAE,IAAA,qBAAS,GAAE;aACvB;SACiB,CAAC,CAAA;QAErB,MAAM,kBAAkB,GAAG,MAAM,IAAA,4BAAiB,EAChD,gBAAgB,EAChB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,kBAAkB,CACxB,CAAA;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;QAE1D,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,eAAe,EAAE;gBACf,gBAAgB;gBAChB,SAAS,EAAE,IAAA,qBAAS,GAAE;gBACtB,OAAO;aACR;SACiB,CAAC,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAvCD,kCAuCC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Envelope, IdGenerator } from '@cucumber/messages'\nimport { assembleTestCases, SourcedPickle } from '../assemble'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { RuntimeAdapter } from './types'\nimport { timestamp } from './stopwatch'\nimport { Runtime } from './index'\n\nexport class Coordinator implements Runtime {\n constructor(\n private eventBroadcaster: EventEmitter,\n private newId: IdGenerator.NewId,\n private sourcedPickles: ReadonlyArray<SourcedPickle>,\n private supportCodeLibrary: SupportCodeLibrary,\n private adapter: RuntimeAdapter\n ) {}\n\n async run(): Promise<boolean> {\n const testRunStartedId = this.newId()\n\n this.eventBroadcaster.emit('envelope', {\n testRunStarted: {\n id: testRunStartedId,\n timestamp: timestamp(),\n },\n } satisfies Envelope)\n\n const assembledTestCases = await assembleTestCases(\n testRunStartedId,\n this.eventBroadcaster,\n this.newId,\n this.sourcedPickles,\n this.supportCodeLibrary\n )\n\n const success = await this.adapter.run(assembledTestCases)\n\n this.eventBroadcaster.emit('envelope', {\n testRunFinished: {\n testRunStartedId,\n timestamp: timestamp(),\n success,\n },\n } satisfies Envelope)\n\n return success\n }\n}\n"]}
@@ -3,7 +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
- exports.formatError = void 0;
6
+ exports.formatError = formatError;
7
7
  const assertion_error_formatter_1 = require("assertion-error-formatter");
8
8
  const error_stack_parser_1 = __importDefault(require("error-stack-parser"));
9
9
  const filter_stack_trace_1 = require("../filter_stack_trace");
@@ -35,5 +35,4 @@ function formatError(error, filterStackTraces) {
35
35
  },
36
36
  };
37
37
  }
38
- exports.formatError = formatError;
39
38
  //# sourceMappingURL=format_error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format_error.js","sourceRoot":"","sources":["../../src/runtime/format_error.ts"],"names":[],"mappings":";;;;;;AACA,yEAAkD;AAClD,4EAAiD;AACjD,8DAAwD;AAExD,SAAgB,WAAW,CACzB,KAAY,EACZ,iBAA0B;IAE1B,IAAI,mBAA2B,CAAA;IAC/B,IAAI;QACF,MAAM,WAAW,GAAG,4BAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACjD,MAAM,aAAa,GAAG,iBAAiB;YACrC,CAAC,CAAC,IAAA,qCAAgB,EAAC,WAAW,CAAC;YAC/B,CAAC,CAAC,WAAW,CAAA;QACf,mBAAmB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KACpE;IAAC,MAAM;QACN,yEAAyE;KAC1E;IACD,MAAM,OAAO,GAAG,IAAA,kCAAM,EAAC,KAAK,EAAE;QAC5B,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC5B,OAAO,mBAAmB,CAAC,CAAC,CAAC,KAAK,mBAAmB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACjE,CAAC;SACF;KACF,CAAC,CAAA;IACF,OAAO;QACL,OAAO;QACP,SAAS,EAAE;YACT,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,OAAO;YAC3B,OAAO,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO;YAC1D,UAAU,EAAE,mBAAmB,IAAI,KAAK,CAAC,KAAK;SAC/C;KACF,CAAA;AACH,CAAC;AA7BD,kCA6BC","sourcesContent":["import { TestStepResult } from '@cucumber/messages'\nimport { format } from 'assertion-error-formatter'\nimport errorStackParser from 'error-stack-parser'\nimport { filterStackTrace } from '../filter_stack_trace'\n\nexport function formatError(\n error: Error,\n filterStackTraces: boolean\n): Pick<TestStepResult, 'message' | 'exception'> {\n let processedStackTrace: string\n try {\n const parsedStack = errorStackParser.parse(error)\n const filteredStack = filterStackTraces\n ? filterStackTrace(parsedStack)\n : parsedStack\n processedStackTrace = filteredStack.map((f) => f.source).join('\\n')\n } catch {\n // if we weren't able to parse and process, we'll settle for the original\n }\n const message = format(error, {\n colorFns: {\n errorStack: (stack: string) => {\n return processedStackTrace ? `\\n${processedStackTrace}` : stack\n },\n },\n })\n return {\n message,\n exception: {\n type: error.name || 'Error',\n message: typeof error === 'string' ? error : error.message,\n stackTrace: processedStackTrace ?? error.stack,\n },\n }\n}\n"]}
1
+ {"version":3,"file":"format_error.js","sourceRoot":"","sources":["../../src/runtime/format_error.ts"],"names":[],"mappings":";;;;;AAKA,kCA6BC;AAjCD,yEAAkD;AAClD,4EAAiD;AACjD,8DAAwD;AAExD,SAAgB,WAAW,CACzB,KAAY,EACZ,iBAA0B;IAE1B,IAAI,mBAA2B,CAAA;IAC/B,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,4BAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACjD,MAAM,aAAa,GAAG,iBAAiB;YACrC,CAAC,CAAC,IAAA,qCAAgB,EAAC,WAAW,CAAC;YAC/B,CAAC,CAAC,WAAW,CAAA;QACf,mBAAmB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;IAC3E,CAAC;IACD,MAAM,OAAO,GAAG,IAAA,kCAAM,EAAC,KAAK,EAAE;QAC5B,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC5B,OAAO,mBAAmB,CAAC,CAAC,CAAC,KAAK,mBAAmB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACjE,CAAC;SACF;KACF,CAAC,CAAA;IACF,OAAO;QACL,OAAO;QACP,SAAS,EAAE;YACT,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,OAAO;YAC3B,OAAO,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO;YAC1D,UAAU,EAAE,mBAAmB,IAAI,KAAK,CAAC,KAAK;SAC/C;KACF,CAAA;AACH,CAAC","sourcesContent":["import { TestStepResult } from '@cucumber/messages'\nimport { format } from 'assertion-error-formatter'\nimport errorStackParser from 'error-stack-parser'\nimport { filterStackTrace } from '../filter_stack_trace'\n\nexport function formatError(\n error: Error,\n filterStackTraces: boolean\n): Pick<TestStepResult, 'message' | 'exception'> {\n let processedStackTrace: string\n try {\n const parsedStack = errorStackParser.parse(error)\n const filteredStack = filterStackTraces\n ? filterStackTrace(parsedStack)\n : parsedStack\n processedStackTrace = filteredStack.map((f) => f.source).join('\\n')\n } catch {\n // if we weren't able to parse and process, we'll settle for the original\n }\n const message = format(error, {\n colorFns: {\n errorStack: (stack: string) => {\n return processedStackTrace ? `\\n${processedStackTrace}` : stack\n },\n },\n })\n return {\n message,\n exception: {\n type: error.name || 'Error',\n message: typeof error === 'string' ? error : error.message,\n stackTrace: processedStackTrace ?? error.stack,\n },\n }\n}\n"]}
@@ -15,18 +15,30 @@ 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
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.shouldCauseFailure = exports.retriesForPickle = exports.getAmbiguousStepException = void 0;
39
+ exports.getAmbiguousStepException = getAmbiguousStepException;
40
+ exports.retriesForPickle = retriesForPickle;
41
+ exports.shouldCauseFailure = shouldCauseFailure;
30
42
  const cli_table3_1 = __importDefault(require("cli-table3"));
31
43
  const indent_string_1 = __importDefault(require("indent-string"));
32
44
  const messages = __importStar(require("@cucumber/messages"));
@@ -63,7 +75,6 @@ function getAmbiguousStepException(stepDefinitions) {
63
75
  }));
64
76
  return `${'Multiple step definitions match:' + '\n'}${(0, indent_string_1.default)(table.toString(), 2)}`;
65
77
  }
66
- exports.getAmbiguousStepException = getAmbiguousStepException;
67
78
  function retriesForPickle(pickle, options) {
68
79
  if (!options.retry) {
69
80
  return 0;
@@ -82,7 +93,6 @@ function retriesForPickle(pickle, options) {
82
93
  }
83
94
  return 0;
84
95
  }
85
- exports.retriesForPickle = retriesForPickle;
86
96
  function shouldCauseFailure(status, options) {
87
97
  if (options.dryRun) {
88
98
  return false;
@@ -97,5 +107,4 @@ function shouldCauseFailure(status, options) {
97
107
  }
98
108
  return failureStatuses.includes(status);
99
109
  }
100
- exports.shouldCauseFailure = shouldCauseFailure;
101
110
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/runtime/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA8B;AAC9B,kEAAwC;AACxC,6DAA8C;AAC9C,4EAAsE;AACtE,oDAAkD;AAIlD,SAAgB,yBAAyB,CACvC,eAAiC;IAEjC,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,EAAE;YACT,WAAW,EAAE,EAAE;YACf,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;SAChB;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,cAAc,EAAE,CAAC;YACjB,eAAe,EAAE,C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AI,OAAO,CAAC,MAAM,EAAE;QAClB,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;KAC5D;IACD,OAAO,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC;AAhBD,gDAgBC","sourcesContent":["import Table from 'cli-table3'\nimport indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport { formatLocation } from '../formatter/helpers/location_helpers'\nimport { PickleTagFilter } from '../pickle_filter'\nimport StepDefinition from '../models/step_definition'\nimport { RuntimeOptions } from '.'\n\nexport function getAmbiguousStepException(\n stepDefinitions: StepDefinition[]\n): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: ' - ',\n right: '',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 0,\n 'padding-right': 0,\n },\n })\n table.push(\n ...stepDefinitions.map((stepDefinition) => {\n const pattern = stepDefinition.pattern.toString()\n return [pattern, formatLocation(stepDefinition)]\n })\n )\n return `${'Multiple step definitions match:' + '\\n'}${indentString(\n table.toString(),\n 2\n )}`\n}\n\nexport function retriesForPickle(\n pickle: messages.Pickle,\n options: RuntimeOptions\n): number {\n if (!options.retry) {\n return 0\n }\n const retries = options.retry\n if (retries === 0) {\n return 0\n }\n const retryTagFilter = options.retryTagFilter\n if (!retryTagFilter) {\n return retries\n }\n const pickleTagFilter = new PickleTagFilter(retryTagFilter)\n if (pickleTagFilter.matchesAllTagExpressions(pickle)) {\n return retries\n }\n return 0\n}\n\nexport function shouldCauseFailure(\n status: messages.TestStepResultStatus,\n options: RuntimeOptions\n): boolean {\n if (options.dryRun) {\n return false\n }\n const failureStatuses: messages.TestStepResultStatus[] = [\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.UNDEFINED,\n ]\n if (options.strict) {\n failureStatuses.push(messages.TestStepResultStatus.PENDING)\n }\n return failureStatuses.includes(status)\n}\n"]}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/runtime/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,8DAqCC;AAED,4CAoBC;AAED,gDAgBC;AArFD,4DAA8B;AAC9B,kEAAwC;AACxC,6DAA8C;AAC9C,4EAAsE;AACtE,oDAAkD;AAIlD,SAAgB,yBAAyB,CACvC,eAAiC;IAEjC,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,EAAE;YACT,WAAW,EAAE,EAAE;YACf,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;SAChB;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,cAAc,EAAE,CAAC;YACjB,eAAe,EAAE,CAAC;SACnB;KACF,CAAC,CAAA;IACF,KAAK,CAAC,IAAI,CACR,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAA;QACjD,OAAO,CAAC,OAAO,EAAE,IAAA,iCAAc,EAAC,cAAc,CAAC,CAAC,CAAA;IAClD,CAAC,CAAC,CACH,CAAA;IACD,OAAO,GAAG,kCAAkC,GAAG,IAAI,GAAG,IAAA,uBAAY,EAChE,KAAK,CAAC,QAAQ,EAAE,EAChB,CAAC,CACF,EAAE,CAAA;AACL,CAAC;AAED,SAAgB,gBAAgB,CAC9B,MAAuB,EACvB,OAAuB;IAEvB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,CAAC,CAAA;IACV,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAA;IAC7B,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAA;IACV,CAAC;IACD,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;IAC7C,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,MAAM,eAAe,GAAG,IAAI,+BAAe,CAAC,cAAc,CAAC,CAAA;IAC3D,IAAI,eAAe,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACrD,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAgB,kBAAkB,CAChC,MAAqC,EACrC,OAAuB;IAEvB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,eAAe,GAAoC;QACvD,QAAQ,CAAC,oBAAoB,CAAC,SAAS;QACvC,QAAQ,CAAC,oBAAoB,CAAC,MAAM;QACpC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;KACxC,CAAA;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;IAC7D,CAAC;IACD,OAAO,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC","sourcesContent":["import Table from 'cli-table3'\nimport indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport { formatLocation } from '../formatter/helpers/location_helpers'\nimport { PickleTagFilter } from '../pickle_filter'\nimport StepDefinition from '../models/step_definition'\nimport { RuntimeOptions } from '.'\n\nexport function getAmbiguousStepException(\n stepDefinitions: StepDefinition[]\n): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: ' - ',\n right: '',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 0,\n 'padding-right': 0,\n },\n })\n table.push(\n ...stepDefinitions.map((stepDefinition) => {\n const pattern = stepDefinition.pattern.toString()\n return [pattern, formatLocation(stepDefinition)]\n })\n )\n return `${'Multiple step definitions match:' + '\\n'}${indentString(\n table.toString(),\n 2\n )}`\n}\n\nexport function retriesForPickle(\n pickle: messages.Pickle,\n options: RuntimeOptions\n): number {\n if (!options.retry) {\n return 0\n }\n const retries = options.retry\n if (retries === 0) {\n return 0\n }\n const retryTagFilter = options.retryTagFilter\n if (!retryTagFilter) {\n return retries\n }\n const pickleTagFilter = new PickleTagFilter(retryTagFilter)\n if (pickleTagFilter.matchesAllTagExpressions(pickle)) {\n return retries\n }\n return 0\n}\n\nexport function shouldCauseFailure(\n status: messages.TestStepResultStatus,\n options: RuntimeOptions\n): boolean {\n if (options.dryRun) {\n return false\n }\n const failureStatuses: messages.TestStepResultStatus[] = [\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.UNDEFINED,\n ]\n if (options.strict) {\n failureStatuses.push(messages.TestStepResultStatus.PENDING)\n }\n return failureStatuses.includes(status)\n}\n"]}
@@ -1,10 +1,10 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'node:events';
3
2
  import { IdGenerator } from '@cucumber/messages';
4
- import { IRunEnvironment, IRunOptionsRuntime } from '../api';
5
- import { ILogger } from '../logger';
3
+ import { IRunOptionsRuntime } from '../api';
4
+ import { ILogger } from '../environment';
6
5
  import { SourcedPickle } from '../assemble';
7
6
  import { SupportCodeLibrary } from '../support_code_library_builder/types';
7
+ import { IRunEnvironment } from '../environment';
8
8
  import { Runtime } from './types';
9
9
  export declare function makeRuntime({ environment, logger, eventBroadcaster, sourcedPickles, newId, supportCodeLibrary, options, }: {
10
10
  environment: IRunEnvironment;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeRuntime = void 0;
3
+ exports.makeRuntime = makeRuntime;
4
4
  const adapter_1 = require("./parallel/adapter");
5
5
  const adapter_2 = require("./serial/adapter");
6
6
  const coordinator_1 = require("./coordinator");
@@ -10,5 +10,4 @@ async function makeRuntime({ environment, logger, eventBroadcaster, sourcedPickl
10
10
  : new adapter_2.InProcessAdapter(eventBroadcaster, newId, options, supportCodeLibrary);
11
11
  return new coordinator_1.Coordinator(eventBroadcaster, newId, sourcedPickles, supportCodeLibrary, adapter);
12
12
  }
13
- exports.makeRuntime = makeRuntime;
14
13
  //# sourceMappingURL=make_runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"make_runtime.js","sourceRoot":"","sources":["../../src/runtime/make_runtime.ts"],"names":[],"mappings":";;;AAOA,gDAAwD;AACxD,8CAAmD;AACnD,+CAA2C;AAEpC,KAAK,UAAU,WAAW,CAAC,EAChC,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,OAAO,GASR;IACC,MAAM,OAAO,GACX,OAAO,CAAC,QAAQ,GAAG,CAAC;QAClB,CAAC,CAAC,IAAI,6BAAmB,CACrB,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,kBAAkB,CACnB;QACH,CAAC,CAAC,IAAI,0BAAgB,CAClB,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,kBAAkB,CACnB,CAAA;IACP,OAAO,IAAI,yBAAW,CACpB,gBAAgB,EAChB,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,OAAO,CACR,CAAA;AACH,CAAC;AAvCD,kCAuCC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { IdGenerator } from '@cucumber/messages'\nimport { IRunEnvironment, IRunOptionsRuntime } from '../api'\nimport { ILogger } from '../logger'\nimport { SourcedPickle } from '../assemble'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { Runtime, RuntimeAdapter } from './types'\nimport { ChildProcessAdapter } from './parallel/adapter'\nimport { InProcessAdapter } from './serial/adapter'\nimport { Coordinator } from './coordinator'\n\nexport async function makeRuntime({\n environment,\n logger,\n eventBroadcaster,\n sourcedPickles,\n newId,\n supportCodeLibrary,\n options,\n}: {\n environment: IRunEnvironment\n logger: ILogger\n eventBroadcaster: EventEmitter\n newId: IdGenerator.NewId\n sourcedPickles: ReadonlyArray<SourcedPickle>\n supportCodeLibrary: SupportCodeLibrary\n options: IRunOptionsRuntime\n}): Promise<Runtime> {\n const adapter: RuntimeAdapter =\n options.parallel > 0\n ? new ChildProcessAdapter(\n environment,\n logger,\n eventBroadcaster,\n options,\n supportCodeLibrary\n )\n : new InProcessAdapter(\n eventBroadcaster,\n newId,\n options,\n supportCodeLibrary\n )\n return new Coordinator(\n eventBroadcaster,\n newId,\n sourcedPickles,\n supportCodeLibrary,\n adapter\n )\n}\n"]}
1
+ {"version":3,"file":"make_runtime.js","sourceRoot":"","sources":["../../src/runtime/make_runtime.ts"],"names":[],"mappings":";;AAYA,kCAuCC;AA3CD,gDAAwD;AACxD,8CAAmD;AACnD,+CAA2C;AAEpC,KAAK,UAAU,WAAW,CAAC,EAChC,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,OAAO,GASR;IACC,MAAM,OAAO,GACX,OAAO,CAAC,QAAQ,GAAG,CAAC;QAClB,CAAC,CAAC,IAAI,6BAAmB,CACrB,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,kBAAkB,CACnB;QACH,CAAC,CAAC,IAAI,0BAAgB,CAClB,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,kBAAkB,CACnB,CAAA;IACP,OAAO,IAAI,yBAAW,CACpB,gBAAgB,EAChB,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,OAAO,CACR,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { IdGenerator } from '@cucumber/messages'\nimport { IRunOptionsRuntime } from '../api'\nimport { ILogger } from '../environment'\nimport { SourcedPickle } from '../assemble'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { IRunEnvironment } from '../environment'\nimport { Runtime, RuntimeAdapter } from './types'\nimport { ChildProcessAdapter } from './parallel/adapter'\nimport { InProcessAdapter } from './serial/adapter'\nimport { Coordinator } from './coordinator'\n\nexport async function makeRuntime({\n environment,\n logger,\n eventBroadcaster,\n sourcedPickles,\n newId,\n supportCodeLibrary,\n options,\n}: {\n environment: IRunEnvironment\n logger: ILogger\n eventBroadcaster: EventEmitter\n newId: IdGenerator.NewId\n sourcedPickles: ReadonlyArray<SourcedPickle>\n supportCodeLibrary: SupportCodeLibrary\n options: IRunOptionsRuntime\n}): Promise<Runtime> {\n const adapter: RuntimeAdapter =\n options.parallel > 0\n ? new ChildProcessAdapter(\n environment,\n logger,\n eventBroadcaster,\n options,\n supportCodeLibrary\n )\n : new InProcessAdapter(\n eventBroadcaster,\n newId,\n options,\n supportCodeLibrary\n )\n return new Coordinator(\n eventBroadcaster,\n newId,\n sourcedPickles,\n supportCodeLibrary,\n adapter\n )\n}\n"]}
@@ -1,12 +1,10 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { ChildProcess } from 'node:child_process';
4
2
  import { EventEmitter } from 'node:events';
5
3
  import { SupportCodeLibrary } from '../../support_code_library_builder/types';
6
4
  import { AssembledTestCase } from '../../assemble';
7
- import { ILogger } from '../../logger';
5
+ import { ILogger, IRunEnvironment } from '../../environment';
8
6
  import { RuntimeAdapter } from '../types';
9
- import { IRunEnvironment, IRunOptionsRuntime } from '../../api';
7
+ import { IRunOptionsRuntime } from '../../api';
10
8
  import { WorkerToCoordinatorEvent } from './types';
11
9
  declare const enum WorkerState {
12
10
  'idle' = 0,