@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,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Definition {
4
+ constructor({ code, id, line, options, unwrappedCode, uri, }) {
5
+ this.code = code;
6
+ this.id = id;
7
+ this.line = line;
8
+ this.options = options;
9
+ this.unwrappedCode = unwrappedCode;
10
+ this.uri = uri;
11
+ }
12
+ buildInvalidCodeLengthMessage(syncOrPromiseLength, callbackLength) {
13
+ return (`function has ${this.code.length.toString()} arguments` +
14
+ `, should have ${syncOrPromiseLength.toString()} (if synchronous or returning a promise)` +
15
+ ` or ${callbackLength.toString()} (if accepting a callback)`);
16
+ }
17
+ baseGetInvalidCodeLengthMessage(parameters) {
18
+ return this.buildInvalidCodeLengthMessage(parameters.length, parameters.length + 1);
19
+ }
20
+ }
21
+ exports.default = Definition;
22
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/models/definition.ts"],"names":[],"mappings":";;AAwDA,MAA8B,UAAU;IAQtC,YAAY,EACV,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,OAAO,EACP,aAAa,EACb,GAAG,GACuC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,6BAA6B,CAC3B,mBAAoC,EACpC,cAA+B;QAE/B,OAAO,CACL,gBAAgB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY;YACvD,iBAAiB,mBAAmB,CAAC,QAAQ,EAAE,0CAA0C;YACzF,OAAO,cAAc,CAAC,QAAQ,EAAE,4BAA4B,CAC7D,CAAA;IACH,CAAC;IAED,+BAA+B,CAAC,UAAiB;QAC/C,OAAO,IAAI,CAAC,6BAA6B,CACvC,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,MAAM,GAAG,CAAC,CACtB,CAAA;IACH,CAAC;CACF;AAzCD,6BAyCC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { Expression } from '@cucumber/cucumber-expressions'\nimport { GherkinStepKeyword } from './gherkin_step_keyword'\n\nexport interface IGetInvocationDataRequest {\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n world: any\n}\n\nexport interface IGetInvocationDataResponse {\n getInvalidCodeLengthMessage: () => string\n parameters: any[]\n validCodeLengths: number[]\n}\n\nexport interface IDefinitionOptions {\n timeout?: number\n wrapperOptions?: any\n}\n\nexport interface IHookDefinitionOptions extends IDefinitionOptions {\n name?: string\n tags?: string\n}\n\nexport interface IDefinitionParameters<T extends IDefinitionOptions> {\n code: Function\n id: string\n line: number\n options: T\n unwrappedCode?: Function\n uri: string\n}\n\nexport interface IStepDefinitionParameters\n extends IDefinitionParameters<IDefinitionOptions> {\n keyword: GherkinStepKeyword\n pattern: string | RegExp\n expression: Expression\n}\n\nexport interface IDefinition {\n readonly code: Function\n readonly id: string\n readonly line: number\n readonly options: IDefinitionOptions\n readonly unwrappedCode: Function\n readonly uri: string\n\n getInvocationParameters: (\n options: IGetInvocationDataRequest\n ) => Promise<IGetInvocationDataResponse>\n}\n\nexport default abstract class Definition {\n public readonly code: Function\n public readonly id: string\n public readonly line: number\n public readonly options: IDefinitionOptions\n public readonly unwrappedCode: Function\n public readonly uri: string\n\n constructor({\n code,\n id,\n line,\n options,\n unwrappedCode,\n uri,\n }: IDefinitionParameters<IDefinitionOptions>) {\n this.code = code\n this.id = id\n this.line = line\n this.options = options\n this.unwrappedCode = unwrappedCode\n this.uri = uri\n }\n\n buildInvalidCodeLengthMessage(\n syncOrPromiseLength: number | string,\n callbackLength: number | string\n ): string {\n return (\n `function has ${this.code.length.toString()} arguments` +\n `, should have ${syncOrPromiseLength.toString()} (if synchronous or returning a promise)` +\n ` or ${callbackLength.toString()} (if accepting a callback)`\n )\n }\n\n baseGetInvalidCodeLengthMessage(parameters: any[]): string {\n return this.buildInvalidCodeLengthMessage(\n parameters.length,\n parameters.length + 1\n )\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export type GherkinStepKeyword = 'Unknown' | 'Given' | 'When' | 'Then';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=gherkin_step_keyword.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gherkin_step_keyword.js","sourceRoot":"","sources":["../../src/models/gherkin_step_keyword.ts"],"names":[],"mappings":"","sourcesContent":["export type GherkinStepKeyword = 'Unknown' | 'Given' | 'When' | 'Then'\n"]}
@@ -0,0 +1 @@
1
+ export type PickleOrder = 'defined' | 'random' | string;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=pickle_order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pickle_order.js","sourceRoot":"","sources":["../../src/models/pickle_order.ts"],"names":[],"mappings":"","sourcesContent":["export type PickleOrder = 'defined' | 'random' | string\n"]}
@@ -0,0 +1,11 @@
1
+ import Definition, { IDefinition, IGetInvocationDataRequest, IGetInvocationDataResponse, IStepDefinitionParameters } from './definition';
2
+ import { Expression } from '@cucumber/cucumber-expressions';
3
+ import { GherkinStepKeyword } from './gherkin_step_keyword';
4
+ export default class StepDefinition extends Definition implements IDefinition {
5
+ readonly keyword: GherkinStepKeyword;
6
+ readonly pattern: string | RegExp;
7
+ readonly expression: Expression;
8
+ constructor(data: IStepDefinitionParameters);
9
+ getInvocationParameters({ step, world, }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse>;
10
+ matchesStepName(stepName: string): boolean;
11
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const data_table_1 = __importDefault(require("./data_table"));
7
+ const definition_1 = __importDefault(require("./definition"));
8
+ const step_arguments_1 = require("../step_arguments");
9
+ const value_checker_1 = require("../value_checker");
10
+ class StepDefinition extends definition_1.default {
11
+ constructor(data) {
12
+ super(data);
13
+ this.keyword = data.keyword;
14
+ this.pattern = data.pattern;
15
+ this.expression = data.expression;
16
+ }
17
+ async getInvocationParameters({ step, world, }) {
18
+ const parameters = await Promise.all(this.expression.match(step.text).map((arg) => arg.getValue(world)));
19
+ if ((0, value_checker_1.doesHaveValue)(step.argument)) {
20
+ const argumentParamater = (0, step_arguments_1.parseStepArgument)(step.argument, {
21
+ dataTable: (arg) => new data_table_1.default(arg),
22
+ docString: (arg) => arg.content,
23
+ });
24
+ parameters.push(argumentParamater);
25
+ }
26
+ return {
27
+ getInvalidCodeLengthMessage: () => this.baseGetInvalidCodeLengthMessage(parameters),
28
+ parameters,
29
+ validCodeLengths: [parameters.length, parameters.length + 1],
30
+ };
31
+ }
32
+ matchesStepName(stepName) {
33
+ return (0, value_checker_1.doesHaveValue)(this.expression.match(stepName));
34
+ }
35
+ }
36
+ exports.default = StepDefinition;
37
+ //# sourceMappingURL=step_definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step_definition.js","sourceRoot":"","sources":["../../src/models/step_definition.ts"],"names":[],"mappings":";;;;;AAAA,8DAAoC;AACpC,8DAKqB;AACrB,sDAAqD;AAErD,oDAAgD;AAGhD,MAAqB,cAAe,SAAQ,oBAAU;IAKpD,YAAY,IAA+B;QACzC,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;IACnC,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,EAC5B,IAAI,EACJ,KAAK,GACqB;QAC1B,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CACnE,CAAA;QACD,IAAI,IAAA,6BAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAChC,MAAM,iBAAiB,GAAG,IAAA,kCAAiB,EAAM,IAAI,CAAC,QAAQ,EAAE;gBAC9D,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,oBAAS,CAAC,GAAG,CAAC;gBACtC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO;aAChC,CAAC,CAAA;YACF,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;SACnC;QACD,OAAO;YACL,2BAA2B,EAAE,GAAG,EAAE,CAChC,IAAI,CAAC,+BAA+B,CAAC,UAAU,CAAC;YAClD,UAAU;YACV,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;SAC7D,CAAA;IACH,CAAC;IAED,eAAe,CAAC,QAAgB;QAC9B,OAAO,IAAA,6BAAa,EAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AArCD,iCAqCC","sourcesContent":["import DataTable from './data_table'\nimport Definition, {\n IDefinition,\n IGetInvocationDataRequest,\n IGetInvocationDataResponse,\n IStepDefinitionParameters,\n} from './definition'\nimport { parseStepArgument } from '../step_arguments'\nimport { Expression } from '@cucumber/cucumber-expressions'\nimport { doesHaveValue } from '../value_checker'\nimport { GherkinStepKeyword } from './gherkin_step_keyword'\n\nexport default class StepDefinition extends Definition implements IDefinition {\n public readonly keyword: GherkinStepKeyword\n public readonly pattern: string | RegExp\n public readonly expression: Expression\n\n constructor(data: IStepDefinitionParameters) {\n super(data)\n this.keyword = data.keyword\n this.pattern = data.pattern\n this.expression = data.expression\n }\n\n async getInvocationParameters({\n step,\n world,\n }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse> {\n const parameters = await Promise.all(\n this.expression.match(step.text).map((arg) => arg.getValue(world))\n )\n if (doesHaveValue(step.argument)) {\n const argumentParamater = parseStepArgument<any>(step.argument, {\n dataTable: (arg) => new DataTable(arg),\n docString: (arg) => arg.content,\n })\n parameters.push(argumentParamater)\n }\n return {\n getInvalidCodeLengthMessage: () =>\n this.baseGetInvalidCodeLengthMessage(parameters),\n parameters,\n validCodeLengths: [parameters.length, parameters.length + 1],\n }\n }\n\n matchesStepName(stepName: string): boolean {\n return doesHaveValue(this.expression.match(stepName))\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import Definition, { IDefinition, IDefinitionParameters, IGetInvocationDataRequest, IGetInvocationDataResponse, IHookDefinitionOptions } from './definition';
2
+ import * as messages from '@cucumber/messages';
3
+ export default class TestCaseHookDefinition extends Definition implements IDefinition {
4
+ readonly name: string;
5
+ readonly tagExpression: string;
6
+ private readonly pickleTagFilter;
7
+ constructor(data: IDefinitionParameters<IHookDefinitionOptions>);
8
+ appliesToTestCase(pickle: messages.Pickle): boolean;
9
+ getInvocationParameters({ hookParameter, }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse>;
10
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const pickle_filter_1 = require("../pickle_filter");
7
+ const definition_1 = __importDefault(require("./definition"));
8
+ class TestCaseHookDefinition extends definition_1.default {
9
+ constructor(data) {
10
+ super(data);
11
+ this.name = data.options.name;
12
+ this.tagExpression = data.options.tags;
13
+ this.pickleTagFilter = new pickle_filter_1.PickleTagFilter(data.options.tags);
14
+ }
15
+ appliesToTestCase(pickle) {
16
+ return this.pickleTagFilter.matchesAllTagExpressions(pickle);
17
+ }
18
+ async getInvocationParameters({ hookParameter, }) {
19
+ return await Promise.resolve({
20
+ getInvalidCodeLengthMessage: () => this.buildInvalidCodeLengthMessage('0 or 1', '2'),
21
+ parameters: [hookParameter],
22
+ validCodeLengths: [0, 1, 2],
23
+ });
24
+ }
25
+ }
26
+ exports.default = TestCaseHookDefinition;
27
+ //# sourceMappingURL=test_case_hook_definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_case_hook_definition.js","sourceRoot":"","sources":["../../src/models/test_case_hook_definition.ts"],"names":[],"mappings":";;;;;AAAA,oDAAkD;AAClD,8DAMqB;AAGrB,MAAqB,sBACnB,SAAQ,oBAAU;IAOlB,YAAY,IAAmD;QAC7D,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QACtC,IAAI,CAAC,eAAe,GAAG,IAAI,+BAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D,CAAC;IAED,iBAAiB,CAAC,MAAuB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,EAC5B,aAAa,GACa;QAC1B,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC;YAC3B,2BAA2B,EAAE,GAAG,EAAE,CAChC,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,GAAG,CAAC;YACnD,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC5B,CAAC,CAAA;IACJ,CAAC;CACF;AA7BD,yCA6BC","sourcesContent":["import { PickleTagFilter } from '../pickle_filter'\nimport Definition, {\n IDefinition,\n IDefinitionParameters,\n IGetInvocationDataRequest,\n IGetInvocationDataResponse,\n IHookDefinitionOptions,\n} from './definition'\nimport * as messages from '@cucumber/messages'\n\nexport default class TestCaseHookDefinition\n extends Definition\n implements IDefinition\n{\n public readonly name: string\n public readonly tagExpression: string\n private readonly pickleTagFilter: PickleTagFilter\n\n constructor(data: IDefinitionParameters<IHookDefinitionOptions>) {\n super(data)\n this.name = data.options.name\n this.tagExpression = data.options.tags\n this.pickleTagFilter = new PickleTagFilter(data.options.tags)\n }\n\n appliesToTestCase(pickle: messages.Pickle): boolean {\n return this.pickleTagFilter.matchesAllTagExpressions(pickle)\n }\n\n async getInvocationParameters({\n hookParameter,\n }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse> {\n return await Promise.resolve({\n getInvalidCodeLengthMessage: () =>\n this.buildInvalidCodeLengthMessage('0 or 1', '2'),\n parameters: [hookParameter],\n validCodeLengths: [0, 1, 2],\n })\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import Definition from './definition';
2
+ export default class TestRunHookDefinition extends Definition {
3
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const definition_1 = __importDefault(require("./definition"));
7
+ class TestRunHookDefinition extends definition_1.default {
8
+ }
9
+ exports.default = TestRunHookDefinition;
10
+ //# sourceMappingURL=test_run_hook_definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_run_hook_definition.js","sourceRoot":"","sources":["../../src/models/test_run_hook_definition.ts"],"names":[],"mappings":";;;;;AAAA,8DAAqC;AAErC,MAAqB,qBAAsB,SAAQ,oBAAU;CAAG;AAAhE,wCAAgE","sourcesContent":["import Definition from './definition'\n\nexport default class TestRunHookDefinition extends Definition {}\n"]}
@@ -0,0 +1,9 @@
1
+ import Definition, { IDefinition, IGetInvocationDataResponse, IGetInvocationDataRequest, IDefinitionParameters, IHookDefinitionOptions } from './definition';
2
+ import * as messages from '@cucumber/messages';
3
+ export default class TestStepHookDefinition extends Definition implements IDefinition {
4
+ readonly tagExpression: string;
5
+ private readonly pickleTagFilter;
6
+ constructor(data: IDefinitionParameters<IHookDefinitionOptions>);
7
+ appliesToTestCase(pickle: messages.Pickle): boolean;
8
+ getInvocationParameters({ hookParameter, }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse>;
9
+ }
@@ -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
+ const pickle_filter_1 = require("../pickle_filter");
7
+ const definition_1 = __importDefault(require("./definition"));
8
+ class TestStepHookDefinition extends definition_1.default {
9
+ constructor(data) {
10
+ super(data);
11
+ this.tagExpression = data.options.tags;
12
+ this.pickleTagFilter = new pickle_filter_1.PickleTagFilter(data.options.tags);
13
+ }
14
+ appliesToTestCase(pickle) {
15
+ return this.pickleTagFilter.matchesAllTagExpressions(pickle);
16
+ }
17
+ async getInvocationParameters({ hookParameter, }) {
18
+ return await Promise.resolve({
19
+ getInvalidCodeLengthMessage: () => this.buildInvalidCodeLengthMessage('0 or 1', '2'),
20
+ parameters: [hookParameter],
21
+ validCodeLengths: [0, 1, 2],
22
+ });
23
+ }
24
+ }
25
+ exports.default = TestStepHookDefinition;
26
+ //# sourceMappingURL=test_step_hook_definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_step_hook_definition.js","sourceRoot":"","sources":["../../src/models/test_step_hook_definition.ts"],"names":[],"mappings":";;;;;AAAA,oDAAkD;AAClD,8DAMqB;AAGrB,MAAqB,sBACnB,SAAQ,oBAAU;IAMlB,YAAY,IAAmD;QAC7D,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QACtC,IAAI,CAAC,eAAe,GAAG,IAAI,+BAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D,CAAC;IAED,iBAAiB,CAAC,MAAuB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,EAC5B,aAAa,GACa;QAC1B,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC;YAC3B,2BAA2B,EAAE,GAAG,EAAE,CAChC,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,GAAG,CAAC;YACnD,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC5B,CAAC,CAAA;IACJ,CAAC;CACF;AA3BD,yCA2BC","sourcesContent":["import { PickleTagFilter } from '../pickle_filter'\nimport Definition, {\n IDefinition,\n IGetInvocationDataResponse,\n IGetInvocationDataRequest,\n IDefinitionParameters,\n IHookDefinitionOptions,\n} from './definition'\nimport * as messages from '@cucumber/messages'\n\nexport default class TestStepHookDefinition\n extends Definition\n implements IDefinition\n{\n public readonly tagExpression: string\n private readonly pickleTagFilter: PickleTagFilter\n\n constructor(data: IDefinitionParameters<IHookDefinitionOptions>) {\n super(data)\n this.tagExpression = data.options.tags\n this.pickleTagFilter = new PickleTagFilter(data.options.tags)\n }\n\n appliesToTestCase(pickle: messages.Pickle): boolean {\n return this.pickleTagFilter.matchesAllTagExpressions(pickle)\n }\n\n async getInvocationParameters({\n hookParameter,\n }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse> {\n return await Promise.resolve({\n getInvalidCodeLengthMessage: () =>\n this.buildInvalidCodeLengthMessage('0 or 1', '2'),\n parameters: [hookParameter],\n validCodeLengths: [0, 1, 2],\n })\n }\n}\n"]}
@@ -0,0 +1,42 @@
1
+ import * as messages from '@cucumber/messages';
2
+ import IGherkinDocument = messages.GherkinDocument;
3
+ import IPickle = messages.Pickle;
4
+ export interface IPickleFilterOptions {
5
+ cwd: string;
6
+ featurePaths?: string[];
7
+ names?: string[];
8
+ tagExpression?: string;
9
+ }
10
+ export interface IMatchesAnyLineRequest {
11
+ gherkinDocument: messages.GherkinDocument;
12
+ pickle: messages.Pickle;
13
+ }
14
+ export default class PickleFilter {
15
+ private readonly lineFilter;
16
+ private readonly nameFilter;
17
+ private readonly tagFilter;
18
+ constructor({ cwd, featurePaths, names, tagExpression, }: IPickleFilterOptions);
19
+ matches({ gherkinDocument, pickle, }: {
20
+ gherkinDocument: IGherkinDocument;
21
+ pickle: IPickle;
22
+ }): boolean;
23
+ }
24
+ export declare class PickleLineFilter {
25
+ private readonly featureUriToLinesMapping;
26
+ constructor(cwd: string, featurePaths?: string[]);
27
+ getFeatureUriToLinesMapping({ cwd, featurePaths, }: {
28
+ cwd: string;
29
+ featurePaths: string[];
30
+ }): Record<string, number[]>;
31
+ matchesAnyLine({ gherkinDocument, pickle }: IMatchesAnyLineRequest): boolean;
32
+ }
33
+ export declare class PickleNameFilter {
34
+ private readonly names;
35
+ constructor(names?: string[]);
36
+ matchesAnyName(pickle: messages.Pickle): boolean;
37
+ }
38
+ export declare class PickleTagFilter {
39
+ private readonly tagExpressionNode;
40
+ constructor(tagExpression: string);
41
+ matchesAllTagExpressions(pickle: messages.Pickle): boolean;
42
+ }
@@ -0,0 +1,99 @@
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.PickleTagFilter = exports.PickleNameFilter = exports.PickleLineFilter = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const tag_expressions_1 = __importDefault(require("@cucumber/tag-expressions"));
9
+ const gherkin_document_parser_1 = require("./formatter/helpers/gherkin_document_parser");
10
+ const value_checker_1 = require("./value_checker");
11
+ const FEATURE_LINENUM_REGEXP = /^(.*?)((?::[\d]+)+)?$/;
12
+ class PickleFilter {
13
+ constructor({ cwd, featurePaths, names, tagExpression, }) {
14
+ this.lineFilter = new PickleLineFilter(cwd, featurePaths);
15
+ this.nameFilter = new PickleNameFilter(names);
16
+ this.tagFilter = new PickleTagFilter(tagExpression);
17
+ }
18
+ matches({ gherkinDocument, pickle, }) {
19
+ return (this.lineFilter.matchesAnyLine({ gherkinDocument, pickle }) &&
20
+ this.nameFilter.matchesAnyName(pickle) &&
21
+ this.tagFilter.matchesAllTagExpressions(pickle));
22
+ }
23
+ }
24
+ exports.default = PickleFilter;
25
+ class PickleLineFilter {
26
+ constructor(cwd, featurePaths = []) {
27
+ this.featureUriToLinesMapping = this.getFeatureUriToLinesMapping({
28
+ cwd,
29
+ featurePaths,
30
+ });
31
+ }
32
+ getFeatureUriToLinesMapping({ cwd, featurePaths, }) {
33
+ const mapping = {};
34
+ featurePaths.forEach((featurePath) => {
35
+ const match = FEATURE_LINENUM_REGEXP.exec(featurePath);
36
+ if ((0, value_checker_1.doesHaveValue)(match)) {
37
+ let uri = match[1];
38
+ if (path_1.default.isAbsolute(uri)) {
39
+ uri = path_1.default.relative(cwd, uri);
40
+ }
41
+ else {
42
+ uri = path_1.default.normalize(uri);
43
+ }
44
+ const linesExpression = match[2];
45
+ if ((0, value_checker_1.doesHaveValue)(linesExpression)) {
46
+ if ((0, value_checker_1.doesNotHaveValue)(mapping[uri])) {
47
+ mapping[uri] = [];
48
+ }
49
+ linesExpression
50
+ .slice(1)
51
+ .split(':')
52
+ .forEach((line) => {
53
+ mapping[uri].push(parseInt(line));
54
+ });
55
+ }
56
+ }
57
+ });
58
+ return mapping;
59
+ }
60
+ matchesAnyLine({ gherkinDocument, pickle }) {
61
+ const uri = path_1.default.normalize(pickle.uri);
62
+ const linesToMatch = this.featureUriToLinesMapping[uri];
63
+ if ((0, value_checker_1.doesHaveValue)(linesToMatch)) {
64
+ const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
65
+ const pickleLines = new Set(pickle.astNodeIds.map((sourceId) => gherkinScenarioLocationMap[sourceId].line));
66
+ const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x));
67
+ return linesIntersection.length > 0;
68
+ }
69
+ return true;
70
+ }
71
+ }
72
+ exports.PickleLineFilter = PickleLineFilter;
73
+ class PickleNameFilter {
74
+ constructor(names = []) {
75
+ this.names = names;
76
+ }
77
+ matchesAnyName(pickle) {
78
+ if (this.names.length === 0) {
79
+ return true;
80
+ }
81
+ return this.names.some((name) => pickle.name.match(name));
82
+ }
83
+ }
84
+ exports.PickleNameFilter = PickleNameFilter;
85
+ class PickleTagFilter {
86
+ constructor(tagExpression) {
87
+ if ((0, value_checker_1.doesHaveValue)(tagExpression) && tagExpression !== '') {
88
+ this.tagExpressionNode = (0, tag_expressions_1.default)(tagExpression);
89
+ }
90
+ }
91
+ matchesAllTagExpressions(pickle) {
92
+ if ((0, value_checker_1.doesNotHaveValue)(this.tagExpressionNode)) {
93
+ return true;
94
+ }
95
+ return this.tagExpressionNode.evaluate(pickle.tags.map((x) => x.name));
96
+ }
97
+ }
98
+ exports.PickleTagFilter = PickleTagFilter;
99
+ //# sourceMappingURL=pickle_filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pickle_filter.js","sourceRoot":"","sources":["../src/pickle_filter.ts"],"names":[],"mappings":"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","sourcesContent":["import path from 'path'\nimport parse from '@cucumber/tag-expressions'\nimport { getGherkinScenarioLocationMap } from './formatter/helpers/gherkin_document_parser'\nimport { doesHaveValue, doesNotHaveValue } from './value_checker'\nimport * as messages from '@cucumber/messages'\nimport IGherkinDocument = messages.GherkinDocument\nimport IPickle = messages.Pickle\n\nconst FEATURE_LINENUM_REGEXP = /^(.*?)((?::[\\d]+)+)?$/\n\nexport interface IPickleFilterOptions {\n cwd: string\n featurePaths?: string[]\n names?: string[]\n tagExpression?: string\n}\n\nexport interface IMatchesAnyLineRequest {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n}\n\nexport default class PickleFilter {\n private readonly lineFilter: PickleLineFilter\n private readonly nameFilter: PickleNameFilter\n private readonly tagFilter: PickleTagFilter\n\n constructor({\n cwd,\n featurePaths,\n names,\n tagExpression,\n }: IPickleFilterOptions) {\n this.lineFilter = new PickleLineFilter(cwd, featurePaths)\n this.nameFilter = new PickleNameFilter(names)\n this.tagFilter = new PickleTagFilter(tagExpression)\n }\n\n matches({\n gherkinDocument,\n pickle,\n }: {\n gherkinDocument: IGherkinDocument\n pickle: IPickle\n }): boolean {\n return (\n this.lineFilter.matchesAnyLine({ gherkinDocument, pickle }) &&\n this.nameFilter.matchesAnyName(pickle) &&\n this.tagFilter.matchesAllTagExpressions(pickle)\n )\n }\n}\n\nexport class PickleLineFilter {\n private readonly featureUriToLinesMapping: Record<string, number[]>\n\n constructor(cwd: string, featurePaths: string[] = []) {\n this.featureUriToLinesMapping = this.getFeatureUriToLinesMapping({\n cwd,\n featurePaths,\n })\n }\n\n getFeatureUriToLinesMapping({\n cwd,\n featurePaths,\n }: {\n cwd: string\n featurePaths: string[]\n }): Record<string, number[]> {\n const mapping: Record<string, number[]> = {}\n featurePaths.forEach((featurePath) => {\n const match = FEATURE_LINENUM_REGEXP.exec(featurePath)\n if (doesHaveValue(match)) {\n let uri = match[1]\n if (path.isAbsolute(uri)) {\n uri = path.relative(cwd, uri)\n } else {\n uri = path.normalize(uri)\n }\n const linesExpression = match[2]\n if (doesHaveValue(linesExpression)) {\n if (doesNotHaveValue(mapping[uri])) {\n mapping[uri] = []\n }\n linesExpression\n .slice(1)\n .split(':')\n .forEach((line) => {\n mapping[uri].push(parseInt(line))\n })\n }\n }\n })\n return mapping\n }\n\n matchesAnyLine({ gherkinDocument, pickle }: IMatchesAnyLineRequest): boolean {\n const uri = path.normalize(pickle.uri)\n const linesToMatch = this.featureUriToLinesMapping[uri]\n if (doesHaveValue(linesToMatch)) {\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n const pickleLines = new Set(\n pickle.astNodeIds.map(\n (sourceId) => gherkinScenarioLocationMap[sourceId].line\n )\n )\n const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x))\n return linesIntersection.length > 0\n }\n return true\n }\n}\n\nexport class PickleNameFilter {\n private readonly names: string[]\n\n constructor(names: string[] = []) {\n this.names = names\n }\n\n matchesAnyName(pickle: messages.Pickle): boolean {\n if (this.names.length === 0) {\n return true\n }\n return this.names.some((name) => pickle.name.match(name))\n }\n}\n\nexport class PickleTagFilter {\n private readonly tagExpressionNode: any // cucumber-tag-expressions does not export interface\n\n constructor(tagExpression: string) {\n if (doesHaveValue(tagExpression) && tagExpression !== '') {\n this.tagExpressionNode = parse(tagExpression)\n }\n }\n\n matchesAllTagExpressions(pickle: messages.Pickle): boolean {\n if (doesNotHaveValue(this.tagExpressionNode)) {\n return true\n }\n return this.tagExpressionNode.evaluate(pickle.tags.map((x) => x.name))\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './plugin_manager';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("./plugin_manager"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,mDAAgC","sourcesContent":["export * from './types'\nexport * from './plugin_manager'\n"]}
@@ -0,0 +1,13 @@
1
+ import { Plugin, PluginEvents } from './types';
2
+ import { IRunEnvironment, IRunOptions } from '../api';
3
+ import { ILogger } from '../logger';
4
+ export declare class PluginManager {
5
+ private pluginFns;
6
+ private handlers;
7
+ private cleanupFns;
8
+ constructor(pluginFns: Plugin[]);
9
+ private register;
10
+ init(logger: ILogger, configuration: IRunOptions, environment: IRunEnvironment): Promise<void>;
11
+ emit<K extends keyof PluginEvents>(event: K, value: PluginEvents[K]): void;
12
+ cleanup(): Promise<void>;
13
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginManager = void 0;
4
+ class PluginManager {
5
+ constructor(pluginFns) {
6
+ this.pluginFns = pluginFns;
7
+ this.handlers = { message: [] };
8
+ this.cleanupFns = [];
9
+ }
10
+ async register(event, handler) {
11
+ this.handlers[event].push(handler);
12
+ }
13
+ async init(logger, configuration, environment) {
14
+ for (const pluginFn of this.pluginFns) {
15
+ const cleanupFn = await pluginFn({
16
+ on: this.register.bind(this),
17
+ logger,
18
+ configuration,
19
+ environment,
20
+ });
21
+ if (cleanupFn) {
22
+ this.cleanupFns.push(cleanupFn);
23
+ }
24
+ }
25
+ }
26
+ emit(event, value) {
27
+ this.handlers[event].forEach((handler) => handler(value));
28
+ }
29
+ async cleanup() {
30
+ for (const cleanupFn of this.cleanupFns) {
31
+ await cleanupFn();
32
+ }
33
+ }
34
+ }
35
+ exports.PluginManager = PluginManager;
36
+ //# sourceMappingURL=plugin_manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin_manager.js","sourceRoot":"","sources":["../../src/plugin/plugin_manager.ts"],"names":[],"mappings":";;;AAQA,MAAa,aAAa;IAIxB,YAAoB,SAAmB;QAAnB,cAAS,GAAT,SAAS,CAAU;QAH/B,aAAQ,GAAoB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;QAC3C,eAAU,GAAoB,EAAE,CAAA;IAEE,CAAC;IAEnC,KAAK,CAAC,QAAQ,CACpB,KAAQ,EACR,OAAyC;QAEzC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;IAED,KAAK,CAAC,IAAI,CACR,MAAe,EACf,aAA0B,EAC1B,WAA4B;QAE5B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE;YACrC,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC;gBAC/B,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC5B,MAAM;gBACN,aAAa;gBACb,WAAW;aACZ,CAAC,CAAA;YACF,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;aAChC;SACF;IACH,CAAC;IAED,IAAI,CAA+B,KAAQ,EAAE,KAAsB;QACjE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,OAAO;QACX,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE;YACvC,MAAM,SAAS,EAAE,CAAA;SAClB;IACH,CAAC;CACF;AAxCD,sCAwCC","sourcesContent":["import { Plugin, PluginCleanup, PluginEvents } from './types'\nimport { IRunEnvironment, IRunOptions } from '../api'\nimport { ILogger } from '../logger'\n\ntype HandlerRegistry = {\n [K in keyof PluginEvents]: Array<(value: PluginEvents[K]) => void>\n}\n\nexport class PluginManager {\n private handlers: HandlerRegistry = { message: [] }\n private cleanupFns: PluginCleanup[] = []\n\n constructor(private pluginFns: Plugin[]) {}\n\n private async register<K extends keyof PluginEvents>(\n event: K,\n handler: (value: PluginEvents[K]) => void\n ) {\n this.handlers[event].push(handler)\n }\n\n async init(\n logger: ILogger,\n configuration: IRunOptions,\n environment: IRunEnvironment\n ) {\n for (const pluginFn of this.pluginFns) {\n const cleanupFn = await pluginFn({\n on: this.register.bind(this),\n logger,\n configuration,\n environment,\n })\n if (cleanupFn) {\n this.cleanupFns.push(cleanupFn)\n }\n }\n }\n\n emit<K extends keyof PluginEvents>(event: K, value: PluginEvents[K]): void {\n this.handlers[event].forEach((handler) => handler(value))\n }\n\n async cleanup(): Promise<void> {\n for (const cleanupFn of this.cleanupFns) {\n await cleanupFn()\n }\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { IRunEnvironment, IRunOptions } from '../api';
2
+ import { Envelope } from '@cucumber/messages';
3
+ import { ILogger } from '../logger';
4
+ export interface PluginEvents {
5
+ message: Envelope;
6
+ }
7
+ export interface PluginContext {
8
+ on: <K extends keyof PluginEvents>(event: K, handler: (value: PluginEvents[K]) => void) => void;
9
+ logger: ILogger;
10
+ configuration: IRunOptions;
11
+ environment: IRunEnvironment;
12
+ }
13
+ export type PluginCleanup = () => any | void | Promise<any | void>;
14
+ export type Plugin = (context: PluginContext) => Promise<PluginCleanup | void>;
@@ -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/plugin/types.ts"],"names":[],"mappings":"","sourcesContent":["import { IRunEnvironment, IRunOptions } from '../api'\nimport { Envelope } from '@cucumber/messages'\nimport { ILogger } from '../logger'\n\nexport interface PluginEvents {\n message: Envelope\n}\n\nexport interface PluginContext {\n on: <K extends keyof PluginEvents>(\n event: K,\n handler: (value: PluginEvents[K]) => void\n ) => void\n logger: ILogger\n configuration: IRunOptions\n environment: IRunEnvironment\n}\n\nexport type PluginCleanup = () => any | void | Promise<any | void>\n\nexport type Plugin = (context: PluginContext) => Promise<PluginCleanup | void>\n"]}
@@ -0,0 +1,30 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { Transform } from 'stream';
5
+ import http from 'http';
6
+ type HttpMethod = 'GET' | 'POST' | 'PUT';
7
+ /**
8
+ * This Writable writes data to a HTTP/HTTPS URL.
9
+ *
10
+ * It has special handling for https://reports.cucumber.io/
11
+ * which uses an API where the first request is a `GET`,
12
+ * and if the response is 202 with a Location header, issues
13
+ * a PUT request to that URL.
14
+ *
15
+ * 3xx redirects are not currently followed.
16
+ */
17
+ export default class HttpStream extends Transform {
18
+ private readonly url;
19
+ private readonly method;
20
+ private readonly headers;
21
+ private tempFilePath;
22
+ private tempFile;
23
+ constructor(url: string, method: HttpMethod, headers: http.OutgoingHttpHeaders);
24
+ _write(chunk: any, encoding: BufferEncoding, callback: (err?: Error | null) => void): void;
25
+ _final(callback: (error?: Error | null) => void): void;
26
+ private pushResponseBody;
27
+ private emitErrorUnlessHttp2xx;
28
+ private sendHttpRequest;
29
+ }
30
+ export {};