@dev-blinq/cucumber-js 1.0.0-amdocs

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 (371) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +68 -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/bin/cucumber.ts +2 -0
  7. package/bin/download-install.js +167 -0
  8. package/lib/api/console_logger.d.ts +12 -0
  9. package/lib/api/console_logger.js +24 -0
  10. package/lib/api/console_logger.js.map +1 -0
  11. package/lib/api/convert_configuration.d.ts +4 -0
  12. package/lib/api/convert_configuration.js +66 -0
  13. package/lib/api/convert_configuration.js.map +1 -0
  14. package/lib/api/environment.d.ts +2 -0
  15. package/lib/api/environment.js +14 -0
  16. package/lib/api/environment.js.map +1 -0
  17. package/lib/api/formatters.d.ts +20 -0
  18. package/lib/api/formatters.js +61 -0
  19. package/lib/api/formatters.js.map +1 -0
  20. package/lib/api/gherkin.d.ts +21 -0
  21. package/lib/api/gherkin.js +146 -0
  22. package/lib/api/gherkin.js.map +1 -0
  23. package/lib/api/index.d.ts +12 -0
  24. package/lib/api/index.js +28 -0
  25. package/lib/api/index.js.map +1 -0
  26. package/lib/api/load_configuration.d.ts +9 -0
  27. package/lib/api/load_configuration.js +41 -0
  28. package/lib/api/load_configuration.js.map +1 -0
  29. package/lib/api/load_sources.d.ts +9 -0
  30. package/lib/api/load_sources.js +53 -0
  31. package/lib/api/load_sources.js.map +1 -0
  32. package/lib/api/load_support.d.ts +10 -0
  33. package/lib/api/load_support.js +30 -0
  34. package/lib/api/load_support.js.map +1 -0
  35. package/lib/api/paths.d.ts +8 -0
  36. package/lib/api/paths.js +102 -0
  37. package/lib/api/paths.js.map +1 -0
  38. package/lib/api/plugins.d.ts +4 -0
  39. package/lib/api/plugins.js +19 -0
  40. package/lib/api/plugins.js.map +1 -0
  41. package/lib/api/run_cucumber.d.ts +11 -0
  42. package/lib/api/run_cucumber.js +115 -0
  43. package/lib/api/run_cucumber.js.map +1 -0
  44. package/lib/api/runtime.d.ts +21 -0
  45. package/lib/api/runtime.js +36 -0
  46. package/lib/api/runtime.js.map +1 -0
  47. package/lib/api/support.d.ts +9 -0
  48. package/lib/api/support.js +26 -0
  49. package/lib/api/support.js.map +1 -0
  50. package/lib/api/test_helpers.d.ts +3 -0
  51. package/lib/api/test_helpers.js +36 -0
  52. package/lib/api/test_helpers.js.map +1 -0
  53. package/lib/api/types.d.ts +177 -0
  54. package/lib/api/types.js +3 -0
  55. package/lib/api/types.js.map +1 -0
  56. package/lib/api/wrapper.mjs +6 -0
  57. package/lib/cli/helpers.d.ts +39 -0
  58. package/lib/cli/helpers.js +224 -0
  59. package/lib/cli/helpers.js.map +1 -0
  60. package/lib/cli/i18n.d.ts +2 -0
  61. package/lib/cli/i18n.js +70 -0
  62. package/lib/cli/i18n.js.map +1 -0
  63. package/lib/cli/index.d.ts +21 -0
  64. package/lib/cli/index.js +64 -0
  65. package/lib/cli/index.js.map +1 -0
  66. package/lib/cli/install_validator.d.ts +1 -0
  67. package/lib/cli/install_validator.js +18 -0
  68. package/lib/cli/install_validator.js.map +1 -0
  69. package/lib/cli/run.d.ts +1 -0
  70. package/lib/cli/run.js +44 -0
  71. package/lib/cli/run.js.map +1 -0
  72. package/lib/cli/validate_node_engine_version.d.ts +10 -0
  73. package/lib/cli/validate_node_engine_version.js +24 -0
  74. package/lib/cli/validate_node_engine_version.js.map +1 -0
  75. package/lib/configuration/argv_parser.d.ts +20 -0
  76. package/lib/configuration/argv_parser.js +104 -0
  77. package/lib/configuration/argv_parser.js.map +1 -0
  78. package/lib/configuration/axios_client.d.ts +1 -0
  79. package/lib/configuration/axios_client.js +40 -0
  80. package/lib/configuration/axios_client.js.map +1 -0
  81. package/lib/configuration/check_schema.d.ts +2 -0
  82. package/lib/configuration/check_schema.js +60 -0
  83. package/lib/configuration/check_schema.js.map +1 -0
  84. package/lib/configuration/default_configuration.d.ts +2 -0
  85. package/lib/configuration/default_configuration.js +29 -0
  86. package/lib/configuration/default_configuration.js.map +1 -0
  87. package/lib/configuration/from_file.d.ts +3 -0
  88. package/lib/configuration/from_file.js +85 -0
  89. package/lib/configuration/from_file.js.map +1 -0
  90. package/lib/configuration/helpers.d.ts +1 -0
  91. package/lib/configuration/helpers.js +11 -0
  92. package/lib/configuration/helpers.js.map +1 -0
  93. package/lib/configuration/index.d.ts +7 -0
  94. package/lib/configuration/index.js +29 -0
  95. package/lib/configuration/index.js.map +1 -0
  96. package/lib/configuration/locate_file.d.ts +1 -0
  97. package/lib/configuration/locate_file.js +21 -0
  98. package/lib/configuration/locate_file.js.map +1 -0
  99. package/lib/configuration/merge_configurations.d.ts +2 -0
  100. package/lib/configuration/merge_configurations.js +48 -0
  101. package/lib/configuration/merge_configurations.js.map +1 -0
  102. package/lib/configuration/option_splitter.d.ts +3 -0
  103. package/lib/configuration/option_splitter.js +23 -0
  104. package/lib/configuration/option_splitter.js.map +1 -0
  105. package/lib/configuration/types.d.ts +30 -0
  106. package/lib/configuration/types.js +3 -0
  107. package/lib/configuration/types.js.map +1 -0
  108. package/lib/configuration/validate_configuration.d.ts +3 -0
  109. package/lib/configuration/validate_configuration.js +13 -0
  110. package/lib/configuration/validate_configuration.js.map +1 -0
  111. package/lib/filter_stack_trace.d.ts +3 -0
  112. package/lib/filter_stack_trace.js +38 -0
  113. package/lib/filter_stack_trace.js.map +1 -0
  114. package/lib/formatter/api.d.ts +2 -0
  115. package/lib/formatter/api.js +53 -0
  116. package/lib/formatter/api.js.map +1 -0
  117. package/lib/formatter/builder.d.ts +37 -0
  118. package/lib/formatter/builder.js +101 -0
  119. package/lib/formatter/builder.js.map +1 -0
  120. package/lib/formatter/bvt_analysis_formatter.d.ts +30 -0
  121. package/lib/formatter/bvt_analysis_formatter.js +334 -0
  122. package/lib/formatter/bvt_analysis_formatter.js.map +1 -0
  123. package/lib/formatter/feature_data_format.d.ts +23 -0
  124. package/lib/formatter/feature_data_format.js +182 -0
  125. package/lib/formatter/feature_data_format.js.map +1 -0
  126. package/lib/formatter/fixtures/typescript.d.ts +2 -0
  127. package/lib/formatter/fixtures/typescript.js +6 -0
  128. package/lib/formatter/fixtures/typescript.js.map +1 -0
  129. package/lib/formatter/get_color_fns.d.ts +15 -0
  130. package/lib/formatter/get_color_fns.js +56 -0
  131. package/lib/formatter/get_color_fns.js.map +1 -0
  132. package/lib/formatter/helpers/constants.d.ts +44 -0
  133. package/lib/formatter/helpers/constants.js +50 -0
  134. package/lib/formatter/helpers/constants.js.map +1 -0
  135. package/lib/formatter/helpers/duration_helpers.d.ts +2 -0
  136. package/lib/formatter/helpers/duration_helpers.js +9 -0
  137. package/lib/formatter/helpers/duration_helpers.js.map +1 -0
  138. package/lib/formatter/helpers/event_data_collector.d.ts +30 -0
  139. package/lib/formatter/helpers/event_data_collector.js +126 -0
  140. package/lib/formatter/helpers/event_data_collector.js.map +1 -0
  141. package/lib/formatter/helpers/formatters.d.ts +6 -0
  142. package/lib/formatter/helpers/formatters.js +45 -0
  143. package/lib/formatter/helpers/formatters.js.map +1 -0
  144. package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -0
  145. package/lib/formatter/helpers/gherkin_document_parser.js +66 -0
  146. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -0
  147. package/lib/formatter/helpers/index.d.ts +10 -0
  148. package/lib/formatter/helpers/index.js +52 -0
  149. package/lib/formatter/helpers/index.js.map +1 -0
  150. package/lib/formatter/helpers/issue_helpers.d.ts +19 -0
  151. package/lib/formatter/helpers/issue_helpers.js +59 -0
  152. package/lib/formatter/helpers/issue_helpers.js.map +1 -0
  153. package/lib/formatter/helpers/keyword_type.d.ts +11 -0
  154. package/lib/formatter/helpers/keyword_type.js +32 -0
  155. package/lib/formatter/helpers/keyword_type.js.map +1 -0
  156. package/lib/formatter/helpers/location_helpers.d.ts +2 -0
  157. package/lib/formatter/helpers/location_helpers.js +17 -0
  158. package/lib/formatter/helpers/location_helpers.js.map +1 -0
  159. package/lib/formatter/helpers/pickle_parser.d.ts +17 -0
  160. package/lib/formatter/helpers/pickle_parser.js +28 -0
  161. package/lib/formatter/helpers/pickle_parser.js.map +1 -0
  162. package/lib/formatter/helpers/report_generator.d.ts +148 -0
  163. package/lib/formatter/helpers/report_generator.js +573 -0
  164. package/lib/formatter/helpers/report_generator.js.map +1 -0
  165. package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -0
  166. package/lib/formatter/helpers/step_argument_formatter.js +48 -0
  167. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -0
  168. package/lib/formatter/helpers/summary_helpers.d.ts +9 -0
  169. package/lib/formatter/helpers/summary_helpers.js +96 -0
  170. package/lib/formatter/helpers/summary_helpers.js.map +1 -0
  171. package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +12 -0
  172. package/lib/formatter/helpers/test_case_attempt_formatter.js +114 -0
  173. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -0
  174. package/lib/formatter/helpers/test_case_attempt_parser.d.ts +32 -0
  175. package/lib/formatter/helpers/test_case_attempt_parser.js +135 -0
  176. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -0
  177. package/lib/formatter/helpers/upload_serivce.d.ts +26 -0
  178. package/lib/formatter/helpers/upload_serivce.js +237 -0
  179. package/lib/formatter/helpers/upload_serivce.js.map +1 -0
  180. package/lib/formatter/helpers/uploader.d.ts +12 -0
  181. package/lib/formatter/helpers/uploader.js +151 -0
  182. package/lib/formatter/helpers/uploader.js.map +1 -0
  183. package/lib/formatter/helpers/usage_helpers/index.d.ts +23 -0
  184. package/lib/formatter/helpers/usage_helpers/index.js +111 -0
  185. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -0
  186. package/lib/formatter/html_formatter.d.ts +7 -0
  187. package/lib/formatter/html_formatter.js +30 -0
  188. package/lib/formatter/html_formatter.js.map +1 -0
  189. package/lib/formatter/index.d.ts +53 -0
  190. package/lib/formatter/index.js +21 -0
  191. package/lib/formatter/index.js.map +1 -0
  192. package/lib/formatter/json_formatter.d.ts +78 -0
  193. package/lib/formatter/json_formatter.js +230 -0
  194. package/lib/formatter/json_formatter.js.map +1 -0
  195. package/lib/formatter/junit_formatter.d.ts +17 -0
  196. package/lib/formatter/junit_formatter.js +181 -0
  197. package/lib/formatter/junit_formatter.js.map +1 -0
  198. package/lib/formatter/message_formatter.d.ts +5 -0
  199. package/lib/formatter/message_formatter.js +15 -0
  200. package/lib/formatter/message_formatter.js.map +1 -0
  201. package/lib/formatter/progress_bar_formatter.d.ts +18 -0
  202. package/lib/formatter/progress_bar_formatter.js +99 -0
  203. package/lib/formatter/progress_bar_formatter.js.map +1 -0
  204. package/lib/formatter/progress_formatter.d.ts +9 -0
  205. package/lib/formatter/progress_formatter.js +59 -0
  206. package/lib/formatter/progress_formatter.js.map +1 -0
  207. package/lib/formatter/rerun_formatter.d.ts +13 -0
  208. package/lib/formatter/rerun_formatter.js +80 -0
  209. package/lib/formatter/rerun_formatter.js.map +1 -0
  210. package/lib/formatter/snippets_formatter.d.ts +6 -0
  211. package/lib/formatter/snippets_formatter.js +61 -0
  212. package/lib/formatter/snippets_formatter.js.map +1 -0
  213. package/lib/formatter/step_definition_snippet_builder/index.d.ts +20 -0
  214. package/lib/formatter/step_definition_snippet_builder/index.js +46 -0
  215. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -0
  216. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +7 -0
  217. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +46 -0
  218. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -0
  219. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +16 -0
  220. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +11 -0
  221. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -0
  222. package/lib/formatter/summary_formatter.d.ts +14 -0
  223. package/lib/formatter/summary_formatter.js +68 -0
  224. package/lib/formatter/summary_formatter.js.map +1 -0
  225. package/lib/formatter/usage_formatter.d.ts +6 -0
  226. package/lib/formatter/usage_formatter.js +98 -0
  227. package/lib/formatter/usage_formatter.js.map +1 -0
  228. package/lib/formatter/usage_json_formatter.d.ts +7 -0
  229. package/lib/formatter/usage_json_formatter.js +34 -0
  230. package/lib/formatter/usage_json_formatter.js.map +1 -0
  231. package/lib/importer.js +13 -0
  232. package/lib/index.d.ts +58 -0
  233. package/lib/index.js +109 -0
  234. package/lib/index.js.map +1 -0
  235. package/lib/logger.d.ts +5 -0
  236. package/lib/logger.js +3 -0
  237. package/lib/logger.js.map +1 -0
  238. package/lib/models/data_table.d.ts +10 -0
  239. package/lib/models/data_table.js +46 -0
  240. package/lib/models/data_table.js.map +1 -0
  241. package/lib/models/definition.d.ts +55 -0
  242. package/lib/models/definition.js +22 -0
  243. package/lib/models/definition.js.map +1 -0
  244. package/lib/models/gherkin_step_keyword.d.ts +1 -0
  245. package/lib/models/gherkin_step_keyword.js +3 -0
  246. package/lib/models/gherkin_step_keyword.js.map +1 -0
  247. package/lib/models/pickle_order.d.ts +1 -0
  248. package/lib/models/pickle_order.js +3 -0
  249. package/lib/models/pickle_order.js.map +1 -0
  250. package/lib/models/step_definition.d.ts +11 -0
  251. package/lib/models/step_definition.js +37 -0
  252. package/lib/models/step_definition.js.map +1 -0
  253. package/lib/models/test_case_hook_definition.d.ts +10 -0
  254. package/lib/models/test_case_hook_definition.js +27 -0
  255. package/lib/models/test_case_hook_definition.js.map +1 -0
  256. package/lib/models/test_run_hook_definition.d.ts +3 -0
  257. package/lib/models/test_run_hook_definition.js +10 -0
  258. package/lib/models/test_run_hook_definition.js.map +1 -0
  259. package/lib/models/test_step_hook_definition.d.ts +9 -0
  260. package/lib/models/test_step_hook_definition.js +26 -0
  261. package/lib/models/test_step_hook_definition.js.map +1 -0
  262. package/lib/pickle_filter.d.ts +42 -0
  263. package/lib/pickle_filter.js +99 -0
  264. package/lib/pickle_filter.js.map +1 -0
  265. package/lib/plugin/index.d.ts +2 -0
  266. package/lib/plugin/index.js +19 -0
  267. package/lib/plugin/index.js.map +1 -0
  268. package/lib/plugin/plugin_manager.d.ts +13 -0
  269. package/lib/plugin/plugin_manager.js +36 -0
  270. package/lib/plugin/plugin_manager.js.map +1 -0
  271. package/lib/plugin/types.d.ts +14 -0
  272. package/lib/plugin/types.js +3 -0
  273. package/lib/plugin/types.js.map +1 -0
  274. package/lib/publish/http_stream.d.ts +30 -0
  275. package/lib/publish/http_stream.js +112 -0
  276. package/lib/publish/http_stream.js.map +1 -0
  277. package/lib/publish/index.d.ts +2 -0
  278. package/lib/publish/index.js +5 -0
  279. package/lib/publish/index.js.map +1 -0
  280. package/lib/publish/publish_plugin.d.ts +2 -0
  281. package/lib/publish/publish_plugin.js +48 -0
  282. package/lib/publish/publish_plugin.js.map +1 -0
  283. package/lib/runtime/assemble_test_cases.d.ts +13 -0
  284. package/lib/runtime/assemble_test_cases.js +88 -0
  285. package/lib/runtime/assemble_test_cases.js.map +1 -0
  286. package/lib/runtime/attachment_manager/index.d.ts +33 -0
  287. package/lib/runtime/attachment_manager/index.js +119 -0
  288. package/lib/runtime/attachment_manager/index.js.map +1 -0
  289. package/lib/runtime/format_error.d.ts +2 -0
  290. package/lib/runtime/format_error.js +36 -0
  291. package/lib/runtime/format_error.js.map +1 -0
  292. package/lib/runtime/helpers.d.ts +6 -0
  293. package/lib/runtime/helpers.js +101 -0
  294. package/lib/runtime/helpers.js.map +1 -0
  295. package/lib/runtime/index.d.ts +40 -0
  296. package/lib/runtime/index.js +76 -0
  297. package/lib/runtime/index.js.map +1 -0
  298. package/lib/runtime/parallel/command_types.d.ts +32 -0
  299. package/lib/runtime/parallel/command_types.js +3 -0
  300. package/lib/runtime/parallel/command_types.js.map +1 -0
  301. package/lib/runtime/parallel/coordinator.d.ts +72 -0
  302. package/lib/runtime/parallel/coordinator.js +222 -0
  303. package/lib/runtime/parallel/coordinator.js.map +1 -0
  304. package/lib/runtime/parallel/run_worker.d.ts +1 -0
  305. package/lib/runtime/parallel/run_worker.js +29 -0
  306. package/lib/runtime/parallel/run_worker.js.map +1 -0
  307. package/lib/runtime/parallel/worker.d.ts +26 -0
  308. package/lib/runtime/parallel/worker.js +87 -0
  309. package/lib/runtime/parallel/worker.js.map +1 -0
  310. package/lib/runtime/run_test_run_hooks.d.ts +3 -0
  311. package/lib/runtime/run_test_run_hooks.js +28 -0
  312. package/lib/runtime/run_test_run_hooks.js.map +1 -0
  313. package/lib/runtime/step_runner.d.ts +16 -0
  314. package/lib/runtime/step_runner.js +88 -0
  315. package/lib/runtime/step_runner.js.map +1 -0
  316. package/lib/runtime/stopwatch.d.ts +12 -0
  317. package/lib/runtime/stopwatch.js +34 -0
  318. package/lib/runtime/stopwatch.js.map +1 -0
  319. package/lib/runtime/test_case_runner.d.ts +55 -0
  320. package/lib/runtime/test_case_runner.js +277 -0
  321. package/lib/runtime/test_case_runner.js.map +1 -0
  322. package/lib/step_arguments.d.ts +6 -0
  323. package/lib/step_arguments.js +19 -0
  324. package/lib/step_arguments.js.map +1 -0
  325. package/lib/support_code_library_builder/build_parameter_type.d.ts +3 -0
  326. package/lib/support_code_library_builder/build_parameter_type.js +13 -0
  327. package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
  328. package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
  329. package/lib/support_code_library_builder/get_definition_line_and_uri.js +29 -0
  330. package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
  331. package/lib/support_code_library_builder/index.d.ts +74 -0
  332. package/lib/support_code_library_builder/index.js +304 -0
  333. package/lib/support_code_library_builder/index.js.map +1 -0
  334. package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
  335. package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
  336. package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
  337. package/lib/support_code_library_builder/sourced_parameter_type_registry.d.ts +7 -0
  338. package/lib/support_code_library_builder/sourced_parameter_type_registry.js +19 -0
  339. package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +1 -0
  340. package/lib/support_code_library_builder/types.d.ts +88 -0
  341. package/lib/support_code_library_builder/types.js +3 -0
  342. package/lib/support_code_library_builder/types.js.map +1 -0
  343. package/lib/support_code_library_builder/validate_arguments.d.ts +12 -0
  344. package/lib/support_code_library_builder/validate_arguments.js +73 -0
  345. package/lib/support_code_library_builder/validate_arguments.js.map +1 -0
  346. package/lib/support_code_library_builder/world.d.ts +18 -0
  347. package/lib/support_code_library_builder/world.js +11 -0
  348. package/lib/support_code_library_builder/world.js.map +1 -0
  349. package/lib/time.d.ts +18 -0
  350. package/lib/time.js +61 -0
  351. package/lib/time.js.map +1 -0
  352. package/lib/try_require.d.ts +7 -0
  353. package/lib/try_require.js +26 -0
  354. package/lib/try_require.js.map +1 -0
  355. package/lib/types/index.d.ts +4 -0
  356. package/lib/types/index.js +3 -0
  357. package/lib/types/index.js.map +1 -0
  358. package/lib/uncaught_exception_manager.d.ts +7 -0
  359. package/lib/uncaught_exception_manager.js +12 -0
  360. package/lib/uncaught_exception_manager.js.map +1 -0
  361. package/lib/user_code_runner.d.ts +14 -0
  362. package/lib/user_code_runner.js +82 -0
  363. package/lib/user_code_runner.js.map +1 -0
  364. package/lib/value_checker.d.ts +3 -0
  365. package/lib/value_checker.js +19 -0
  366. package/lib/value_checker.js.map +1 -0
  367. package/lib/version.d.ts +1 -0
  368. package/lib/version.js +6 -0
  369. package/lib/version.js.map +1 -0
  370. package/lib/wrapper.mjs +44 -0
  371. package/package.json +197 -0
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCucumber = void 0;
4
+ const messages_1 = require("@cucumber/messages");
5
+ const events_1 = require("events");
6
+ const helpers_1 = require("../cli/helpers");
7
+ const helpers_2 = require("../formatter/helpers");
8
+ const console_logger_1 = require("./console_logger");
9
+ const environment_1 = require("./environment");
10
+ const formatters_1 = require("./formatters");
11
+ const gherkin_1 = require("./gherkin");
12
+ const paths_1 = require("./paths");
13
+ const plugins_1 = require("./plugins");
14
+ const runtime_1 = require("./runtime");
15
+ const support_1 = require("./support");
16
+ /**
17
+ * Execute a Cucumber test run.
18
+ *
19
+ * @public
20
+ * @param configuration - Configuration loaded from `loadConfiguration`.
21
+ * @param environment - Project environment.
22
+ * @param onMessage - Callback fired each time Cucumber emits a message.
23
+ */
24
+ async function runCucumber(configuration, environment = {}, onMessage) {
25
+ const { cwd, stdout, stderr, env, debug } = (0, environment_1.mergeEnvironment)(environment);
26
+ const logger = new console_logger_1.ConsoleLogger(stderr, debug);
27
+ const newId = messages_1.IdGenerator.uuid();
28
+ const supportCoordinates = 'World' in configuration.support
29
+ ? configuration.support.originalCoordinates
30
+ : configuration.support;
31
+ const { unexpandedFeaturePaths, featurePaths, requirePaths, importPaths } = await (0, paths_1.resolvePaths)(logger, cwd, configuration.sources, supportCoordinates);
32
+ const supportCodeLibrary = 'World' in configuration.support
33
+ ? configuration.support
34
+ : await (0, support_1.getSupportCodeLibrary)({
35
+ cwd,
36
+ newId,
37
+ requirePaths,
38
+ importPaths,
39
+ requireModules: supportCoordinates.requireModules,
40
+ });
41
+ const plugins = await (0, plugins_1.initializePlugins)(logger, configuration, environment);
42
+ const eventBroadcaster = new events_1.EventEmitter();
43
+ if (onMessage) {
44
+ eventBroadcaster.on('envelope', onMessage);
45
+ }
46
+ eventBroadcaster.on('envelope', (value) => plugins.emit('message', value));
47
+ const eventDataCollector = new helpers_2.EventDataCollector(eventBroadcaster);
48
+ let formatterStreamError = false;
49
+ const cleanupFormatters = await (0, formatters_1.initializeFormatters)({
50
+ env,
51
+ cwd,
52
+ stdout,
53
+ stderr,
54
+ logger,
55
+ onStreamError: () => (formatterStreamError = true),
56
+ eventBroadcaster,
57
+ eventDataCollector,
58
+ configuration: configuration.formats,
59
+ supportCodeLibrary,
60
+ });
61
+ await (0, helpers_1.emitMetaMessage)(eventBroadcaster, env, configuration.runName);
62
+ let pickleIds = [];
63
+ let parseErrors = [];
64
+ if (featurePaths.length > 0) {
65
+ const gherkinResult = await (0, gherkin_1.getFilteredPicklesAndErrors)({
66
+ newId,
67
+ cwd,
68
+ logger,
69
+ unexpandedFeaturePaths,
70
+ featurePaths,
71
+ coordinates: configuration.sources,
72
+ onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),
73
+ });
74
+ pickleIds = gherkinResult.filteredPickles.map(({ pickle }) => pickle.id);
75
+ parseErrors = gherkinResult.parseErrors;
76
+ }
77
+ if (parseErrors.length) {
78
+ parseErrors.forEach((parseError) => {
79
+ logger.error(`Parse error in "${parseError.source.uri}" ${parseError.message}`);
80
+ });
81
+ await cleanupFormatters();
82
+ await plugins.cleanup();
83
+ return {
84
+ success: false,
85
+ support: supportCodeLibrary,
86
+ };
87
+ }
88
+ (0, helpers_1.emitSupportCodeMessages)({
89
+ eventBroadcaster,
90
+ supportCodeLibrary,
91
+ newId,
92
+ });
93
+ const runtime = (0, runtime_1.makeRuntime)({
94
+ cwd,
95
+ logger,
96
+ eventBroadcaster,
97
+ eventDataCollector,
98
+ pickleIds,
99
+ newId,
100
+ supportCodeLibrary,
101
+ requireModules: supportCoordinates.requireModules,
102
+ requirePaths,
103
+ importPaths,
104
+ options: configuration.runtime,
105
+ });
106
+ const success = await runtime.start();
107
+ await cleanupFormatters();
108
+ await plugins.cleanup();
109
+ return {
110
+ success: success && !formatterStreamError,
111
+ support: supportCodeLibrary,
112
+ };
113
+ }
114
+ exports.runCucumber = runCucumber;
115
+ //# sourceMappingURL=run_cucumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":"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","sourcesContent":["import { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport { emitMetaMessage, emitSupportCodeMessages } from '../cli/helpers'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { ILogger } from '../logger'\nimport { ConsoleLogger } from './console_logger'\nimport { mergeEnvironment } from './environment'\nimport { initializeFormatters } from './formatters'\nimport { getFilteredPicklesAndErrors } from './gherkin'\nimport { resolvePaths } from './paths'\nimport { initializePlugins } from './plugins'\nimport { makeRuntime } from './runtime'\nimport { getSupportCodeLibrary } from './support'\nimport { IRunEnvironment, IRunOptions, IRunResult } from './types'\n\n/**\n * Execute a Cucumber test run.\n *\n * @public\n * @param configuration - Configuration loaded from `loadConfiguration`.\n * @param environment - Project environment.\n * @param onMessage - Callback fired each time Cucumber emits a message.\n */\nexport async function runCucumber(\n configuration: IRunOptions,\n environment: IRunEnvironment = {},\n onMessage?: (message: Envelope) => void\n): Promise<IRunResult> {\n const { cwd, stdout, stderr, env, debug } = mergeEnvironment(environment)\n const logger: ILogger = new ConsoleLogger(stderr, debug)\n\n const newId = IdGenerator.uuid()\n\n const supportCoordinates =\n 'World' in configuration.support\n ? configuration.support.originalCoordinates\n : configuration.support\n\n const { unexpandedFeaturePaths, featurePaths, requirePaths, importPaths } =\n await resolvePaths(logger, cwd, configuration.sources, supportCoordinates)\n\n const supportCodeLibrary =\n 'World' in configuration.support\n ? configuration.support\n : await getSupportCodeLibrary({\n cwd,\n newId,\n requirePaths,\n importPaths,\n requireModules: supportCoordinates.requireModules,\n })\n\n const plugins = await initializePlugins(logger, configuration, environment)\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n eventBroadcaster.on('envelope', (value) => plugins.emit('message', value))\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanupFormatters = await initializeFormatters({\n env,\n cwd,\n stdout,\n stderr,\n logger,\n onStreamError: () => (formatterStreamError = true),\n eventBroadcaster,\n eventDataCollector,\n configuration: configuration.formats,\n supportCodeLibrary,\n })\n await emitMetaMessage(eventBroadcaster, env, configuration.runName)\n\n let pickleIds: string[] = []\n let parseErrors: ParseError[] = []\n if (featurePaths.length > 0) {\n const gherkinResult = await getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates: configuration.sources,\n onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),\n })\n pickleIds = gherkinResult.filteredPickles.map(({ pickle }) => pickle.id)\n parseErrors = gherkinResult.parseErrors\n }\n if (parseErrors.length) {\n parseErrors.forEach((parseError) => {\n logger.error(\n `Parse error in \"${parseError.source.uri}\" ${parseError.message}`\n )\n })\n await cleanupFormatters()\n await plugins.cleanup()\n return {\n success: false,\n support: supportCodeLibrary,\n }\n }\n\n emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n })\n\n const runtime = makeRuntime({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n requireModules: supportCoordinates.requireModules,\n requirePaths,\n importPaths,\n options: configuration.runtime,\n })\n const success = await runtime.start()\n await cleanupFormatters()\n await plugins.cleanup()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ /// <reference types="node" />
2
+ import { IRuntime } from '../runtime';
3
+ import { EventEmitter } from 'events';
4
+ import { EventDataCollector } from '../formatter/helpers';
5
+ import { IdGenerator } from '@cucumber/messages';
6
+ import { ISupportCodeLibrary } from '../support_code_library_builder/types';
7
+ import { IRunOptionsRuntime } from './types';
8
+ import { ILogger } from '../logger';
9
+ export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }: {
10
+ cwd: string;
11
+ logger: ILogger;
12
+ eventBroadcaster: EventEmitter;
13
+ eventDataCollector: EventDataCollector;
14
+ newId: IdGenerator.NewId;
15
+ pickleIds: string[];
16
+ supportCodeLibrary: ISupportCodeLibrary;
17
+ requireModules: string[];
18
+ requirePaths: string[];
19
+ importPaths: string[];
20
+ options: IRunOptionsRuntime;
21
+ }): IRuntime;
@@ -0,0 +1,36 @@
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.makeRuntime = void 0;
7
+ const runtime_1 = __importDefault(require("../runtime"));
8
+ const coordinator_1 = __importDefault(require("../runtime/parallel/coordinator"));
9
+ function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }) {
10
+ if (parallel > 0) {
11
+ return new coordinator_1.default({
12
+ cwd,
13
+ logger,
14
+ eventBroadcaster,
15
+ eventDataCollector,
16
+ pickleIds,
17
+ options,
18
+ newId,
19
+ supportCodeLibrary,
20
+ requireModules,
21
+ requirePaths,
22
+ importPaths,
23
+ numberOfWorkers: parallel,
24
+ });
25
+ }
26
+ return new runtime_1.default({
27
+ eventBroadcaster,
28
+ eventDataCollector,
29
+ newId,
30
+ pickleIds,
31
+ supportCodeLibrary,
32
+ options,
33
+ });
34
+ }
35
+ exports.makeRuntime = makeRuntime;
36
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":";;;;;;AAAA,yDAA8C;AAK9C,kFAAyD;AAIzD,SAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,KAAK,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAalC;IACC,IAAI,QAAQ,GAAG,CAAC,EAAE;QAChB,OAAO,IAAI,qBAAW,CAAC;YACrB,GAAG;YACH,MAAM;YACN,gBAAgB;YAChB,kBAAkB;YAClB,SAAS;YACT,OAAO;YACP,KAAK;YACL,kBAAkB;YAClB,cAAc;YACd,YAAY;YACZ,WAAW;YACX,eAAe,EAAE,QAAQ;SAC1B,CAAC,CAAA;KACH;IACD,OAAO,IAAI,iBAAO,CAAC;QACjB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;QACL,SAAS;QACT,kBAAkB;QAClB,OAAO;KACR,CAAC,CAAA;AACJ,CAAC;AAjDD,kCAiDC","sourcesContent":["import Runtime, { IRuntime } from '../runtime'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport Coordinator from '../runtime/parallel/coordinator'\nimport { IRunOptionsRuntime } from './types'\nimport { ILogger } from '../logger'\n\nexport function makeRuntime({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n requireModules,\n requirePaths,\n importPaths,\n options: { parallel, ...options },\n}: {\n cwd: string\n logger: ILogger\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n newId: IdGenerator.NewId\n pickleIds: string[]\n supportCodeLibrary: ISupportCodeLibrary\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n options: IRunOptionsRuntime\n}): IRuntime {\n if (parallel > 0) {\n return new Coordinator({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n options,\n newId,\n supportCodeLibrary,\n requireModules,\n requirePaths,\n importPaths,\n numberOfWorkers: parallel,\n })\n }\n return new Runtime({\n eventBroadcaster,\n eventDataCollector,\n newId,\n pickleIds,\n supportCodeLibrary,\n options,\n })\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { IdGenerator } from '@cucumber/messages';
2
+ import { ISupportCodeLibrary } from '../support_code_library_builder/types';
3
+ export declare function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }: {
4
+ cwd: string;
5
+ newId: IdGenerator.NewId;
6
+ requireModules: string[];
7
+ requirePaths: string[];
8
+ importPaths: string[];
9
+ }): Promise<ISupportCodeLibrary>;
@@ -0,0 +1,26 @@
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.getSupportCodeLibrary = void 0;
7
+ const support_code_library_builder_1 = __importDefault(require("../support_code_library_builder"));
8
+ const url_1 = require("url");
9
+ const try_require_1 = __importDefault(require("../try_require"));
10
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
11
+ const { importer } = require('../importer');
12
+ async function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }) {
13
+ support_code_library_builder_1.default.reset(cwd, newId, {
14
+ requireModules,
15
+ requirePaths,
16
+ importPaths,
17
+ });
18
+ requireModules.map((module) => (0, try_require_1.default)(module));
19
+ requirePaths.map((path) => (0, try_require_1.default)(path));
20
+ for (const path of importPaths) {
21
+ await importer((0, url_1.pathToFileURL)(path));
22
+ }
23
+ return support_code_library_builder_1.default.finalize();
24
+ }
25
+ exports.getSupportCodeLibrary = getSupportCodeLibrary;
26
+ //# sourceMappingURL=support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAEA,mGAAuE;AACvE,6BAAmC;AACnC,iEAAuC;AAEvC,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAEpC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAOZ;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC,CAAA;IAClD,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,CAAA;IAE5C,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,QAAQ,CAAC,IAAA,mBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACpC;IAED,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AA3BD,sDA2BC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport { pathToFileURL } from 'url'\nimport tryRequire from '../try_require'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\n\nexport async function getSupportCodeLibrary({\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n}: {\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}): Promise<ISupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId, {\n requireModules,\n requirePaths,\n importPaths,\n })\n\n requireModules.map((module) => tryRequire(module))\n requirePaths.map((path) => tryRequire(path))\n\n for (const path of importPaths) {\n await importer(pathToFileURL(path))\n }\n\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { IRunEnvironment } from './types';
2
+ export declare function setupEnvironment(): Promise<Partial<IRunEnvironment>>;
3
+ export declare function teardownEnvironment(environment: IRunEnvironment): Promise<void>;
@@ -0,0 +1,36 @@
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.teardownEnvironment = exports.setupEnvironment = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_1 = __importDefault(require("mz/fs"));
9
+ const reindent_template_literals_1 = require("reindent-template-literals");
10
+ const stream_1 = require("stream");
11
+ const messages_1 = require("@cucumber/messages");
12
+ const newId = messages_1.IdGenerator.uuid();
13
+ async function setupEnvironment() {
14
+ const cwd = path_1.default.join(__dirname, '..', '..', 'tmp', `api_${newId()}`);
15
+ await fs_1.default.mkdir(path_1.default.join(cwd, 'features'), { recursive: true });
16
+ await fs_1.default.writeFile(path_1.default.join(cwd, 'features', 'test.feature'), (0, reindent_template_literals_1.reindent)(`Feature: test fixture
17
+ Scenario: one
18
+ Given a step
19
+ Then another step`));
20
+ await fs_1.default.writeFile(path_1.default.join(cwd, 'features', 'steps.ts'), (0, reindent_template_literals_1.reindent)(`import { Given, Then } from '../../../src'
21
+ Given('a step', function () {})
22
+ Then('another step', function () {})`));
23
+ await fs_1.default.writeFile(path_1.default.join(cwd, 'cucumber.mjs'), `export default {paths: ['features/test.feature'], requireModule: ['ts-node/register'], require: ['features/steps.ts']}`);
24
+ const stdout = new stream_1.PassThrough();
25
+ return { cwd, stdout };
26
+ }
27
+ exports.setupEnvironment = setupEnvironment;
28
+ async function teardownEnvironment(environment) {
29
+ return new Promise((resolve) => {
30
+ fs_1.default.rm(environment.cwd, { recursive: true }, resolve);
31
+ }).then(() => {
32
+ environment.stdout.end();
33
+ });
34
+ }
35
+ exports.teardownEnvironment = teardownEnvironment;
36
+ //# sourceMappingURL=test_helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_helpers.js","sourceRoot":"","sources":["../../src/api/test_helpers.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AACvB,+CAAsB;AACtB,2EAAqD;AACrD,mCAAoC;AACpC,iDAAgD;AAEhD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;AAEzB,KAAK,UAAU,gBAAgB;IACpC,MAAM,GAAG,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,EAAE,EAAE,CAAC,CAAA;IACrE,MAAM,YAAE,CAAC,KAAK,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/D,MAAM,YAAE,CAAC,SAAS,CAChB,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,cAAc,CAAC,EAC1C,IAAA,qCAAQ,EAAC;;;0BAGa,CAAC,CACxB,CAAA;IACD,MAAM,YAAE,CAAC,SAAS,CAChB,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,EACtC,IAAA,qCAAQ,EAAC;;yCAE4B,CAAC,CACvC,CAAA;IACD,MAAM,YAAE,CAAC,SAAS,CAChB,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAC9B,wHAAwH,CACzH,CAAA;IACD,MAAM,MAAM,GAAG,IAAI,oBAAW,EAAE,CAAA;IAChC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA;AACxB,CAAC;AAtBD,4CAsBC;AAEM,KAAK,UAAU,mBAAmB,CAAC,WAA4B;IACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,YAAE,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAA;IACtD,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACX,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;IAC1B,CAAC,CAAC,CAAA;AACJ,CAAC;AAND,kDAMC","sourcesContent":["import { IRunEnvironment } from './types'\nimport path from 'path'\nimport fs from 'mz/fs'\nimport { reindent } from 'reindent-template-literals'\nimport { PassThrough } from 'stream'\nimport { IdGenerator } from '@cucumber/messages'\n\nconst newId = IdGenerator.uuid()\n\nexport async function setupEnvironment(): Promise<Partial<IRunEnvironment>> {\n const cwd = path.join(__dirname, '..', '..', 'tmp', `api_${newId()}`)\n await fs.mkdir(path.join(cwd, 'features'), { recursive: true })\n await fs.writeFile(\n path.join(cwd, 'features', 'test.feature'),\n reindent(`Feature: test fixture\n Scenario: one\n Given a step\n Then another step`)\n )\n await fs.writeFile(\n path.join(cwd, 'features', 'steps.ts'),\n reindent(`import { Given, Then } from '../../../src'\n Given('a step', function () {})\n Then('another step', function () {})`)\n )\n await fs.writeFile(\n path.join(cwd, 'cucumber.mjs'),\n `export default {paths: ['features/test.feature'], requireModule: ['ts-node/register'], require: ['features/steps.ts']}`\n )\n const stdout = new PassThrough()\n return { cwd, stdout }\n}\n\nexport async function teardownEnvironment(environment: IRunEnvironment) {\n return new Promise((resolve) => {\n fs.rm(environment.cwd, { recursive: true }, resolve)\n }).then(() => {\n environment.stdout.end()\n })\n}\n"]}
@@ -0,0 +1,177 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Writable } from 'stream';
4
+ import { IConfiguration } from '../configuration';
5
+ import { FormatOptions, IPublishConfig } from '../formatter';
6
+ import { PickleOrder } from '../models/pickle_order';
7
+ import { IRuntimeOptions } from '../runtime';
8
+ import { ISupportCodeLibrary } from '../support_code_library_builder/types';
9
+ /**
10
+ * @public
11
+ */
12
+ export interface ILoadConfigurationOptions {
13
+ /**
14
+ * Path to load configuration file from (defaults to `cucumber.(js|cjs|mjs|json)` if omitted).
15
+ */
16
+ file?: string;
17
+ /**
18
+ * Zero or more profile names from which to source configuration (if omitted or empty, the `default` profile will be used).
19
+ */
20
+ profiles?: string[];
21
+ /**
22
+ * Ad-hoc configuration options to be applied over the top of whatever is loaded from the configuration file/profiles.
23
+ */
24
+ provided?: Partial<IConfiguration>;
25
+ }
26
+ /**
27
+ * @public
28
+ */
29
+ export interface IResolvedConfiguration {
30
+ /**
31
+ * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.
32
+ */
33
+ useConfiguration: IConfiguration;
34
+ /**
35
+ * The format that can be passed into `runCucumber`.
36
+ */
37
+ runConfiguration: IRunConfiguration;
38
+ }
39
+ /**
40
+ * @public
41
+ */
42
+ export interface ISourcesCoordinates {
43
+ defaultDialect: string;
44
+ paths: string[];
45
+ names: string[];
46
+ tagExpression: string;
47
+ order: PickleOrder;
48
+ }
49
+ /**
50
+ * @public
51
+ */
52
+ export interface IPlannedPickle {
53
+ name: string;
54
+ uri: string;
55
+ location: {
56
+ line: number;
57
+ column?: number;
58
+ };
59
+ }
60
+ /**
61
+ * @public
62
+ */
63
+ export interface ISourcesError {
64
+ uri: string;
65
+ location: {
66
+ line: number;
67
+ column?: number;
68
+ };
69
+ message: string;
70
+ }
71
+ /**
72
+ * @public
73
+ */
74
+ export interface ILoadSourcesResult {
75
+ plan: IPlannedPickle[];
76
+ errors: ISourcesError[];
77
+ }
78
+ /**
79
+ * @public
80
+ */
81
+ export interface ISupportCodeCoordinates {
82
+ requireModules: string[];
83
+ requirePaths: string[];
84
+ importPaths: string[];
85
+ }
86
+ /**
87
+ * @public
88
+ */
89
+ export interface ILoadSupportOptions {
90
+ sources: ISourcesCoordinates;
91
+ support: ISupportCodeCoordinates;
92
+ }
93
+ /**
94
+ * @public
95
+ */
96
+ export interface IRunOptionsRuntime extends IRuntimeOptions {
97
+ parallel: number;
98
+ }
99
+ /**
100
+ * @public
101
+ */
102
+ export interface IRunOptionsFormats {
103
+ stdout: string;
104
+ files: Record<string, string>;
105
+ publish: IPublishConfig | false;
106
+ options: FormatOptions;
107
+ }
108
+ /**
109
+ * @public
110
+ */
111
+ export interface IRunConfiguration {
112
+ sources: ISourcesCoordinates;
113
+ support: ISupportCodeCoordinates;
114
+ runtime: IRunOptionsRuntime;
115
+ formats: IRunOptionsFormats;
116
+ runName?: string;
117
+ }
118
+ /**
119
+ * @public
120
+ */
121
+ export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
122
+ /**
123
+ * @public
124
+ */
125
+ export type { ISupportCodeLibrary };
126
+ /**
127
+ * @public
128
+ */
129
+ export interface IRunOptions {
130
+ sources: ISourcesCoordinates;
131
+ support: ISupportCodeCoordinatesOrLibrary;
132
+ runtime: IRunOptionsRuntime;
133
+ formats: IRunOptionsFormats;
134
+ runName?: string;
135
+ }
136
+ /**
137
+ * Contextual data about the project environment.
138
+ *
139
+ * @public
140
+ */
141
+ export interface IRunEnvironment {
142
+ /**
143
+ * Working directory for the project (defaults to `process.cwd()` if omitted).
144
+ */
145
+ cwd?: string;
146
+ /**
147
+ * Writable stream where the test run's main output is written (defaults to `process.stdout` if omitted).
148
+ */
149
+ stdout?: Writable;
150
+ /**
151
+ * Writable stream where the test run's warning/error output is written (defaults to `process.stderr` if omitted).
152
+ */
153
+ stderr?: Writable;
154
+ /**
155
+ * Environment variables (defaults to `process.env` if omitted).
156
+ */
157
+ env?: NodeJS.ProcessEnv;
158
+ /**
159
+ * Whether debug logging is enabled.
160
+ */
161
+ debug?: boolean;
162
+ }
163
+ /**
164
+ * Result of a Cucumber test run.
165
+ *
166
+ * @public
167
+ */
168
+ export interface IRunResult {
169
+ /**
170
+ * Whether the test run was overall successful i.e. no failed scenarios. The exact meaning can vary based on the `strict` configuration option.
171
+ */
172
+ success: boolean;
173
+ /**
174
+ * The support code library that was used in the test run; can be reused in subsequent `runCucumber` calls.
175
+ */
176
+ support: ISupportCodeLibrary;
177
+ }
@@ -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/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'stream'\nimport { IConfiguration } from '../configuration'\nimport { FormatOptions, IPublishConfig } from '../formatter'\nimport { PickleOrder } from '../models/pickle_order'\nimport { IRuntimeOptions } from '../runtime'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\n\n/**\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from (defaults to `cucumber.(js|cjs|mjs|json)` if omitted).\n */\n file?: string\n /**\n * Zero or more profile names from which to source configuration (if omitted or empty, the `default` profile will be used).\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be applied over the top of whatever is loaded from the configuration file/profiles.\n */\n provided?: Partial<IConfiguration>\n}\n\n/**\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration file/profiles plus any extra provided.\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into `runCucumber`.\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * @public\n */\nexport interface ISourcesCoordinates {\n defaultDialect: string\n paths: string[]\n names: string[]\n tagExpression: string\n order: PickleOrder\n}\n\n/**\n * @public\n */\nexport interface IPlannedPickle {\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n message: string\n}\n\n/**\n * @public\n */\nexport interface ILoadSourcesResult {\n plan: IPlannedPickle[]\n errors: ISourcesError[]\n}\n\n/**\n * @public\n */\nexport interface ISupportCodeCoordinates {\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}\n\n/**\n * @public\n */\nexport interface ILoadSupportOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n}\n\n/**\n * @public\n */\nexport interface IRunOptionsRuntime extends IRuntimeOptions {\n parallel: number\n}\n\n/**\n * @public\n */\nexport interface IRunOptionsFormats {\n stdout: string\n files: Record<string, string>\n publish: IPublishConfig | false\n options: FormatOptions\n}\n\n/**\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n runName?: string\n}\n\n/**\n * @public\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | ISupportCodeCoordinates\n | ISupportCodeLibrary\n\n/**\n * @public\n */\nexport type { ISupportCodeLibrary }\n\n/**\n * @public\n */\nexport interface IRunOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinatesOrLibrary\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n runName?: string\n}\n\n/**\n * Contextual data about the project environment.\n *\n * @public\n */\nexport interface IRunEnvironment {\n /**\n * Working directory for the project (defaults to `process.cwd()` if omitted).\n */\n cwd?: string\n /**\n * Writable stream where the test run's main output is written (defaults to `process.stdout` if omitted).\n */\n stdout?: Writable\n /**\n * Writable stream where the test run's warning/error output is written (defaults to `process.stderr` if omitted).\n */\n stderr?: Writable\n /**\n * Environment variables (defaults to `process.env` if omitted).\n */\n env?: NodeJS.ProcessEnv\n /**\n * Whether debug logging is enabled.\n */\n debug?: boolean\n}\n\n/**\n * Result of a Cucumber test run.\n *\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful i.e. no failed scenarios. The exact meaning can vary based on the `strict` configuration option.\n */\n success: boolean\n /**\n * The support code library that was used in the test run; can be reused in subsequent `runCucumber` calls.\n */\n support: ISupportCodeLibrary\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import api from './index.js'
2
+
3
+ export const loadConfiguration = api.loadConfiguration
4
+ export const loadSupport = api.loadSupport
5
+ export const loadSources = api.loadSources
6
+ export const runCucumber = api.runCucumber
@@ -0,0 +1,39 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { IdGenerator } from '@cucumber/messages';
5
+ import { EventEmitter } from 'events';
6
+ import { Readable } from 'stream';
7
+ import { IConfiguration } from '../configuration';
8
+ import { EventDataCollector } from '../formatter/helpers';
9
+ import { ILogger } from '../logger';
10
+ import { PickleOrder } from '../models/pickle_order';
11
+ import PickleFilter from '../pickle_filter';
12
+ import { ISupportCodeLibrary } from '../support_code_library_builder/types';
13
+ interface IParseGherkinMessageStreamRequest {
14
+ cwd?: string;
15
+ eventBroadcaster: EventEmitter;
16
+ eventDataCollector: EventDataCollector;
17
+ gherkinMessageStream: Readable;
18
+ order: string;
19
+ pickleFilter: PickleFilter;
20
+ }
21
+ /**
22
+ * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids
23
+ *
24
+ * @param eventBroadcaster
25
+ * @param eventDataCollector
26
+ * @param gherkinMessageStream
27
+ * @param order
28
+ * @param pickleFilter
29
+ */
30
+ export declare function parseGherkinMessageStream({ eventBroadcaster, eventDataCollector, gherkinMessageStream, order, pickleFilter, }: IParseGherkinMessageStreamRequest): Promise<string[]>;
31
+ export declare function orderPickles<T = string>(pickleIds: T[], order: PickleOrder, logger: ILogger): void;
32
+ export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv, runName?: string): Promise<void>;
33
+ export declare function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }: {
34
+ eventBroadcaster: EventEmitter;
35
+ supportCodeLibrary: ISupportCodeLibrary;
36
+ newId: IdGenerator.NewId;
37
+ }): void;
38
+ export declare function getRunName(argvConfiguration: Partial<IConfiguration>): string;
39
+ export {};