@dev-blinq/cucumber-js 1.0.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 (345) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +124 -0
  3. package/api/index.d.ts +6 -0
  4. package/bin/cucumber-js +3 -0
  5. package/bin/cucumber.js +3 -0
  6. package/lib/api/console_logger.d.ts +12 -0
  7. package/lib/api/console_logger.js +24 -0
  8. package/lib/api/console_logger.js.map +1 -0
  9. package/lib/api/convert_configuration.d.ts +4 -0
  10. package/lib/api/convert_configuration.js +65 -0
  11. package/lib/api/convert_configuration.js.map +1 -0
  12. package/lib/api/environment.d.ts +2 -0
  13. package/lib/api/environment.js +14 -0
  14. package/lib/api/environment.js.map +1 -0
  15. package/lib/api/formatters.d.ts +20 -0
  16. package/lib/api/formatters.js +61 -0
  17. package/lib/api/formatters.js.map +1 -0
  18. package/lib/api/gherkin.d.ts +21 -0
  19. package/lib/api/gherkin.js +65 -0
  20. package/lib/api/gherkin.js.map +1 -0
  21. package/lib/api/index.d.ts +12 -0
  22. package/lib/api/index.js +28 -0
  23. package/lib/api/index.js.map +1 -0
  24. package/lib/api/load_configuration.d.ts +9 -0
  25. package/lib/api/load_configuration.js +41 -0
  26. package/lib/api/load_configuration.js.map +1 -0
  27. package/lib/api/load_sources.d.ts +9 -0
  28. package/lib/api/load_sources.js +53 -0
  29. package/lib/api/load_sources.js.map +1 -0
  30. package/lib/api/load_support.d.ts +10 -0
  31. package/lib/api/load_support.js +30 -0
  32. package/lib/api/load_support.js.map +1 -0
  33. package/lib/api/paths.d.ts +8 -0
  34. package/lib/api/paths.js +102 -0
  35. package/lib/api/paths.js.map +1 -0
  36. package/lib/api/plugins.d.ts +4 -0
  37. package/lib/api/plugins.js +19 -0
  38. package/lib/api/plugins.js.map +1 -0
  39. package/lib/api/run_cucumber.d.ts +11 -0
  40. package/lib/api/run_cucumber.js +115 -0
  41. package/lib/api/run_cucumber.js.map +1 -0
  42. package/lib/api/runtime.d.ts +21 -0
  43. package/lib/api/runtime.js +36 -0
  44. package/lib/api/runtime.js.map +1 -0
  45. package/lib/api/support.d.ts +9 -0
  46. package/lib/api/support.js +26 -0
  47. package/lib/api/support.js.map +1 -0
  48. package/lib/api/test_helpers.d.ts +3 -0
  49. package/lib/api/test_helpers.js +36 -0
  50. package/lib/api/test_helpers.js.map +1 -0
  51. package/lib/api/types.d.ts +175 -0
  52. package/lib/api/types.js +3 -0
  53. package/lib/api/types.js.map +1 -0
  54. package/lib/api/wrapper.mjs +6 -0
  55. package/lib/cli/helpers.d.ts +37 -0
  56. package/lib/cli/helpers.js +203 -0
  57. package/lib/cli/helpers.js.map +1 -0
  58. package/lib/cli/i18n.d.ts +2 -0
  59. package/lib/cli/i18n.js +70 -0
  60. package/lib/cli/i18n.js.map +1 -0
  61. package/lib/cli/index.d.ts +21 -0
  62. package/lib/cli/index.js +59 -0
  63. package/lib/cli/index.js.map +1 -0
  64. package/lib/cli/install_validator.d.ts +1 -0
  65. package/lib/cli/install_validator.js +18 -0
  66. package/lib/cli/install_validator.js.map +1 -0
  67. package/lib/cli/run.d.ts +1 -0
  68. package/lib/cli/run.js +44 -0
  69. package/lib/cli/run.js.map +1 -0
  70. package/lib/cli/validate_node_engine_version.d.ts +10 -0
  71. package/lib/cli/validate_node_engine_version.js +24 -0
  72. package/lib/cli/validate_node_engine_version.js.map +1 -0
  73. package/lib/configuration/argv_parser.d.ts +20 -0
  74. package/lib/configuration/argv_parser.js +102 -0
  75. package/lib/configuration/argv_parser.js.map +1 -0
  76. package/lib/configuration/check_schema.d.ts +2 -0
  77. package/lib/configuration/check_schema.js +60 -0
  78. package/lib/configuration/check_schema.js.map +1 -0
  79. package/lib/configuration/default_configuration.d.ts +2 -0
  80. package/lib/configuration/default_configuration.js +27 -0
  81. package/lib/configuration/default_configuration.js.map +1 -0
  82. package/lib/configuration/from_file.d.ts +3 -0
  83. package/lib/configuration/from_file.js +85 -0
  84. package/lib/configuration/from_file.js.map +1 -0
  85. package/lib/configuration/helpers.d.ts +1 -0
  86. package/lib/configuration/helpers.js +11 -0
  87. package/lib/configuration/helpers.js.map +1 -0
  88. package/lib/configuration/index.d.ts +7 -0
  89. package/lib/configuration/index.js +29 -0
  90. package/lib/configuration/index.js.map +1 -0
  91. package/lib/configuration/locate_file.d.ts +1 -0
  92. package/lib/configuration/locate_file.js +21 -0
  93. package/lib/configuration/locate_file.js.map +1 -0
  94. package/lib/configuration/merge_configurations.d.ts +2 -0
  95. package/lib/configuration/merge_configurations.js +48 -0
  96. package/lib/configuration/merge_configurations.js.map +1 -0
  97. package/lib/configuration/option_splitter.d.ts +3 -0
  98. package/lib/configuration/option_splitter.js +23 -0
  99. package/lib/configuration/option_splitter.js.map +1 -0
  100. package/lib/configuration/types.d.ts +28 -0
  101. package/lib/configuration/types.js +3 -0
  102. package/lib/configuration/types.js.map +1 -0
  103. package/lib/configuration/validate_configuration.d.ts +3 -0
  104. package/lib/configuration/validate_configuration.js +13 -0
  105. package/lib/configuration/validate_configuration.js.map +1 -0
  106. package/lib/filter_stack_trace.d.ts +3 -0
  107. package/lib/filter_stack_trace.js +38 -0
  108. package/lib/filter_stack_trace.js.map +1 -0
  109. package/lib/formatter/builder.d.ts +37 -0
  110. package/lib/formatter/builder.js +101 -0
  111. package/lib/formatter/builder.js.map +1 -0
  112. package/lib/formatter/fixtures/typescript.d.ts +2 -0
  113. package/lib/formatter/fixtures/typescript.js +6 -0
  114. package/lib/formatter/fixtures/typescript.js.map +1 -0
  115. package/lib/formatter/get_color_fns.d.ts +15 -0
  116. package/lib/formatter/get_color_fns.js +56 -0
  117. package/lib/formatter/get_color_fns.js.map +1 -0
  118. package/lib/formatter/helpers/duration_helpers.d.ts +2 -0
  119. package/lib/formatter/helpers/duration_helpers.js +9 -0
  120. package/lib/formatter/helpers/duration_helpers.js.map +1 -0
  121. package/lib/formatter/helpers/event_data_collector.d.ts +30 -0
  122. package/lib/formatter/helpers/event_data_collector.js +126 -0
  123. package/lib/formatter/helpers/event_data_collector.js.map +1 -0
  124. package/lib/formatter/helpers/formatters.d.ts +6 -0
  125. package/lib/formatter/helpers/formatters.js +43 -0
  126. package/lib/formatter/helpers/formatters.js.map +1 -0
  127. package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -0
  128. package/lib/formatter/helpers/gherkin_document_parser.js +66 -0
  129. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -0
  130. package/lib/formatter/helpers/index.d.ts +10 -0
  131. package/lib/formatter/helpers/index.js +52 -0
  132. package/lib/formatter/helpers/index.js.map +1 -0
  133. package/lib/formatter/helpers/issue_helpers.d.ts +19 -0
  134. package/lib/formatter/helpers/issue_helpers.js +59 -0
  135. package/lib/formatter/helpers/issue_helpers.js.map +1 -0
  136. package/lib/formatter/helpers/keyword_type.d.ts +11 -0
  137. package/lib/formatter/helpers/keyword_type.js +32 -0
  138. package/lib/formatter/helpers/keyword_type.js.map +1 -0
  139. package/lib/formatter/helpers/location_helpers.d.ts +2 -0
  140. package/lib/formatter/helpers/location_helpers.js +17 -0
  141. package/lib/formatter/helpers/location_helpers.js.map +1 -0
  142. package/lib/formatter/helpers/pickle_parser.d.ts +17 -0
  143. package/lib/formatter/helpers/pickle_parser.js +28 -0
  144. package/lib/formatter/helpers/pickle_parser.js.map +1 -0
  145. package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -0
  146. package/lib/formatter/helpers/step_argument_formatter.js +48 -0
  147. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -0
  148. package/lib/formatter/helpers/summary_helpers.d.ts +9 -0
  149. package/lib/formatter/helpers/summary_helpers.js +96 -0
  150. package/lib/formatter/helpers/summary_helpers.js.map +1 -0
  151. package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +12 -0
  152. package/lib/formatter/helpers/test_case_attempt_formatter.js +114 -0
  153. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -0
  154. package/lib/formatter/helpers/test_case_attempt_parser.d.ts +32 -0
  155. package/lib/formatter/helpers/test_case_attempt_parser.js +135 -0
  156. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -0
  157. package/lib/formatter/helpers/usage_helpers/index.d.ts +23 -0
  158. package/lib/formatter/helpers/usage_helpers/index.js +111 -0
  159. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -0
  160. package/lib/formatter/html_formatter.d.ts +7 -0
  161. package/lib/formatter/html_formatter.js +30 -0
  162. package/lib/formatter/html_formatter.js.map +1 -0
  163. package/lib/formatter/index.d.ts +53 -0
  164. package/lib/formatter/index.js +21 -0
  165. package/lib/formatter/index.js.map +1 -0
  166. package/lib/formatter/json_formatter.d.ts +78 -0
  167. package/lib/formatter/json_formatter.js +230 -0
  168. package/lib/formatter/json_formatter.js.map +1 -0
  169. package/lib/formatter/junit_formatter.d.ts +17 -0
  170. package/lib/formatter/junit_formatter.js +181 -0
  171. package/lib/formatter/junit_formatter.js.map +1 -0
  172. package/lib/formatter/message_formatter.d.ts +5 -0
  173. package/lib/formatter/message_formatter.js +15 -0
  174. package/lib/formatter/message_formatter.js.map +1 -0
  175. package/lib/formatter/progress_bar_formatter.d.ts +18 -0
  176. package/lib/formatter/progress_bar_formatter.js +99 -0
  177. package/lib/formatter/progress_bar_formatter.js.map +1 -0
  178. package/lib/formatter/progress_formatter.d.ts +9 -0
  179. package/lib/formatter/progress_formatter.js +59 -0
  180. package/lib/formatter/progress_formatter.js.map +1 -0
  181. package/lib/formatter/rerun_formatter.d.ts +13 -0
  182. package/lib/formatter/rerun_formatter.js +80 -0
  183. package/lib/formatter/rerun_formatter.js.map +1 -0
  184. package/lib/formatter/snippets_formatter.d.ts +6 -0
  185. package/lib/formatter/snippets_formatter.js +61 -0
  186. package/lib/formatter/snippets_formatter.js.map +1 -0
  187. package/lib/formatter/step_definition_snippet_builder/index.d.ts +20 -0
  188. package/lib/formatter/step_definition_snippet_builder/index.js +46 -0
  189. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -0
  190. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +7 -0
  191. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +46 -0
  192. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -0
  193. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +16 -0
  194. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +11 -0
  195. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -0
  196. package/lib/formatter/summary_formatter.d.ts +14 -0
  197. package/lib/formatter/summary_formatter.js +68 -0
  198. package/lib/formatter/summary_formatter.js.map +1 -0
  199. package/lib/formatter/usage_formatter.d.ts +6 -0
  200. package/lib/formatter/usage_formatter.js +98 -0
  201. package/lib/formatter/usage_formatter.js.map +1 -0
  202. package/lib/formatter/usage_json_formatter.d.ts +7 -0
  203. package/lib/formatter/usage_json_formatter.js +34 -0
  204. package/lib/formatter/usage_json_formatter.js.map +1 -0
  205. package/lib/importer.js +13 -0
  206. package/lib/index.d.ts +58 -0
  207. package/lib/index.js +109 -0
  208. package/lib/index.js.map +1 -0
  209. package/lib/logger.d.ts +5 -0
  210. package/lib/logger.js +3 -0
  211. package/lib/logger.js.map +1 -0
  212. package/lib/models/data_table.d.ts +10 -0
  213. package/lib/models/data_table.js +46 -0
  214. package/lib/models/data_table.js.map +1 -0
  215. package/lib/models/definition.d.ts +55 -0
  216. package/lib/models/definition.js +22 -0
  217. package/lib/models/definition.js.map +1 -0
  218. package/lib/models/gherkin_step_keyword.d.ts +1 -0
  219. package/lib/models/gherkin_step_keyword.js +3 -0
  220. package/lib/models/gherkin_step_keyword.js.map +1 -0
  221. package/lib/models/pickle_order.d.ts +1 -0
  222. package/lib/models/pickle_order.js +3 -0
  223. package/lib/models/pickle_order.js.map +1 -0
  224. package/lib/models/step_definition.d.ts +11 -0
  225. package/lib/models/step_definition.js +37 -0
  226. package/lib/models/step_definition.js.map +1 -0
  227. package/lib/models/test_case_hook_definition.d.ts +10 -0
  228. package/lib/models/test_case_hook_definition.js +27 -0
  229. package/lib/models/test_case_hook_definition.js.map +1 -0
  230. package/lib/models/test_run_hook_definition.d.ts +3 -0
  231. package/lib/models/test_run_hook_definition.js +10 -0
  232. package/lib/models/test_run_hook_definition.js.map +1 -0
  233. package/lib/models/test_step_hook_definition.d.ts +9 -0
  234. package/lib/models/test_step_hook_definition.js +26 -0
  235. package/lib/models/test_step_hook_definition.js.map +1 -0
  236. package/lib/pickle_filter.d.ts +42 -0
  237. package/lib/pickle_filter.js +99 -0
  238. package/lib/pickle_filter.js.map +1 -0
  239. package/lib/plugin/index.d.ts +2 -0
  240. package/lib/plugin/index.js +19 -0
  241. package/lib/plugin/index.js.map +1 -0
  242. package/lib/plugin/plugin_manager.d.ts +13 -0
  243. package/lib/plugin/plugin_manager.js +36 -0
  244. package/lib/plugin/plugin_manager.js.map +1 -0
  245. package/lib/plugin/types.d.ts +14 -0
  246. package/lib/plugin/types.js +3 -0
  247. package/lib/plugin/types.js.map +1 -0
  248. package/lib/publish/http_stream.d.ts +30 -0
  249. package/lib/publish/http_stream.js +112 -0
  250. package/lib/publish/http_stream.js.map +1 -0
  251. package/lib/publish/index.d.ts +2 -0
  252. package/lib/publish/index.js +5 -0
  253. package/lib/publish/index.js.map +1 -0
  254. package/lib/publish/publish_plugin.d.ts +2 -0
  255. package/lib/publish/publish_plugin.js +48 -0
  256. package/lib/publish/publish_plugin.js.map +1 -0
  257. package/lib/runtime/assemble_test_cases.d.ts +13 -0
  258. package/lib/runtime/assemble_test_cases.js +88 -0
  259. package/lib/runtime/assemble_test_cases.js.map +1 -0
  260. package/lib/runtime/attachment_manager/index.d.ts +33 -0
  261. package/lib/runtime/attachment_manager/index.js +119 -0
  262. package/lib/runtime/attachment_manager/index.js.map +1 -0
  263. package/lib/runtime/format_error.d.ts +2 -0
  264. package/lib/runtime/format_error.js +36 -0
  265. package/lib/runtime/format_error.js.map +1 -0
  266. package/lib/runtime/helpers.d.ts +6 -0
  267. package/lib/runtime/helpers.js +101 -0
  268. package/lib/runtime/helpers.js.map +1 -0
  269. package/lib/runtime/index.d.ts +40 -0
  270. package/lib/runtime/index.js +76 -0
  271. package/lib/runtime/index.js.map +1 -0
  272. package/lib/runtime/parallel/command_types.d.ts +32 -0
  273. package/lib/runtime/parallel/command_types.js +3 -0
  274. package/lib/runtime/parallel/command_types.js.map +1 -0
  275. package/lib/runtime/parallel/coordinator.d.ts +72 -0
  276. package/lib/runtime/parallel/coordinator.js +222 -0
  277. package/lib/runtime/parallel/coordinator.js.map +1 -0
  278. package/lib/runtime/parallel/run_worker.d.ts +1 -0
  279. package/lib/runtime/parallel/run_worker.js +29 -0
  280. package/lib/runtime/parallel/run_worker.js.map +1 -0
  281. package/lib/runtime/parallel/worker.d.ts +26 -0
  282. package/lib/runtime/parallel/worker.js +87 -0
  283. package/lib/runtime/parallel/worker.js.map +1 -0
  284. package/lib/runtime/run_test_run_hooks.d.ts +3 -0
  285. package/lib/runtime/run_test_run_hooks.js +28 -0
  286. package/lib/runtime/run_test_run_hooks.js.map +1 -0
  287. package/lib/runtime/step_runner.d.ts +16 -0
  288. package/lib/runtime/step_runner.js +88 -0
  289. package/lib/runtime/step_runner.js.map +1 -0
  290. package/lib/runtime/stopwatch.d.ts +12 -0
  291. package/lib/runtime/stopwatch.js +34 -0
  292. package/lib/runtime/stopwatch.js.map +1 -0
  293. package/lib/runtime/test_case_runner.d.ts +54 -0
  294. package/lib/runtime/test_case_runner.js +268 -0
  295. package/lib/runtime/test_case_runner.js.map +1 -0
  296. package/lib/step_arguments.d.ts +6 -0
  297. package/lib/step_arguments.js +19 -0
  298. package/lib/step_arguments.js.map +1 -0
  299. package/lib/support_code_library_builder/build_parameter_type.d.ts +3 -0
  300. package/lib/support_code_library_builder/build_parameter_type.js +13 -0
  301. package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
  302. package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
  303. package/lib/support_code_library_builder/get_definition_line_and_uri.js +29 -0
  304. package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
  305. package/lib/support_code_library_builder/index.d.ts +74 -0
  306. package/lib/support_code_library_builder/index.js +304 -0
  307. package/lib/support_code_library_builder/index.js.map +1 -0
  308. package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
  309. package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
  310. package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
  311. package/lib/support_code_library_builder/sourced_parameter_type_registry.d.ts +7 -0
  312. package/lib/support_code_library_builder/sourced_parameter_type_registry.js +19 -0
  313. package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +1 -0
  314. package/lib/support_code_library_builder/types.d.ts +88 -0
  315. package/lib/support_code_library_builder/types.js +3 -0
  316. package/lib/support_code_library_builder/types.js.map +1 -0
  317. package/lib/support_code_library_builder/validate_arguments.d.ts +12 -0
  318. package/lib/support_code_library_builder/validate_arguments.js +73 -0
  319. package/lib/support_code_library_builder/validate_arguments.js.map +1 -0
  320. package/lib/support_code_library_builder/world.d.ts +18 -0
  321. package/lib/support_code_library_builder/world.js +11 -0
  322. package/lib/support_code_library_builder/world.js.map +1 -0
  323. package/lib/time.d.ts +18 -0
  324. package/lib/time.js +61 -0
  325. package/lib/time.js.map +1 -0
  326. package/lib/try_require.d.ts +7 -0
  327. package/lib/try_require.js +26 -0
  328. package/lib/try_require.js.map +1 -0
  329. package/lib/types/index.d.ts +4 -0
  330. package/lib/types/index.js +3 -0
  331. package/lib/types/index.js.map +1 -0
  332. package/lib/uncaught_exception_manager.d.ts +7 -0
  333. package/lib/uncaught_exception_manager.js +12 -0
  334. package/lib/uncaught_exception_manager.js.map +1 -0
  335. package/lib/user_code_runner.d.ts +14 -0
  336. package/lib/user_code_runner.js +82 -0
  337. package/lib/user_code_runner.js.map +1 -0
  338. package/lib/value_checker.d.ts +3 -0
  339. package/lib/value_checker.js +19 -0
  340. package/lib/value_checker.js.map +1 -0
  341. package/lib/version.d.ts +1 -0
  342. package/lib/version.js +6 -0
  343. package/lib/version.js.map +1 -0
  344. package/lib/wrapper.mjs +44 -0
  345. package/package.json +189 -0
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OptionSplitter = void 0;
4
+ exports.OptionSplitter = {
5
+ split(option) {
6
+ option = option.replace(/"/g, '');
7
+ const parts = option.split(/((?:file){0}):(?!\\|\/\/)/);
8
+ const result = parts.reduce((memo, part, i) => {
9
+ if (partNeedsRecombined(i)) {
10
+ memo.push(parts.slice(i, i + 2).join(''));
11
+ }
12
+ return memo;
13
+ }, []);
14
+ if (result.length === 1) {
15
+ result.push('');
16
+ }
17
+ return result;
18
+ },
19
+ };
20
+ function partNeedsRecombined(i) {
21
+ return i % 2 === 0;
22
+ }
23
+ //# sourceMappingURL=option_splitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"option_splitter.js","sourceRoot":"","sources":["../../src/configuration/option_splitter.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,KAAK,CAAC,MAAc;QAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAEjC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAEvD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAc,EAAE,IAAY,EAAE,CAAS,EAAE,EAAE;YACtE,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;gBAC1B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;aAC1C;YAED,OAAO,IAAI,CAAA;QACb,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAChB;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACpB,CAAC","sourcesContent":["export const OptionSplitter = {\n split(option: string): string[] {\n option = option.replace(/\"/g, '')\n\n const parts = option.split(/((?:file){0}):(?!\\\\|\\/\\/)/)\n\n const result = parts.reduce((memo: string[], part: string, i: number) => {\n if (partNeedsRecombined(i)) {\n memo.push(parts.slice(i, i + 2).join(''))\n }\n\n return memo\n }, [])\n\n if (result.length === 1) {\n result.push('')\n }\n\n return result\n },\n}\n\nfunction partNeedsRecombined(i: number): boolean {\n return i % 2 === 0\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import { FormatOptions } from '../formatter';
2
+ import { PickleOrder } from '../models/pickle_order';
3
+ export interface IConfiguration {
4
+ backtrace: boolean;
5
+ dryRun: boolean;
6
+ forceExit: boolean;
7
+ failFast: boolean;
8
+ format: string[];
9
+ formatOptions: FormatOptions;
10
+ import: string[];
11
+ language: string;
12
+ name: string[];
13
+ order: PickleOrder;
14
+ paths: string[];
15
+ parallel: number;
16
+ publish: boolean;
17
+ /**
18
+ * @deprecated no longer needed; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
19
+ */
20
+ publishQuiet: boolean;
21
+ require: string[];
22
+ requireModule: string[];
23
+ retry: number;
24
+ retryTagFilter: string;
25
+ strict: boolean;
26
+ tags: string;
27
+ worldParameters: any;
28
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { FormatOptions } from '../formatter'\nimport { PickleOrder } from '../models/pickle_order'\n\nexport interface IConfiguration {\n backtrace: boolean\n dryRun: boolean\n forceExit: boolean\n failFast: boolean\n format: string[]\n formatOptions: FormatOptions\n import: string[]\n language: string\n name: string[]\n order: PickleOrder\n paths: string[]\n parallel: number\n publish: boolean\n /**\n * @deprecated no longer needed; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\n publishQuiet: boolean\n require: string[]\n requireModule: string[]\n retry: number\n retryTagFilter: string\n strict: boolean\n tags: string\n worldParameters: any\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { IConfiguration } from './types';
2
+ import { ILogger } from '../logger';
3
+ export declare function validateConfiguration(configuration: IConfiguration, logger: ILogger): void;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateConfiguration = void 0;
4
+ function validateConfiguration(configuration, logger) {
5
+ if (configuration.publishQuiet) {
6
+ logger.warn('`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
7
+ }
8
+ if (configuration.retryTagFilter && !configuration.retry) {
9
+ throw new Error('a positive `retry` count must be specified when setting `retryTagFilter`');
10
+ }
11
+ }
12
+ exports.validateConfiguration = validateConfiguration;
13
+ //# sourceMappingURL=validate_configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;AAdD,sDAcC","sourcesContent":["import { IConfiguration } from './types'\nimport { ILogger } from '../logger'\n\nexport function validateConfiguration(\n configuration: IConfiguration,\n logger: ILogger\n): void {\n if (configuration.publishQuiet) {\n logger.warn(\n '`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n )\n }\n if (configuration.retryTagFilter && !configuration.retry) {\n throw new Error(\n 'a positive `retry` count must be specified when setting `retryTagFilter`'\n )\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { StackFrame } from 'error-stack-parser';
2
+ export declare function isFileNameInCucumber(fileName: string): boolean;
3
+ export declare function filterStackTrace(frames: StackFrame[]): StackFrame[];
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.filterStackTrace = exports.isFileNameInCucumber = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const value_checker_1 = require("./value_checker");
9
+ const projectRootPath = path_1.default.join(__dirname, '..');
10
+ const projectChildDirs = ['src', 'lib', 'node_modules'];
11
+ function isFileNameInCucumber(fileName) {
12
+ return projectChildDirs.some((dir) => fileName.startsWith(path_1.default.join(projectRootPath, dir)));
13
+ }
14
+ exports.isFileNameInCucumber = isFileNameInCucumber;
15
+ function filterStackTrace(frames) {
16
+ if (isErrorInCucumber(frames)) {
17
+ return frames;
18
+ }
19
+ const index = frames.findIndex((x) => isFrameInCucumber(x));
20
+ if (index === -1) {
21
+ return frames;
22
+ }
23
+ return frames.slice(0, index);
24
+ }
25
+ exports.filterStackTrace = filterStackTrace;
26
+ function isErrorInCucumber(frames) {
27
+ const filteredFrames = frames.filter((x) => !isFrameInNode(x));
28
+ return filteredFrames.length > 0 && isFrameInCucumber(filteredFrames[0]);
29
+ }
30
+ function isFrameInCucumber(frame) {
31
+ const fileName = (0, value_checker_1.valueOrDefault)(frame.getFileName(), '');
32
+ return isFileNameInCucumber(fileName);
33
+ }
34
+ function isFrameInNode(frame) {
35
+ const fileName = (0, value_checker_1.valueOrDefault)(frame.getFileName(), '');
36
+ return !fileName.includes(path_1.default.sep);
37
+ }
38
+ //# sourceMappingURL=filter_stack_trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter_stack_trace.js","sourceRoot":"","sources":["../src/filter_stack_trace.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,mDAAgD;AAGhD,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAClD,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;AAEvD,SAAgB,oBAAoB,CAAC,QAAgB;IACnD,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CACnC,QAAQ,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CACrD,CAAA;AACH,CAAC;AAJD,oDAIC;AAED,SAAgB,gBAAgB,CAAC,MAAoB;IACnD,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE;QAC7B,OAAO,MAAM,CAAA;KACd;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3D,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,MAAM,CAAA;KACd;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAC/B,CAAC;AATD,4CASC;AAED,SAAS,iBAAiB,CAAC,MAAoB;IAC7C,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9D,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAiB;IAC1C,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AACvC,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,cAAI,CAAC,GAAG,CAAC,CAAA;AACrC,CAAC","sourcesContent":["import path from 'path'\nimport { valueOrDefault } from './value_checker'\nimport { StackFrame } from 'error-stack-parser'\n\nconst projectRootPath = path.join(__dirname, '..')\nconst projectChildDirs = ['src', 'lib', 'node_modules']\n\nexport function isFileNameInCucumber(fileName: string): boolean {\n return projectChildDirs.some((dir) =>\n fileName.startsWith(path.join(projectRootPath, dir))\n )\n}\n\nexport function filterStackTrace(frames: StackFrame[]): StackFrame[] {\n if (isErrorInCucumber(frames)) {\n return frames\n }\n const index = frames.findIndex((x) => isFrameInCucumber(x))\n if (index === -1) {\n return frames\n }\n return frames.slice(0, index)\n}\n\nfunction isErrorInCucumber(frames: StackFrame[]): boolean {\n const filteredFrames = frames.filter((x) => !isFrameInNode(x))\n return filteredFrames.length > 0 && isFrameInCucumber(filteredFrames[0])\n}\n\nfunction isFrameInCucumber(frame: StackFrame): boolean {\n const fileName = valueOrDefault(frame.getFileName(), '')\n return isFileNameInCucumber(fileName)\n}\n\nfunction isFrameInNode(frame: StackFrame): boolean {\n const fileName = valueOrDefault(frame.getFileName(), '')\n return !fileName.includes(path.sep)\n}\n"]}
@@ -0,0 +1,37 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
5
+ import StepDefinitionSnippetBuilder from './step_definition_snippet_builder';
6
+ import { ISupportCodeLibrary } from '../support_code_library_builder/types';
7
+ import Formatter, { FormatOptions, IFormatterCleanupFn, IFormatterLogFn } from '.';
8
+ import { EventEmitter } from 'events';
9
+ import EventDataCollector from './helpers/event_data_collector';
10
+ import { Writable as WritableStream } from 'stream';
11
+ import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax';
12
+ interface IGetStepDefinitionSnippetBuilderOptions {
13
+ cwd: string;
14
+ snippetInterface?: SnippetInterface;
15
+ snippetSyntax?: string;
16
+ supportCodeLibrary: ISupportCodeLibrary;
17
+ }
18
+ export interface IBuildOptions {
19
+ env: NodeJS.ProcessEnv;
20
+ cwd: string;
21
+ eventBroadcaster: EventEmitter;
22
+ eventDataCollector: EventDataCollector;
23
+ log: IFormatterLogFn;
24
+ parsedArgvOptions: FormatOptions;
25
+ stream: WritableStream;
26
+ cleanup: IFormatterCleanupFn;
27
+ supportCodeLibrary: ISupportCodeLibrary;
28
+ }
29
+ declare const FormatterBuilder: {
30
+ build(type: string, options: IBuildOptions): Promise<Formatter>;
31
+ getConstructorByType(type: string, cwd: string): Promise<typeof Formatter>;
32
+ getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }: IGetStepDefinitionSnippetBuilderOptions): Promise<StepDefinitionSnippetBuilder>;
33
+ loadCustomClass(type: 'formatter' | 'syntax', descriptor: string, cwd: string): Promise<any>;
34
+ loadFile(urlOrName: URL | string): Promise<any>;
35
+ resolveConstructor(ImportedCode: any): any;
36
+ };
37
+ export default FormatterBuilder;
@@ -0,0 +1,101 @@
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 get_color_fns_1 = __importDefault(require("./get_color_fns"));
7
+ const javascript_snippet_syntax_1 = __importDefault(require("./step_definition_snippet_builder/javascript_snippet_syntax"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const step_definition_snippet_builder_1 = __importDefault(require("./step_definition_snippet_builder"));
10
+ const value_checker_1 = require("../value_checker");
11
+ const snippet_syntax_1 = require("./step_definition_snippet_builder/snippet_syntax");
12
+ const url_1 = require("url");
13
+ const formatters_1 = __importDefault(require("./helpers/formatters"));
14
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
15
+ const { importer } = require('../importer');
16
+ const FormatterBuilder = {
17
+ async build(type, options) {
18
+ const FormatterConstructor = await FormatterBuilder.getConstructorByType(type, options.cwd);
19
+ const colorFns = (0, get_color_fns_1.default)(options.stream, options.env, options.parsedArgvOptions.colorsEnabled);
20
+ const snippetBuilder = await FormatterBuilder.getStepDefinitionSnippetBuilder({
21
+ cwd: options.cwd,
22
+ snippetInterface: options.parsedArgvOptions.snippetInterface,
23
+ snippetSyntax: options.parsedArgvOptions.snippetSyntax,
24
+ supportCodeLibrary: options.supportCodeLibrary,
25
+ });
26
+ return new FormatterConstructor({
27
+ colorFns,
28
+ snippetBuilder,
29
+ ...options,
30
+ });
31
+ },
32
+ async getConstructorByType(type, cwd) {
33
+ const formatters = formatters_1.default.getFormatters();
34
+ return formatters[type]
35
+ ? formatters[type]
36
+ : await FormatterBuilder.loadCustomClass('formatter', type, cwd);
37
+ },
38
+ async getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }) {
39
+ if ((0, value_checker_1.doesNotHaveValue)(snippetInterface)) {
40
+ snippetInterface = snippet_syntax_1.SnippetInterface.Synchronous;
41
+ }
42
+ let Syntax = javascript_snippet_syntax_1.default;
43
+ if ((0, value_checker_1.doesHaveValue)(snippetSyntax)) {
44
+ Syntax = await FormatterBuilder.loadCustomClass('syntax', snippetSyntax, cwd);
45
+ }
46
+ return new step_definition_snippet_builder_1.default({
47
+ snippetSyntax: new Syntax(snippetInterface),
48
+ parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry,
49
+ });
50
+ },
51
+ async loadCustomClass(type, descriptor, cwd) {
52
+ let normalized = descriptor;
53
+ if (descriptor.startsWith('.')) {
54
+ normalized = (0, url_1.pathToFileURL)(path_1.default.resolve(cwd, descriptor));
55
+ }
56
+ else if (descriptor.startsWith('file://')) {
57
+ normalized = new URL(descriptor);
58
+ }
59
+ let CustomClass = await FormatterBuilder.loadFile(normalized);
60
+ CustomClass = FormatterBuilder.resolveConstructor(CustomClass);
61
+ if ((0, value_checker_1.doesHaveValue)(CustomClass)) {
62
+ return CustomClass;
63
+ }
64
+ else {
65
+ throw new Error(`Custom ${type} (${descriptor}) does not export a function/class`);
66
+ }
67
+ },
68
+ async loadFile(urlOrName) {
69
+ let result;
70
+ try {
71
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
72
+ result = require(typeof urlOrName === 'string'
73
+ ? urlOrName
74
+ : (0, url_1.fileURLToPath)(urlOrName));
75
+ }
76
+ catch (error) {
77
+ if (error.code === 'ERR_REQUIRE_ESM') {
78
+ result = await importer(urlOrName);
79
+ }
80
+ else {
81
+ throw error;
82
+ }
83
+ }
84
+ return result;
85
+ },
86
+ resolveConstructor(ImportedCode) {
87
+ if ((0, value_checker_1.doesNotHaveValue)(ImportedCode)) {
88
+ return null;
89
+ }
90
+ if (typeof ImportedCode === 'function') {
91
+ return ImportedCode;
92
+ }
93
+ else if (typeof ImportedCode === 'object' &&
94
+ typeof ImportedCode.default === 'function') {
95
+ return ImportedCode.default;
96
+ }
97
+ return null;
98
+ },
99
+ };
100
+ exports.default = FormatterBuilder;
101
+ //# sourceMappingURL=builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;AAAA,oEAAyC;AACzC,4HAAiG;AACjG,gDAAuB;AACvB,wGAA4E;AAO5E,oDAAkE;AAIlE,qFAAmF;AACnF,6BAAkD;AAClD,sEAA6C;AAC7C,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OA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C,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE;gBACpC,MAAM,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,CAAA;aACnC;iBAAM;gBACL,MAAM,KAAK,CAAA;aACZ;SACF;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED,kBAAkB,CAAC,YAAiB;QAClC,IAAI,IAAA,gCAAgB,EAAC,YAAY,CAAC,EAAE;YAClC,OAAO,IAAI,CAAA;SACZ;QACD,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;YACtC,OAAO,YAAY,CAAA;SACpB;aAAM,IACL,OAAO,YAAY,KAAK,QAAQ;YAChC,OAAO,YAAY,CAAC,OAAO,KAAK,UAAU,EAC1C;YACA,OAAO,YAAY,CAAC,OAAO,CAAA;SAC5B;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AAED,kBAAe,gBAAgB,CAAA","sourcesContent":["import getColorFns from './get_color_fns'\nimport JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax'\nimport path from 'path'\nimport StepDefinitionSnippetBuilder from './step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport Formatter, {\n FormatOptions,\n IFormatterCleanupFn,\n IFormatterLogFn,\n} from '.'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport { EventEmitter } from 'events'\nimport EventDataCollector from './helpers/event_data_collector'\nimport { Writable as WritableStream } from 'stream'\nimport { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'\nimport { fileURLToPath, pathToFileURL } from 'url'\nimport Formatters from './helpers/formatters'\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\n\ninterface IGetStepDefinitionSnippetBuilderOptions {\n cwd: string\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport interface IBuildOptions {\n env: NodeJS.ProcessEnv\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n log: IFormatterLogFn\n parsedArgvOptions: FormatOptions\n stream: WritableStream\n cleanup: IFormatterCleanupFn\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nconst FormatterBuilder = {\n async build(type: string, options: IBuildOptions): Promise<Formatter> {\n const FormatterConstructor = await FormatterBuilder.getConstructorByType(\n type,\n options.cwd\n )\n const colorFns = getColorFns(\n options.stream,\n options.env,\n options.parsedArgvOptions.colorsEnabled\n )\n const snippetBuilder =\n await FormatterBuilder.getStepDefinitionSnippetBuilder({\n cwd: options.cwd,\n snippetInterface: options.parsedArgvOptions.snippetInterface,\n snippetSyntax: options.parsedArgvOptions.snippetSyntax,\n supportCodeLibrary: options.supportCodeLibrary,\n })\n return new FormatterConstructor({\n colorFns,\n snippetBuilder,\n ...options,\n })\n },\n\n async getConstructorByType(\n type: string,\n cwd: string\n ): Promise<typeof Formatter> {\n const formatters: Record<string, typeof Formatter> =\n Formatters.getFormatters()\n\n return formatters[type]\n ? formatters[type]\n : await FormatterBuilder.loadCustomClass('formatter', type, cwd)\n },\n\n async getStepDefinitionSnippetBuilder({\n cwd,\n snippetInterface,\n snippetSyntax,\n supportCodeLibrary,\n }: IGetStepDefinitionSnippetBuilderOptions) {\n if (doesNotHaveValue(snippetInterface)) {\n snippetInterface = SnippetInterface.Synchronous\n }\n let Syntax = JavascriptSnippetSyntax\n if (doesHaveValue(snippetSyntax)) {\n Syntax = await FormatterBuilder.loadCustomClass(\n 'syntax',\n snippetSyntax,\n cwd\n )\n }\n return new StepDefinitionSnippetBuilder({\n snippetSyntax: new Syntax(snippetInterface),\n parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry,\n })\n },\n\n async loadCustomClass(\n type: 'formatter' | 'syntax',\n descriptor: string,\n cwd: string\n ) {\n let normalized: URL | string = descriptor\n if (descriptor.startsWith('.')) {\n normalized = pathToFileURL(path.resolve(cwd, descriptor))\n } else if (descriptor.startsWith('file://')) {\n normalized = new URL(descriptor)\n }\n let CustomClass = await FormatterBuilder.loadFile(normalized)\n CustomClass = FormatterBuilder.resolveConstructor(CustomClass)\n if (doesHaveValue(CustomClass)) {\n return CustomClass\n } else {\n throw new Error(\n `Custom ${type} (${descriptor}) does not export a function/class`\n )\n }\n },\n\n async loadFile(urlOrName: URL | string) {\n let result\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n result = require(typeof urlOrName === 'string'\n ? urlOrName\n : fileURLToPath(urlOrName))\n } catch (error) {\n if (error.code === 'ERR_REQUIRE_ESM') {\n result = await importer(urlOrName)\n } else {\n throw error\n }\n }\n return result\n },\n\n resolveConstructor(ImportedCode: any) {\n if (doesNotHaveValue(ImportedCode)) {\n return null\n }\n if (typeof ImportedCode === 'function') {\n return ImportedCode\n } else if (\n typeof ImportedCode === 'object' &&\n typeof ImportedCode.default === 'function'\n ) {\n return ImportedCode.default\n }\n return null\n },\n}\n\nexport default FormatterBuilder\n"]}
@@ -0,0 +1,2 @@
1
+ export default class Formatter {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Formatter {
4
+ }
5
+ exports.default = Formatter;
6
+ //# sourceMappingURL=typescript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/formatter/fixtures/typescript.ts"],"names":[],"mappings":";;AAAA,MAAqB,SAAS;CAAG;AAAjC,4BAAiC","sourcesContent":["export default class Formatter {}\n"]}
@@ -0,0 +1,15 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { TestStepResultStatus } from '@cucumber/messages';
4
+ import { Writable } from 'stream';
5
+ export type IColorFn = (text: string) => string;
6
+ export interface IColorFns {
7
+ forStatus: (status: TestStepResultStatus) => IColorFn;
8
+ location: IColorFn;
9
+ tag: IColorFn;
10
+ diffAdded: IColorFn;
11
+ diffRemoved: IColorFn;
12
+ errorMessage: IColorFn;
13
+ errorStack: IColorFn;
14
+ }
15
+ export default function getColorFns(stream: Writable, env: NodeJS.ProcessEnv, enabled?: boolean): IColorFns;
@@ -0,0 +1,56 @@
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 chalk_1 = __importDefault(require("chalk"));
7
+ const supports_color_1 = require("supports-color");
8
+ const value_checker_1 = require("../value_checker");
9
+ function getColorFns(stream, env, enabled) {
10
+ const support = detectSupport(stream, env, enabled);
11
+ if (support) {
12
+ const chalkInstance = new chalk_1.default.Instance(support);
13
+ return {
14
+ forStatus(status) {
15
+ return {
16
+ AMBIGUOUS: chalkInstance.red.bind(chalk_1.default),
17
+ FAILED: chalkInstance.red.bind(chalk_1.default),
18
+ PASSED: chalkInstance.green.bind(chalk_1.default),
19
+ PENDING: chalkInstance.yellow.bind(chalk_1.default),
20
+ SKIPPED: chalkInstance.cyan.bind(chalk_1.default),
21
+ UNDEFINED: chalkInstance.yellow.bind(chalk_1.default),
22
+ UNKNOWN: chalkInstance.yellow.bind(chalk_1.default),
23
+ }[status];
24
+ },
25
+ location: chalkInstance.gray.bind(chalk_1.default),
26
+ tag: chalkInstance.cyan.bind(chalk_1.default),
27
+ diffAdded: chalkInstance.green.bind(chalk_1.default),
28
+ diffRemoved: chalkInstance.red.bind(chalk_1.default),
29
+ errorMessage: chalkInstance.red.bind(chalk_1.default),
30
+ errorStack: chalkInstance.grey.bind(chalk_1.default),
31
+ };
32
+ }
33
+ else {
34
+ return {
35
+ forStatus(_status) {
36
+ return (x) => x;
37
+ },
38
+ location: (x) => x,
39
+ tag: (x) => x,
40
+ diffAdded: (x) => x,
41
+ diffRemoved: (x) => x,
42
+ errorMessage: (x) => x,
43
+ errorStack: (x) => x,
44
+ };
45
+ }
46
+ }
47
+ exports.default = getColorFns;
48
+ function detectSupport(stream, env, enabled) {
49
+ const support = (0, supports_color_1.supportsColor)(stream);
50
+ // if we find FORCE_COLOR, we can let the supports-color library handle that
51
+ if ('FORCE_COLOR' in env || (0, value_checker_1.doesNotHaveValue)(enabled)) {
52
+ return support;
53
+ }
54
+ return enabled ? support || { level: 1 } : false;
55
+ }
56
+ //# sourceMappingURL=get_color_fns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,mDAAyD;AAGzD,oDAAmD;AAcnD,SAAwB,WAAW,CACjC,MAAgB,EAChB,GAAsB,EACtB,OAAiB;IAEjB,MAAM,OAAO,GAAc,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;IAC9D,IAAI,OAAO,EAAE;QACX,MAAM,aAAa,GAAG,IAAI,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACjD,OAAO;YACL,SAAS,CAAC,MAA4B;gBACpC,OAAO;oBACL,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;oBACxC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;oBACrC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,eAAK,CAAC;oBACvC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;oBACzC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;oBACvC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;oBAC3C,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;iBAC1C,CAAC,MAAM,CAAC,CAAA;YACX,CAAC;YACD,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;YACxC,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;YACnC,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,eAAK,CAAC;YAC1C,WAAW,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;YAC1C,YAAY,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;YAC3C,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;SAC3C,CAAA;KACF;SAAM;QACL,OAAO;YACL,SAAS,CAAC,OAA6B;gBACrC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;YACjB,CAAC;YACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAClB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACb,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACrB,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtB,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACrB,CAAA;KACF;AACH,CAAC;AAxCD,8BAwCC;AAED,SAAS,aAAa,CACpB,MAAgB,EAChB,GAAsB,EACtB,OAAiB;IAEjB,MAAM,OAAO,GAAc,IAAA,8BAAa,EAAC,MAAM,CAAC,CAAA;IAChD,4EAA4E;IAC5E,IAAI,aAAa,IAAI,GAAG,IAAI,IAAA,gCAAgB,EAAC,OAAO,CAAC,EAAE;QACrD,OAAO,OAAO,CAAA;KACf;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;AAClD,CAAC","sourcesContent":["import chalk from 'chalk'\nimport { ColorInfo, supportsColor } from 'supports-color'\nimport { TestStepResultStatus } from '@cucumber/messages'\nimport { Writable } from 'stream'\nimport { doesNotHaveValue } from '../value_checker'\n\nexport type IColorFn = (text: string) => string\n\nexport interface IColorFns {\n forStatus: (status: TestStepResultStatus) => IColorFn\n location: IColorFn\n tag: IColorFn\n diffAdded: IColorFn\n diffRemoved: IColorFn\n errorMessage: IColorFn\n errorStack: IColorFn\n}\n\nexport default function getColorFns(\n stream: Writable,\n env: NodeJS.ProcessEnv,\n enabled?: boolean\n): IColorFns {\n const support: ColorInfo = detectSupport(stream, env, enabled)\n if (support) {\n const chalkInstance = new chalk.Instance(support)\n return {\n forStatus(status: TestStepResultStatus) {\n return {\n AMBIGUOUS: chalkInstance.red.bind(chalk),\n FAILED: chalkInstance.red.bind(chalk),\n PASSED: chalkInstance.green.bind(chalk),\n PENDING: chalkInstance.yellow.bind(chalk),\n SKIPPED: chalkInstance.cyan.bind(chalk),\n UNDEFINED: chalkInstance.yellow.bind(chalk),\n UNKNOWN: chalkInstance.yellow.bind(chalk),\n }[status]\n },\n location: chalkInstance.gray.bind(chalk),\n tag: chalkInstance.cyan.bind(chalk),\n diffAdded: chalkInstance.green.bind(chalk),\n diffRemoved: chalkInstance.red.bind(chalk),\n errorMessage: chalkInstance.red.bind(chalk),\n errorStack: chalkInstance.grey.bind(chalk),\n }\n } else {\n return {\n forStatus(_status: TestStepResultStatus) {\n return (x) => x\n },\n location: (x) => x,\n tag: (x) => x,\n diffAdded: (x) => x,\n diffRemoved: (x) => x,\n errorMessage: (x) => x,\n errorStack: (x) => x,\n }\n }\n}\n\nfunction detectSupport(\n stream: Writable,\n env: NodeJS.ProcessEnv,\n enabled?: boolean\n): ColorInfo {\n const support: ColorInfo = supportsColor(stream)\n // if we find FORCE_COLOR, we can let the supports-color library handle that\n if ('FORCE_COLOR' in env || doesNotHaveValue(enabled)) {\n return support\n }\n return enabled ? support || { level: 1 } : false\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { Duration } from '@cucumber/messages';
2
+ export declare function durationToNanoseconds(duration: Duration): number;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.durationToNanoseconds = void 0;
4
+ const NANOS_IN_SECOND = 1000000000;
5
+ function durationToNanoseconds(duration) {
6
+ return Math.floor(duration.seconds * NANOS_IN_SECOND + duration.nanos);
7
+ }
8
+ exports.durationToNanoseconds = durationToNanoseconds;
9
+ //# sourceMappingURL=duration_helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/duration_helpers.ts"],"names":[],"mappings":";;;AAEA,MAAM,eAAe,GAAG,UAAa,CAAA;AAErC,SAAgB,qBAAqB,CAAC,QAAkB;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;AACxE,CAAC;AAFD,sDAEC","sourcesContent":["import { Duration } from '@cucumber/messages'\n\nconst NANOS_IN_SECOND = 1_000_000_000\n\nexport function durationToNanoseconds(duration: Duration): number {\n return Math.floor(duration.seconds * NANOS_IN_SECOND + duration.nanos)\n}\n"]}
@@ -0,0 +1,30 @@
1
+ /// <reference types="node" />
2
+ import * as messages from '@cucumber/messages';
3
+ import { EventEmitter } from 'events';
4
+ export interface ITestCaseAttempt {
5
+ attempt: number;
6
+ willBeRetried: boolean;
7
+ gherkinDocument: messages.GherkinDocument;
8
+ pickle: messages.Pickle;
9
+ stepAttachments: Record<string, messages.Attachment[]>;
10
+ stepResults: Record<string, messages.TestStepResult>;
11
+ testCase: messages.TestCase;
12
+ worstTestStepResult: messages.TestStepResult;
13
+ }
14
+ export default class EventDataCollector {
15
+ private gherkinDocumentMap;
16
+ private pickleMap;
17
+ private testCaseMap;
18
+ private testCaseAttemptDataMap;
19
+ readonly undefinedParameterTypes: messages.UndefinedParameterType[];
20
+ constructor(eventBroadcaster: EventEmitter);
21
+ getGherkinDocument(uri: string): messages.GherkinDocument;
22
+ getPickle(pickleId: string): messages.Pickle;
23
+ getTestCaseAttempts(): ITestCaseAttempt[];
24
+ getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt;
25
+ parseEnvelope(envelope: messages.Envelope): void;
26
+ private initTestCaseAttempt;
27
+ storeAttachment(attachment: messages.Attachment): void;
28
+ storeTestStepResult({ testCaseStartedId, testStepId, testStepResult, }: messages.TestStepFinished): void;
29
+ storeTestCaseResult({ testCaseStartedId, willBeRetried, }: messages.TestCaseFinished): void;
30
+ }
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const messages = __importStar(require("@cucumber/messages"));
27
+ const value_checker_1 = require("../../value_checker");
28
+ class EventDataCollector {
29
+ constructor(eventBroadcaster) {
30
+ this.gherkinDocumentMap = {};
31
+ this.pickleMap = {};
32
+ this.testCaseMap = {};
33
+ this.testCaseAttemptDataMap = {};
34
+ this.undefinedParameterTypes = [];
35
+ eventBroadcaster.on('envelope', this.parseEnvelope.bind(this));
36
+ }
37
+ getGherkinDocument(uri) {
38
+ return this.gherkinDocumentMap[uri];
39
+ }
40
+ getPickle(pickleId) {
41
+ return this.pickleMap[pickleId];
42
+ }
43
+ getTestCaseAttempts() {
44
+ return Object.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {
45
+ return this.getTestCaseAttempt(testCaseStartedId);
46
+ });
47
+ }
48
+ getTestCaseAttempt(testCaseStartedId) {
49
+ const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId];
50
+ const testCase = this.testCaseMap[testCaseAttemptData.testCaseId];
51
+ const pickle = this.pickleMap[testCase.pickleId];
52
+ return {
53
+ gherkinDocument: this.gherkinDocumentMap[pickle.uri],
54
+ pickle,
55
+ testCase,
56
+ attempt: testCaseAttemptData.attempt,
57
+ willBeRetried: testCaseAttemptData.willBeRetried,
58
+ stepAttachments: testCaseAttemptData.stepAttachments,
59
+ stepResults: testCaseAttemptData.stepResults,
60
+ worstTestStepResult: testCaseAttemptData.worstTestStepResult,
61
+ };
62
+ }
63
+ parseEnvelope(envelope) {
64
+ if ((0, value_checker_1.doesHaveValue)(envelope.gherkinDocument)) {
65
+ this.gherkinDocumentMap[envelope.gherkinDocument.uri] =
66
+ envelope.gherkinDocument;
67
+ }
68
+ else if ((0, value_checker_1.doesHaveValue)(envelope.pickle)) {
69
+ this.pickleMap[envelope.pickle.id] = envelope.pickle;
70
+ }
71
+ else if ((0, value_checker_1.doesHaveValue)(envelope.undefinedParameterType)) {
72
+ this.undefinedParameterTypes.push(envelope.undefinedParameterType);
73
+ }
74
+ else if ((0, value_checker_1.doesHaveValue)(envelope.testCase)) {
75
+ this.testCaseMap[envelope.testCase.id] = envelope.testCase;
76
+ }
77
+ else if ((0, value_checker_1.doesHaveValue)(envelope.testCaseStarted)) {
78
+ this.initTestCaseAttempt(envelope.testCaseStarted);
79
+ }
80
+ else if ((0, value_checker_1.doesHaveValue)(envelope.attachment)) {
81
+ this.storeAttachment(envelope.attachment);
82
+ }
83
+ else if ((0, value_checker_1.doesHaveValue)(envelope.testStepFinished)) {
84
+ this.storeTestStepResult(envelope.testStepFinished);
85
+ }
86
+ else if ((0, value_checker_1.doesHaveValue)(envelope.testCaseFinished)) {
87
+ this.storeTestCaseResult(envelope.testCaseFinished);
88
+ }
89
+ }
90
+ initTestCaseAttempt(testCaseStarted) {
91
+ this.testCaseAttemptDataMap[testCaseStarted.id] = {
92
+ attempt: testCaseStarted.attempt,
93
+ willBeRetried: false,
94
+ testCaseId: testCaseStarted.testCaseId,
95
+ stepAttachments: {},
96
+ stepResults: {},
97
+ worstTestStepResult: {
98
+ duration: { seconds: 0, nanos: 0 },
99
+ status: messages.TestStepResultStatus.UNKNOWN,
100
+ },
101
+ };
102
+ }
103
+ storeAttachment(attachment) {
104
+ const { testCaseStartedId, testStepId } = attachment;
105
+ // TODO: we shouldn't have to check if these properties have values - they are non-nullable
106
+ if ((0, value_checker_1.doesHaveValue)(testCaseStartedId) && (0, value_checker_1.doesHaveValue)(testStepId)) {
107
+ const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId];
108
+ if ((0, value_checker_1.doesNotHaveValue)(stepAttachments[testStepId])) {
109
+ stepAttachments[testStepId] = [];
110
+ }
111
+ stepAttachments[testStepId].push(attachment);
112
+ }
113
+ }
114
+ storeTestStepResult({ testCaseStartedId, testStepId, testStepResult, }) {
115
+ this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =
116
+ testStepResult;
117
+ }
118
+ storeTestCaseResult({ testCaseStartedId, willBeRetried, }) {
119
+ const stepResults = Object.values(this.testCaseAttemptDataMap[testCaseStartedId].stepResults);
120
+ this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =
121
+ messages.getWorstTestStepResult(stepResults);
122
+ this.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried;
123
+ }
124
+ }
125
+ exports.default = EventDataCollector;
126
+ //# sourceMappingURL=event_data_collector.js.map
@@ -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B,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC;YACpE,cAAc,CAAA;IAClB,CAAC;IAED,mBAAmB,CAAC,EAClB,iBAAiB,EACjB,aAAa,GACa;QAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAC/B,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAC3D,CAAA;QACD,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,mBAAmB;YAChE,QAAQ,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAA;QAC9C,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,aAAa,GAAG,aAAa,CAAA;IAC9E,CAAC;CACF;AA5GD,qCA4GC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\nimport { EventEmitter } from 'events'\n\ninterface ITestCaseAttemptData {\n attempt: number\n willBeRetried: boolean\n testCaseId: string\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n worstTestStepResult: messages.TestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n willBeRetried: boolean\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n testCase: messages.TestCase\n worstTestStepResult: messages.TestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Record<string, messages.GherkinDocument> = {}\n private pickleMap: Record<string, messages.Pickle> = {}\n private testCaseMap: Record<string, messages.TestCase> = {}\n private testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.UndefinedParameterType[] = []\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.GherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.Pickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return Object.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n willBeRetried: testCaseAttemptData.willBeRetried,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n private initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n willBeRetried: false,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {\n duration: { seconds: 0, nanos: 0 },\n status: messages.TestStepResultStatus.UNKNOWN,\n },\n }\n }\n\n storeAttachment(attachment: messages.Attachment): void {\n const { testCaseStartedId, testStepId } = attachment\n // TODO: we shouldn't have to check if these properties have values - they are non-nullable\n if (doesHaveValue(testCaseStartedId) && doesHaveValue(testStepId)) {\n const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId]\n if (doesNotHaveValue(stepAttachments[testStepId])) {\n stepAttachments[testStepId] = []\n }\n stepAttachments[testStepId].push(attachment)\n }\n }\n\n storeTestStepResult({\n testCaseStartedId,\n testStepId,\n testStepResult,\n }: messages.TestStepFinished): void {\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =\n testStepResult\n }\n\n storeTestCaseResult({\n testCaseStartedId,\n willBeRetried,\n }: messages.TestCaseFinished): void {\n const stepResults = Object.values(\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults\n )\n this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =\n messages.getWorstTestStepResult(stepResults)\n this.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import Formatter from '../.';
2
+ declare const Formatters: {
3
+ getFormatters(): Record<string, typeof Formatter>;
4
+ buildFormattersDocumentationString(): string;
5
+ };
6
+ export default Formatters;