@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,146 @@
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.getFilteredPicklesAndErrors = void 0;
7
+ const gherkin_streams_1 = require("@cucumber/gherkin-streams");
8
+ const gherkin_utils_1 = require("@cucumber/gherkin-utils");
9
+ const pickle_filter_1 = __importDefault(require("../pickle_filter"));
10
+ const helpers_1 = require("../cli/helpers");
11
+ const feature_data_format_1 = require("../formatter/feature_data_format");
12
+ const node_path_1 = __importDefault(require("node:path"));
13
+ async function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeaturePaths, featurePaths, coordinates, onEnvelope, }) {
14
+ const gherkinQuery = new gherkin_utils_1.Query();
15
+ const parseErrors = [];
16
+ let variables, fakeData, pickleIndex = 0;
17
+ let dataFunction = null;
18
+ let functionVars = null;
19
+ let mjsDataFiles = null;
20
+ let projectDir = process.cwd();
21
+ if (featurePaths.length > 0) {
22
+ projectDir = node_path_1.default.join(node_path_1.default.dirname(featurePaths[0]), '..', '..');
23
+ }
24
+ await gherkinFromPaths(featurePaths, {
25
+ newId,
26
+ relativeTo: cwd,
27
+ defaultDialect: coordinates.defaultDialect,
28
+ }, (envelope) => {
29
+ if (envelope.source) {
30
+ let newDataAfterExamplesModify = envelope.source.data;
31
+ const functionMatch = envelope.source.data.match(/@data:function:(.*?)\.(.*)/);
32
+ if (functionMatch) {
33
+ dataFunction = functionMatch[2];
34
+ const { newData, mjsData } = (0, feature_data_format_1.generateExamplesFromFunction)(envelope.source.data, featurePaths[0], dataFunction, functionMatch[1]);
35
+ newDataAfterExamplesModify = newData;
36
+ mjsDataFiles = mjsData;
37
+ }
38
+ const data = (0, feature_data_format_1.generateTestData)(newDataAfterExamplesModify, undefined, undefined, projectDir);
39
+ envelope.source.data = data.newContent;
40
+ variables = data.variables;
41
+ fakeData = data.otherFakeData;
42
+ }
43
+ if (envelope.gherkinDocument && envelope.gherkinDocument.feature) {
44
+ envelope.gherkinDocument.feature.children =
45
+ envelope.gherkinDocument.feature.children.map((scenario) => {
46
+ if (scenario.scenario) {
47
+ if (dataFunction) {
48
+ const { tableHeader, tableBody } = scenario.scenario.examples[0];
49
+ functionVars = {
50
+ previous: tableHeader.cells.map((cell, index) => ({
51
+ header: cell.value,
52
+ value: tableBody[0].cells[index].value,
53
+ })),
54
+ new: [],
55
+ };
56
+ const generateResult = (0, feature_data_format_1.generateExamplesFromFunctionGherkin)(tableHeader.cells, tableBody[0].cells, mjsDataFiles);
57
+ functionVars.new = generateResult;
58
+ generateResult.map(({ value }, index) => (scenario.scenario.examples[0].tableBody[0].cells[index].value = value));
59
+ }
60
+ let fakeDataIdx = 0;
61
+ scenario.scenario.examples.forEach((example) => {
62
+ example.tableBody.forEach((row) => {
63
+ row.cells.forEach((cell, index) => {
64
+ if (fakeDataIdx < fakeData.length &&
65
+ fakeData[fakeDataIdx].var === cell.value) {
66
+ cell.value = fakeData[fakeDataIdx].fake;
67
+ fakeDataIdx++;
68
+ }
69
+ });
70
+ });
71
+ });
72
+ scenario.scenario.steps = scenario.scenario.steps.map((step) => {
73
+ step.text = (0, feature_data_format_1.generateTestData)(step.text, variables, fakeData).newContent;
74
+ return step;
75
+ });
76
+ }
77
+ return scenario;
78
+ });
79
+ }
80
+ if (envelope.pickle) {
81
+ envelope.pickle.steps = envelope.pickle.steps.map((step) => {
82
+ if (functionVars) {
83
+ functionVars.new.forEach(({ value }, index) => {
84
+ step.text = step.text.replace(functionVars.previous[index].value, value);
85
+ });
86
+ }
87
+ const generateData = (0, feature_data_format_1.generateTestData)(step.text, variables, fakeData);
88
+ step.text = generateData.newContent;
89
+ pickleIndex =
90
+ generateData.fakeIndex > pickleIndex
91
+ ? generateData.fakeIndex
92
+ : pickleIndex;
93
+ return step;
94
+ });
95
+ for (let i = 0; i < pickleIndex; i++) {
96
+ fakeData.shift();
97
+ }
98
+ pickleIndex = 0;
99
+ }
100
+ gherkinQuery.update(envelope);
101
+ if (envelope.parseError) {
102
+ parseErrors.push(envelope.parseError);
103
+ }
104
+ onEnvelope === null || onEnvelope === void 0 ? void 0 : onEnvelope(envelope);
105
+ });
106
+ const pickleFilter = new pickle_filter_1.default({
107
+ cwd,
108
+ featurePaths: unexpandedFeaturePaths,
109
+ names: coordinates.names,
110
+ tagExpression: coordinates.tagExpression,
111
+ });
112
+ const filteredPickles = gherkinQuery
113
+ .getPickles()
114
+ .filter((pickle) => {
115
+ const gherkinDocument = gherkinQuery
116
+ .getGherkinDocuments()
117
+ .find((doc) => doc.uri === pickle.uri);
118
+ return pickleFilter.matches({ gherkinDocument, pickle });
119
+ })
120
+ .map((pickle) => {
121
+ const gherkinDocument = gherkinQuery
122
+ .getGherkinDocuments()
123
+ .find((doc) => doc.uri === pickle.uri);
124
+ const location = gherkinQuery.getLocation(pickle.astNodeIds[pickle.astNodeIds.length - 1]);
125
+ return {
126
+ gherkinDocument,
127
+ location,
128
+ pickle,
129
+ };
130
+ });
131
+ (0, helpers_1.orderPickles)(filteredPickles, coordinates.order, logger);
132
+ return {
133
+ filteredPickles,
134
+ parseErrors,
135
+ };
136
+ }
137
+ exports.getFilteredPicklesAndErrors = getFilteredPicklesAndErrors;
138
+ async function gherkinFromPaths(paths, options, onEnvelope) {
139
+ return new Promise((resolve, reject) => {
140
+ const gherkinMessageStream = gherkin_streams_1.GherkinStreams.fromPaths(paths, options);
141
+ gherkinMessageStream.on('data', onEnvelope);
142
+ gherkinMessageStream.on('end', resolve);
143
+ gherkinMessageStream.on('error', reject);
144
+ });
145
+ }
146
+ //# sourceMappingURL=gherkin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gherkin.js","sourceRoot":"","sources":["../../src/api/gherkin.ts"],"names":[],"mappings":";;;;;;AAAA,+DAGkC;AASlC,2DAA+D;AAC/D,qEAA2C;AAC3C,4CAA6C;AAG7C,0EAIyC;AACzC,0DAA4B;AAkBrB,KAAK,UAAU,2BAA2B,CAAC,EAChD,KAAK,EACL,GAAG,EACH,MAAM,EACN,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,UAAU,GASX;IAIC,MAAM,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAA;IACvC,MAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,IAAI,SAAc,EAChB,QAGG,EACH,WAAW,GAAG,CAAC,CAAA;IACjB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eAAe,EAAE,MAAM,EAAE,CAAC,CAAA;IAC1D,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACd,MAAM,eAAe,GAAG,YAAY;aACjC,mBAAmB,EAAE;aACrB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,CAAA;QACxC,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,CACvC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAChD,CAAA;QACD,OAAO;YACL,eAAe;YACf,QAAQ;YACR,MAAM;SACP,CAAA;IACH,CAAC,CAAC,CAAA;IACJ,IAAA,sBAAY,EAAC,eAAe,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACxD,OAAO;QACL,eAAe;QACf,WAAW;KACZ,CAAA;AACH,CAAC;AAjMD,kEAiMC;AAED,KAAK,UAAU,gBAAgB,CAC7B,KAAe,EACf,OAA8B,EAC9B,UAAwC;IAExC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,oBAAoB,GAAG,gCAAc,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACrE,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAC3C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACvC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n GherkinStreams,\n IGherkinStreamOptions,\n} from '@cucumber/gherkin-streams'\nimport {\n Envelope,\n GherkinDocument,\n IdGenerator,\n Location,\n ParseError,\n Pickle,\n} from '@cucumber/messages'\nimport { Query as GherkinQuery } from '@cucumber/gherkin-utils'\nimport PickleFilter from '../pickle_filter'\nimport { orderPickles } from '../cli/helpers'\nimport { ISourcesCoordinates } from './types'\nimport { ILogger } from '../logger'\nimport {\n generateExamplesFromFunction,\n generateTestData,\n generateExamplesFromFunctionGherkin,\n} from '../formatter/feature_data_format'\nimport path from 'node:path'\ninterface PickleWithDocument {\n gherkinDocument: GherkinDocument\n location: Location\n pickle: Pickle\n}\n\ninterface FunctionVars {\n previous: {\n header: string\n value: any\n }[]\n new: {\n header: string\n value: any\n }[]\n}\n\nexport async function getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates,\n onEnvelope,\n}: {\n newId: IdGenerator.NewId\n cwd: string\n logger: ILogger\n unexpandedFeaturePaths: string[]\n featurePaths: string[]\n coordinates: ISourcesCoordinates\n onEnvelope?: (envelope: Envelope) => void\n}): Promise<{\n filteredPickles: PickleWithDocument[]\n parseErrors: ParseError[]\n}> {\n const gherkinQuery = new GherkinQuery()\n const parseErrors: ParseError[] = []\n let variables: any,\n fakeData: {\n var: string\n fake: string\n }[],\n pickleIndex = 0\n let dataFunction: string | null = null\n let functionVars: FunctionVars | null = null\n let mjsDataFiles: any = null\n let projectDir = process.cwd()\n if (featurePaths.length > 0) {\n projectDir = path.join(path.dirname(featurePaths[0]), '..', '..')\n }\n await gherkinFromPaths(\n featurePaths,\n {\n newId,\n relativeTo: cwd,\n defaultDialect: coordinates.defaultDialect,\n },\n (envelope) => {\n if (envelope.source) {\n let newDataAfterExamplesModify = envelope.source.data\n const functionMatch = envelope.source.data.match(\n /@data:function:(.*?)\\.(.*)/\n )\n\n if (functionMatch) {\n dataFunction = functionMatch[2]\n const { newData, mjsData } = generateExamplesFromFunction(\n envelope.source.data,\n featurePaths[0],\n dataFunction,\n functionMatch[1]\n )\n newDataAfterExamplesModify = newData\n mjsDataFiles = mjsData\n }\n\n const data = generateTestData(\n newDataAfterExamplesModify,\n undefined,\n undefined,\n projectDir\n )\n envelope.source.data = data.newContent\n variables = data.variables\n fakeData = data.otherFakeData\n }\n\n if (envelope.gherkinDocument && envelope.gherkinDocument.feature) {\n envelope.gherkinDocument.feature.children =\n envelope.gherkinDocument.feature.children.map((scenario) => {\n if (scenario.scenario) {\n if (dataFunction) {\n const { tableHeader, tableBody } = scenario.scenario.examples[0]\n\n functionVars = {\n previous: tableHeader.cells.map((cell, index) => ({\n header: cell.value,\n value: tableBody[0].cells[index].value,\n })),\n new: [],\n }\n\n const generateResult = generateExamplesFromFunctionGherkin(\n tableHeader.cells,\n tableBody[0].cells,\n mjsDataFiles\n )\n\n functionVars.new = generateResult\n\n generateResult.map(\n ({ value }, index) =>\n (scenario.scenario.examples[0].tableBody[0].cells[\n index\n ].value = value)\n )\n }\n let fakeDataIdx = 0\n scenario.scenario.examples.forEach((example) => {\n example.tableBody.forEach((row) => {\n row.cells.forEach((cell, index) => {\n if (\n fakeDataIdx < fakeData.length &&\n fakeData[fakeDataIdx].var === cell.value\n ) {\n cell.value = fakeData[fakeDataIdx].fake\n fakeDataIdx++\n }\n })\n })\n })\n scenario.scenario.steps = scenario.scenario.steps.map((step) => {\n step.text = generateTestData(\n step.text,\n variables,\n fakeData\n ).newContent\n return step\n })\n }\n return scenario\n })\n }\n\n if (envelope.pickle) {\n envelope.pickle.steps = envelope.pickle.steps.map((step) => {\n if (functionVars) {\n functionVars.new.forEach(({ value }, index) => {\n step.text = step.text.replace(\n functionVars.previous[index].value,\n value\n )\n })\n }\n const generateData = generateTestData(step.text, variables, fakeData)\n step.text = generateData.newContent\n pickleIndex =\n generateData.fakeIndex > pickleIndex\n ? generateData.fakeIndex\n : pickleIndex\n return step\n })\n\n for (let i = 0; i < pickleIndex; i++) {\n fakeData.shift()\n }\n pickleIndex = 0\n }\n\n gherkinQuery.update(envelope)\n if (envelope.parseError) {\n parseErrors.push(envelope.parseError)\n }\n onEnvelope?.(envelope)\n }\n )\n const pickleFilter = new PickleFilter({\n cwd,\n featurePaths: unexpandedFeaturePaths,\n names: coordinates.names,\n tagExpression: coordinates.tagExpression,\n })\n const filteredPickles: PickleWithDocument[] = gherkinQuery\n .getPickles()\n .filter((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n return pickleFilter.matches({ gherkinDocument, pickle })\n })\n .map((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n const location = gherkinQuery.getLocation(\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n )\n return {\n gherkinDocument,\n location,\n pickle,\n }\n })\n orderPickles(filteredPickles, coordinates.order, logger)\n return {\n filteredPickles,\n parseErrors,\n }\n}\n\nasync function gherkinFromPaths(\n paths: string[],\n options: IGherkinStreamOptions,\n onEnvelope: (envelope: Envelope) => void\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const gherkinMessageStream = GherkinStreams.fromPaths(paths, options)\n gherkinMessageStream.on('data', onEnvelope)\n gherkinMessageStream.on('end', resolve)\n gherkinMessageStream.on('error', reject)\n })\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Cucumber for JavaScript
3
+ *
4
+ * @remarks These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
5
+ * @packageDocumentation
6
+ */
7
+ export { IConfiguration } from '../configuration';
8
+ export * from './load_configuration';
9
+ export * from './load_sources';
10
+ export * from './load_support';
11
+ export * from './run_cucumber';
12
+ export * from './types';
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Cucumber for JavaScript
4
+ *
5
+ * @remarks These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
6
+ * @packageDocumentation
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ __exportStar(require("./load_configuration"), exports);
24
+ __exportStar(require("./load_sources"), exports);
25
+ __exportStar(require("./load_support"), exports);
26
+ __exportStar(require("./run_cucumber"), exports);
27
+ __exportStar(require("./types"), exports);
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAGH,uDAAoC;AACpC,iDAA8B;AAC9B,iDAA8B;AAC9B,iDAA8B;AAC9B,0CAAuB","sourcesContent":["/**\n * Cucumber for JavaScript\n *\n * @remarks These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.\n * @packageDocumentation\n */\n\nexport { IConfiguration } from '../configuration'\nexport * from './load_configuration'\nexport * from './load_sources'\nexport * from './load_support'\nexport * from './run_cucumber'\nexport * from './types'\n"]}
@@ -0,0 +1,9 @@
1
+ import { IRunEnvironment, IResolvedConfiguration, ILoadConfigurationOptions } from './types';
2
+ /**
3
+ * Load user-authored configuration to be used in a test run.
4
+ *
5
+ * @public
6
+ * @param options - Coordinates required to find configuration.
7
+ * @param environment - Project environment.
8
+ */
9
+ export declare function loadConfiguration(options?: ILoadConfigurationOptions, environment?: IRunEnvironment): Promise<IResolvedConfiguration>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadConfiguration = void 0;
4
+ const locate_file_1 = require("../configuration/locate_file");
5
+ const configuration_1 = require("../configuration");
6
+ const validate_configuration_1 = require("../configuration/validate_configuration");
7
+ const convert_configuration_1 = require("./convert_configuration");
8
+ const environment_1 = require("./environment");
9
+ const console_logger_1 = require("./console_logger");
10
+ /**
11
+ * Load user-authored configuration to be used in a test run.
12
+ *
13
+ * @public
14
+ * @param options - Coordinates required to find configuration.
15
+ * @param environment - Project environment.
16
+ */
17
+ async function loadConfiguration(options = {}, environment = {}) {
18
+ var _a;
19
+ const { cwd, stderr, env, debug } = (0, environment_1.mergeEnvironment)(environment);
20
+ const logger = new console_logger_1.ConsoleLogger(stderr, debug);
21
+ const configFile = (_a = options.file) !== null && _a !== void 0 ? _a : (0, locate_file_1.locateFile)(cwd);
22
+ if (configFile) {
23
+ logger.debug(`Configuration will be loaded from "${configFile}"`);
24
+ }
25
+ else {
26
+ logger.debug('No configuration file found');
27
+ }
28
+ const profileConfiguration = configFile
29
+ ? await (0, configuration_1.fromFile)(logger, cwd, configFile, options.profiles)
30
+ : {};
31
+ const original = (0, configuration_1.mergeConfigurations)(configuration_1.DEFAULT_CONFIGURATION, profileConfiguration, options.provided);
32
+ logger.debug('Resolved configuration:', original);
33
+ (0, validate_configuration_1.validateConfiguration)(original, logger);
34
+ const runnable = await (0, convert_configuration_1.convertConfiguration)(original, env);
35
+ return {
36
+ useConfiguration: original,
37
+ runConfiguration: runnable,
38
+ };
39
+ }
40
+ exports.loadConfiguration = loadConfiguration;
41
+ //# sourceMappingURL=load_configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"mappings":";;;AAKA,8DAAyD;AACzD,oDAIyB;AACzB,oFAA+E;AAC/E,mEAA8D;AAC9D,+CAAgD;AAEhD,qDAAgD;AAEhD;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,UAAqC,EAAE,EACvC,cAA+B,EAAE;;IAEjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACjE,MAAM,MAAM,GAAY,IAAI,8BAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxD,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAA,wBAAU,EAAC,GAAG,CAAC,CAAA;IAClD,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,KAAK,CAAC,sCAAsC,UAAU,GAAG,CAAC,CAAA;KAClE;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;KAC5C;IACD,MAAM,oBAAoB,GAAG,UAAU;QACrC,CAAC,CAAC,MAAM,IAAA,wBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC;QAC3D,CAAC,CAAC,EAAE,CAAA;IACN,MAAM,QAAQ,GAAG,IAAA,mCAAmB,EAClC,qCAAqB,EACrB,oBAAoB,EACpB,OAAO,CAAC,QAAQ,CACjB,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAA;IACjD,IAAA,8CAAqB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACvC,MAAM,QAAQ,GAAG,MAAM,IAAA,4CAAoB,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;IAC1D,OAAO;QACL,gBAAgB,EAAE,QAAQ;QAC1B,gBAAgB,EAAE,QAAQ;KAC3B,CAAA;AACH,CAAC;AA3BD,8CA2BC","sourcesContent":["import {\n IRunEnvironment,\n IResolvedConfiguration,\n ILoadConfigurationOptions,\n} from './types'\nimport { locateFile } from '../configuration/locate_file'\nimport {\n DEFAULT_CONFIGURATION,\n fromFile,\n mergeConfigurations,\n} from '../configuration'\nimport { validateConfiguration } from '../configuration/validate_configuration'\nimport { convertConfiguration } from './convert_configuration'\nimport { mergeEnvironment } from './environment'\nimport { ILogger } from '../logger'\nimport { ConsoleLogger } from './console_logger'\n\n/**\n * Load user-authored configuration to be used in a test run.\n *\n * @public\n * @param options - Coordinates required to find configuration.\n * @param environment - Project environment.\n */\nexport async function loadConfiguration(\n options: ILoadConfigurationOptions = {},\n environment: IRunEnvironment = {}\n): Promise<IResolvedConfiguration> {\n const { cwd, stderr, env, debug } = mergeEnvironment(environment)\n const logger: ILogger = new ConsoleLogger(stderr, debug)\n const configFile = options.file ?? locateFile(cwd)\n if (configFile) {\n logger.debug(`Configuration will be loaded from \"${configFile}\"`)\n } else {\n logger.debug('No configuration file found')\n }\n const profileConfiguration = configFile\n ? await fromFile(logger, cwd, configFile, options.profiles)\n : {}\n const original = mergeConfigurations(\n DEFAULT_CONFIGURATION,\n profileConfiguration,\n options.provided\n )\n logger.debug('Resolved configuration:', original)\n validateConfiguration(original, logger)\n const runnable = await convertConfiguration(original, env)\n return {\n useConfiguration: original,\n runConfiguration: runnable,\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { ILoadSourcesResult, IRunEnvironment, ISourcesCoordinates } from './types';
2
+ /**
3
+ * Load and parse features, produce a filtered and ordered test plan and/or parse errors.
4
+ *
5
+ * @public
6
+ * @param coordinates - Coordinates required to find features
7
+ * @param environment - Project environment.
8
+ */
9
+ export declare function loadSources(coordinates: ISourcesCoordinates, environment?: IRunEnvironment): Promise<ILoadSourcesResult>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadSources = void 0;
4
+ const paths_1 = require("./paths");
5
+ const messages_1 = require("@cucumber/messages");
6
+ const environment_1 = require("./environment");
7
+ const gherkin_1 = require("./gherkin");
8
+ const console_logger_1 = require("./console_logger");
9
+ /**
10
+ * Load and parse features, produce a filtered and ordered test plan and/or parse errors.
11
+ *
12
+ * @public
13
+ * @param coordinates - Coordinates required to find features
14
+ * @param environment - Project environment.
15
+ */
16
+ async function loadSources(coordinates, environment = {}) {
17
+ const { cwd, stderr, debug } = (0, environment_1.mergeEnvironment)(environment);
18
+ const logger = new console_logger_1.ConsoleLogger(stderr, debug);
19
+ const newId = messages_1.IdGenerator.uuid();
20
+ const { unexpandedFeaturePaths, featurePaths } = await (0, paths_1.resolvePaths)(logger, cwd, coordinates);
21
+ if (featurePaths.length === 0) {
22
+ return {
23
+ plan: [],
24
+ errors: [],
25
+ };
26
+ }
27
+ const { filteredPickles, parseErrors } = await (0, gherkin_1.getFilteredPicklesAndErrors)({
28
+ newId,
29
+ cwd,
30
+ logger,
31
+ unexpandedFeaturePaths,
32
+ featurePaths,
33
+ coordinates,
34
+ });
35
+ const plan = filteredPickles.map(({ location, pickle }) => ({
36
+ name: pickle.name,
37
+ uri: pickle.uri,
38
+ location,
39
+ }));
40
+ const errors = parseErrors.map(({ source, message }) => {
41
+ return {
42
+ uri: source.uri,
43
+ location: source.location,
44
+ message,
45
+ };
46
+ });
47
+ return {
48
+ plan,
49
+ errors,
50
+ };
51
+ }
52
+ exports.loadSources = loadSources;
53
+ //# sourceMappingURL=load_sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;AAOA,mCAAsC;AACtC,iDAAgD;AAChD,+CAAgD;AAChD,uCAAuD;AACvD,qDAAgD;AAGhD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,WAAgC,EAChC,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAY,IAAI,8BAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,oBAAY,EACjE,MAAM,EACN,GAAG,EACH,WAAW,CACZ,CAAA;IACD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO;YACL,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;SACX,CAAA;KACF;IACD,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,qCAA2B,EAAC;QACzE,KAAK;QACL,GAAG;QACH,MAAM;QACN,sBAAsB;QACtB,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IACF,MAAM,IAAI,GAAqB,eAAe,CAAC,GAAG,CAChD,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ;KACT,CAAC,CACH,CAAA;IACD,MAAM,MAAM,GAAoB,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QACtE,OAAO;YACL,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO;QACL,IAAI;QACJ,MAAM;KACP,CAAA;AACH,CAAC;AA5CD,kCA4CC","sourcesContent":["import {\n ILoadSourcesResult,\n IPlannedPickle,\n IRunEnvironment,\n ISourcesCoordinates,\n ISourcesError,\n} from './types'\nimport { resolvePaths } from './paths'\nimport { IdGenerator } from '@cucumber/messages'\nimport { mergeEnvironment } from './environment'\nimport { getFilteredPicklesAndErrors } from './gherkin'\nimport { ConsoleLogger } from './console_logger'\nimport { ILogger } from '../logger'\n\n/**\n * Load and parse features, produce a filtered and ordered test plan and/or parse errors.\n *\n * @public\n * @param coordinates - Coordinates required to find features\n * @param environment - Project environment.\n */\nexport async function loadSources(\n coordinates: ISourcesCoordinates,\n environment: IRunEnvironment = {}\n): Promise<ILoadSourcesResult> {\n const { cwd, stderr, debug } = mergeEnvironment(environment)\n const logger: ILogger = new ConsoleLogger(stderr, debug)\n const newId = IdGenerator.uuid()\n const { unexpandedFeaturePaths, featurePaths } = await resolvePaths(\n logger,\n cwd,\n coordinates\n )\n if (featurePaths.length === 0) {\n return {\n plan: [],\n errors: [],\n }\n }\n const { filteredPickles, parseErrors } = await getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates,\n })\n const plan: IPlannedPickle[] = filteredPickles.map(\n ({ location, pickle }) => ({\n name: pickle.name,\n uri: pickle.uri,\n location,\n })\n )\n const errors: ISourcesError[] = parseErrors.map(({ source, message }) => {\n return {\n uri: source.uri,\n location: source.location,\n message,\n }\n })\n return {\n plan,\n errors,\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { ILoadSupportOptions, IRunEnvironment } from './types';
2
+ import { ISupportCodeLibrary } from '../support_code_library_builder/types';
3
+ /**
4
+ * Load support code for use in test runs.
5
+ *
6
+ * @public
7
+ * @param options - Subset of `IRunnableConfiguration` required to find the support code.
8
+ * @param environment - Project environment.
9
+ */
10
+ export declare function loadSupport(options: ILoadSupportOptions, environment?: IRunEnvironment): Promise<ISupportCodeLibrary>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadSupport = void 0;
4
+ const messages_1 = require("@cucumber/messages");
5
+ const paths_1 = require("./paths");
6
+ const support_1 = require("./support");
7
+ const environment_1 = require("./environment");
8
+ const console_logger_1 = require("./console_logger");
9
+ /**
10
+ * Load support code for use in test runs.
11
+ *
12
+ * @public
13
+ * @param options - Subset of `IRunnableConfiguration` required to find the support code.
14
+ * @param environment - Project environment.
15
+ */
16
+ async function loadSupport(options, environment = {}) {
17
+ const { cwd, stderr, debug } = (0, environment_1.mergeEnvironment)(environment);
18
+ const logger = new console_logger_1.ConsoleLogger(stderr, debug);
19
+ const newId = messages_1.IdGenerator.uuid();
20
+ const { requirePaths, importPaths } = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, options.support);
21
+ return await (0, support_1.getSupportCodeLibrary)({
22
+ cwd,
23
+ newId,
24
+ requireModules: options.support.requireModules,
25
+ requirePaths,
26
+ importPaths,
27
+ });
28
+ }
29
+ exports.loadSupport = loadSupport;
30
+ //# sourceMappingURL=load_support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAEhD,mCAAsC;AACtC,uCAAiD;AACjD,+CAAgD;AAGhD,qDAAgD;AAEhD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAY,IAAI,8BAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,oBAAY,EACtD,MAAM,EACN,GAAG,EACH,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,OAAO,MAAM,IAAA,+BAAqB,EAAC;QACjC,GAAG;QACH,KAAK;QACL,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc;QAC9C,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;AACJ,CAAC;AApBD,kCAoBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ILoadSupportOptions, IRunEnvironment } from './types'\nimport { resolvePaths } from './paths'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { ILogger } from '../logger'\nimport { ConsoleLogger } from './console_logger'\n\n/**\n * Load support code for use in test runs.\n *\n * @public\n * @param options - Subset of `IRunnableConfiguration` required to find the support code.\n * @param environment - Project environment.\n */\nexport async function loadSupport(\n options: ILoadSupportOptions,\n environment: IRunEnvironment = {}\n): Promise<ISupportCodeLibrary> {\n const { cwd, stderr, debug } = mergeEnvironment(environment)\n const logger: ILogger = new ConsoleLogger(stderr, debug)\n const newId = IdGenerator.uuid()\n const { requirePaths, importPaths } = await resolvePaths(\n logger,\n cwd,\n options.sources,\n options.support\n )\n return await getSupportCodeLibrary({\n cwd,\n newId,\n requireModules: options.support.requireModules,\n requirePaths,\n importPaths,\n })\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { ISourcesCoordinates, ISupportCodeCoordinates } from './types';
2
+ import { ILogger } from '../logger';
3
+ export declare function resolvePaths(logger: ILogger, cwd: string, sources: Pick<ISourcesCoordinates, 'paths'>, support?: ISupportCodeCoordinates): Promise<{
4
+ unexpandedFeaturePaths: string[];
5
+ featurePaths: string[];
6
+ requirePaths: string[];
7
+ importPaths: string[];
8
+ }>;
@@ -0,0 +1,102 @@
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.resolvePaths = void 0;
7
+ const util_1 = require("util");
8
+ const glob_1 = __importDefault(require("glob"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const fs_1 = __importDefault(require("mz/fs"));
11
+ async function resolvePaths(logger, cwd, sources, support = {
12
+ requireModules: [],
13
+ requirePaths: [],
14
+ importPaths: [],
15
+ }) {
16
+ const unexpandedFeaturePaths = await getUnexpandedFeaturePaths(cwd, sources.paths);
17
+ const featurePaths = await expandFeaturePaths(cwd, unexpandedFeaturePaths);
18
+ logger.debug('Found feature files based on configuration:', featurePaths);
19
+ const { requirePaths, importPaths } = await deriveSupportPaths(cwd, featurePaths, support.requirePaths, support.importPaths);
20
+ logger.debug('Found support files to load via `require` based on configuration:', requirePaths);
21
+ logger.debug('Found support files to load via `import` based on configuration:', importPaths);
22
+ return {
23
+ unexpandedFeaturePaths,
24
+ featurePaths,
25
+ requirePaths,
26
+ importPaths,
27
+ };
28
+ }
29
+ exports.resolvePaths = resolvePaths;
30
+ async function expandPaths(cwd, unexpandedPaths, defaultExtension) {
31
+ const expandedPaths = await Promise.all(unexpandedPaths.map(async (unexpandedPath) => {
32
+ const matches = await (0, util_1.promisify)(glob_1.default)(unexpandedPath, {
33
+ absolute: true,
34
+ cwd,
35
+ });
36
+ const expanded = await Promise.all(matches.map(async (match) => {
37
+ if (path_1.default.extname(match) === '') {
38
+ return await (0, util_1.promisify)(glob_1.default)(`${match}/**/*${defaultExtension}`);
39
+ }
40
+ return [match];
41
+ }));
42
+ return expanded.flat();
43
+ }));
44
+ const normalized = expandedPaths.flat().map((x) => path_1.default.normalize(x));
45
+ return [...new Set(normalized)];
46
+ }
47
+ async function getUnexpandedFeaturePaths(cwd, args) {
48
+ if (args.length > 0) {
49
+ const nestedFeaturePaths = await Promise.all(args.map(async (arg) => {
50
+ const filename = path_1.default.basename(arg);
51
+ if (filename[0] === '@') {
52
+ const filePath = path_1.default.join(cwd, arg);
53
+ const content = await fs_1.default.readFile(filePath, 'utf8');
54
+ return content.split('\n').map((x) => x.trim());
55
+ }
56
+ return [arg];
57
+ }));
58
+ const featurePaths = nestedFeaturePaths.flat();
59
+ if (featurePaths.length > 0) {
60
+ return featurePaths.filter((x) => x !== '');
61
+ }
62
+ }
63
+ return ['features/**/*.{feature,feature.md}'];
64
+ }
65
+ function getFeatureDirectoryPaths(cwd, featurePaths) {
66
+ const featureDirs = featurePaths.map((featurePath) => {
67
+ let featureDir = path_1.default.dirname(featurePath);
68
+ let childDir;
69
+ let parentDir = featureDir;
70
+ while (childDir !== parentDir) {
71
+ childDir = parentDir;
72
+ parentDir = path_1.default.dirname(childDir);
73
+ if (path_1.default.basename(parentDir) === 'features') {
74
+ featureDir = parentDir;
75
+ break;
76
+ }
77
+ }
78
+ return path_1.default.relative(cwd, featureDir);
79
+ });
80
+ return [...new Set(featureDirs)];
81
+ }
82
+ async function expandFeaturePaths(cwd, featurePaths) {
83
+ featurePaths = featurePaths.map((p) => p.replace(/(:\d+)*$/g, '')); // Strip line numbers
84
+ return await expandPaths(cwd, featurePaths, '.feature');
85
+ }
86
+ async function deriveSupportPaths(cwd, featurePaths, unexpandedRequirePaths, unexpandedImportPaths) {
87
+ if (unexpandedRequirePaths.length === 0 &&
88
+ unexpandedImportPaths.length === 0) {
89
+ const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths);
90
+ const requirePaths = await expandPaths(cwd, defaultPaths, '.js');
91
+ const importPaths = await expandPaths(cwd, defaultPaths, '.mjs');
92
+ return { requirePaths, importPaths };
93
+ }
94
+ const requirePaths = unexpandedRequirePaths.length > 0
95
+ ? await expandPaths(cwd, unexpandedRequirePaths, '.js')
96
+ : [];
97
+ const importPaths = unexpandedImportPaths.length > 0
98
+ ? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')
99
+ : [];
100
+ return { requirePaths, importPaths };
101
+ }
102
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/api/paths.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAgC;AAChC,gDAAuB;AACvB,gDAAuB;AACvB,+CAAsB;AAIf,KAAK,UAAU,YAAY,CAChC,MAAe,EACf,GAAW,EACX,OAA2C,EAC3C,UAAmC;IACjC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,EAAE;CAChB;IAOD,MAAM,sBAAsB,GAAG,MAAM,yBAAyB,CAC5D,GAAG,EACH,OAAO,CAAC,KAAK,CACd,CAAA;IACD,MAAM,YAAY,GAAa,MAAM,kBAAkB,CACrD,GAAG,EACH,sBAAsB,CACvB,CAAA;IACD,MAAM,CAAC,KAAK,CAAC,6CAA6C,EAAE,YAAY,CAAC,CAAA;IACzE,MA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GAChB,sBAAsB,CAAC,MAAM,GAAG,CAAC;QAC/B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,CAAC;QACvD,CAAC,CAAC,EAAE,CAAA;IACR,MAAM,WAAW,GACf,qBAAqB,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,qBAAqB,EAAE,gBAAgB,CAAC;QACjE,CAAC,CAAC,EAAE,CAAA;IACR,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;AACtC,CAAC","sourcesContent":["import { promisify } from 'util'\nimport glob from 'glob'\nimport path from 'path'\nimport fs from 'mz/fs'\nimport { ISourcesCoordinates, ISupportCodeCoordinates } from './types'\nimport { ILogger } from '../logger'\n\nexport async function resolvePaths(\n logger: ILogger,\n cwd: string,\n sources: Pick<ISourcesCoordinates, 'paths'>,\n support: ISupportCodeCoordinates = {\n requireModules: [],\n requirePaths: [],\n importPaths: [],\n }\n): Promise<{\n unexpandedFeaturePaths: string[]\n featurePaths: string[]\n requirePaths: string[]\n importPaths: string[]\n}> {\n const unexpandedFeaturePaths = await getUnexpandedFeaturePaths(\n cwd,\n sources.paths\n )\n const featurePaths: string[] = await expandFeaturePaths(\n cwd,\n unexpandedFeaturePaths\n )\n logger.debug('Found feature files based on configuration:', featurePaths)\n const { requirePaths, importPaths } = await deriveSupportPaths(\n cwd,\n featurePaths,\n support.requirePaths,\n support.importPaths\n )\n logger.debug(\n 'Found support files to load via `require` based on configuration:',\n requirePaths\n )\n logger.debug(\n 'Found support files to load via `import` based on configuration:',\n importPaths\n )\n return {\n unexpandedFeaturePaths,\n featurePaths,\n requirePaths,\n importPaths,\n }\n}\n\nasync function expandPaths(\n cwd: string,\n unexpandedPaths: string[],\n defaultExtension: string\n): Promise<string[]> {\n const expandedPaths = await Promise.all(\n unexpandedPaths.map(async (unexpandedPath) => {\n const matches = await promisify(glob)(unexpandedPath, {\n absolute: true,\n cwd,\n })\n const expanded = await Promise.all(\n matches.map(async (match) => {\n if (path.extname(match) === '') {\n return await promisify(glob)(`${match}/**/*${defaultExtension}`)\n }\n return [match]\n })\n )\n return expanded.flat()\n })\n )\n const normalized = expandedPaths.flat().map((x) => path.normalize(x))\n return [...new Set(normalized)]\n}\n\nasync function getUnexpandedFeaturePaths(\n cwd: string,\n args: string[]\n): Promise<string[]> {\n if (args.length > 0) {\n const nestedFeaturePaths = await Promise.all(\n args.map(async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(cwd, arg)\n const content = await fs.readFile(filePath, 'utf8')\n return content.split('\\n').map((x) => x.trim())\n }\n return [arg]\n })\n )\n const featurePaths = nestedFeaturePaths.flat()\n if (featurePaths.length > 0) {\n return featurePaths.filter((x) => x !== '')\n }\n }\n return ['features/**/*.{feature,feature.md}']\n}\n\nfunction getFeatureDirectoryPaths(\n cwd: string,\n featurePaths: string[]\n): string[] {\n const featureDirs = featurePaths.map((featurePath) => {\n let featureDir = path.dirname(featurePath)\n let childDir: string\n let parentDir = featureDir\n while (childDir !== parentDir) {\n childDir = parentDir\n parentDir = path.dirname(childDir)\n if (path.basename(parentDir) === 'features') {\n featureDir = parentDir\n break\n }\n }\n return path.relative(cwd, featureDir)\n })\n return [...new Set(featureDirs)]\n}\n\nasync function expandFeaturePaths(\n cwd: string,\n featurePaths: string[]\n): Promise<string[]> {\n featurePaths = featurePaths.map((p) => p.replace(/(:\\d+)*$/g, '')) // Strip line numbers\n return await expandPaths(cwd, featurePaths, '.feature')\n}\n\nasync function deriveSupportPaths(\n cwd: string,\n featurePaths: string[],\n unexpandedRequirePaths: string[],\n unexpandedImportPaths: string[]\n): Promise<{\n requirePaths: string[]\n importPaths: string[]\n}> {\n if (\n unexpandedRequirePaths.length === 0 &&\n unexpandedImportPaths.length === 0\n ) {\n const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths)\n const requirePaths = await expandPaths(cwd, defaultPaths, '.js')\n const importPaths = await expandPaths(cwd, defaultPaths, '.mjs')\n return { requirePaths, importPaths }\n }\n const requirePaths =\n unexpandedRequirePaths.length > 0\n ? await expandPaths(cwd, unexpandedRequirePaths, '.js')\n : []\n const importPaths =\n unexpandedImportPaths.length > 0\n ? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')\n : []\n return { requirePaths, importPaths }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { PluginManager } from '../plugin';
2
+ import { IRunEnvironment, IRunOptions } from './types';
3
+ import { ILogger } from '../logger';
4
+ export declare function initializePlugins(logger: ILogger, configuration: IRunOptions, environment: IRunEnvironment): Promise<PluginManager>;
@@ -0,0 +1,19 @@
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.initializePlugins = void 0;
7
+ const plugin_1 = require("../plugin");
8
+ const publish_1 = __importDefault(require("../publish"));
9
+ const INTERNAL_PLUGINS = {
10
+ publish: publish_1.default,
11
+ };
12
+ async function initializePlugins(logger, configuration, environment) {
13
+ // eventually we'll load plugin packages here
14
+ const pluginManager = new plugin_1.PluginManager(Object.values(INTERNAL_PLUGINS));
15
+ await pluginManager.init(logger, configuration, environment);
16
+ return pluginManager;
17
+ }
18
+ exports.initializePlugins = initializePlugins;
19
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAiD;AACjD,yDAAsC;AAItC,MAAM,gBAAgB,GAA2B;IAC/C,OAAO,EAAE,iBAAa;CACvB,CAAA;AAEM,KAAK,UAAU,iBAAiB,CACrC,MAAe,EACf,aAA0B,EAC1B,WAA4B;IAE5B,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAA;IACxE,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,CAAA;IAC5D,OAAO,aAAa,CAAA;AACtB,CAAC;AATD,8CASC","sourcesContent":["import { Plugin, PluginManager } from '../plugin'\nimport publishPlugin from '../publish'\nimport { IRunEnvironment, IRunOptions } from './types'\nimport { ILogger } from '../logger'\n\nconst INTERNAL_PLUGINS: Record<string, Plugin> = {\n publish: publishPlugin,\n}\n\nexport async function initializePlugins(\n logger: ILogger,\n configuration: IRunOptions,\n environment: IRunEnvironment\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager(Object.values(INTERNAL_PLUGINS))\n await pluginManager.init(logger, configuration, environment)\n return pluginManager\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { Envelope } from '@cucumber/messages';
2
+ import { IRunEnvironment, IRunOptions, IRunResult } from './types';
3
+ /**
4
+ * Execute a Cucumber test run.
5
+ *
6
+ * @public
7
+ * @param configuration - Configuration loaded from `loadConfiguration`.
8
+ * @param environment - Project environment.
9
+ * @param onMessage - Callback fired each time Cucumber emits a message.
10
+ */
11
+ export declare function runCucumber(configuration: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;