@cucumber/cucumber 7.3.0 → 8.0.0-rc.2

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 (197) hide show
  1. package/README.md +11 -4
  2. package/lib/cli/argv_parser.d.ts +3 -3
  3. package/lib/cli/argv_parser.js +19 -19
  4. package/lib/cli/argv_parser.js.map +1 -1
  5. package/lib/cli/configuration_builder.d.ts +5 -46
  6. package/lib/cli/configuration_builder.js +61 -150
  7. package/lib/cli/configuration_builder.js.map +1 -1
  8. package/lib/cli/helpers.d.ts +5 -3
  9. package/lib/cli/helpers.js +42 -15
  10. package/lib/cli/helpers.js.map +1 -1
  11. package/lib/cli/i18n.js +7 -7
  12. package/lib/cli/i18n.js.map +1 -1
  13. package/lib/cli/index.d.ts +4 -23
  14. package/lib/cli/index.js +18 -193
  15. package/lib/cli/index.js.map +1 -1
  16. package/lib/cli/install_validator.js +1 -1
  17. package/lib/cli/install_validator.js.map +1 -1
  18. package/lib/cli/option_splitter.js +1 -0
  19. package/lib/cli/option_splitter.js.map +1 -1
  20. package/lib/cli/profile_loader.d.ts +3 -2
  21. package/lib/cli/profile_loader.js +20 -13
  22. package/lib/cli/profile_loader.js.map +1 -1
  23. package/lib/cli/publish_banner.js +1 -1
  24. package/lib/cli/publish_banner.js.map +1 -1
  25. package/lib/cli/run.js +3 -4
  26. package/lib/cli/run.js.map +1 -1
  27. package/lib/configuration/index.d.ts +1 -0
  28. package/lib/configuration/index.js +14 -0
  29. package/lib/configuration/index.js.map +1 -0
  30. package/lib/configuration/types.d.ts +29 -0
  31. package/lib/configuration/types.js +3 -0
  32. package/lib/configuration/types.js.map +1 -0
  33. package/lib/formatter/builder.d.ts +5 -4
  34. package/lib/formatter/builder.js +41 -55
  35. package/lib/formatter/builder.js.map +1 -1
  36. package/lib/formatter/get_color_fns.d.ts +4 -0
  37. package/lib/formatter/get_color_fns.js +11 -4
  38. package/lib/formatter/get_color_fns.js.map +1 -1
  39. package/lib/formatter/helpers/event_data_collector.d.ts +2 -1
  40. package/lib/formatter/helpers/event_data_collector.js +16 -15
  41. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  42. package/lib/formatter/helpers/formatters.d.ts +6 -0
  43. package/lib/formatter/helpers/formatters.js +41 -0
  44. package/lib/formatter/helpers/formatters.js.map +1 -0
  45. package/lib/formatter/helpers/gherkin_document_parser.js +29 -42
  46. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
  47. package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
  48. package/lib/formatter/helpers/issue_helpers.js +6 -7
  49. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  50. package/lib/formatter/helpers/keyword_type.js +2 -6
  51. package/lib/formatter/helpers/keyword_type.js.map +1 -1
  52. package/lib/formatter/helpers/location_helpers.js +1 -1
  53. package/lib/formatter/helpers/location_helpers.js.map +1 -1
  54. package/lib/formatter/helpers/pickle_parser.js +9 -18
  55. package/lib/formatter/helpers/pickle_parser.js.map +1 -1
  56. package/lib/formatter/helpers/step_argument_formatter.js +1 -1
  57. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
  58. package/lib/formatter/helpers/summary_helpers.js +8 -7
  59. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  60. package/lib/formatter/helpers/test_case_attempt_formatter.js +12 -12
  61. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  62. package/lib/formatter/helpers/test_case_attempt_parser.js +17 -20
  63. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  64. package/lib/formatter/helpers/usage_helpers/index.js +26 -40
  65. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  66. package/lib/formatter/html_formatter.d.ts +1 -0
  67. package/lib/formatter/html_formatter.js +5 -4
  68. package/lib/formatter/html_formatter.js.map +1 -1
  69. package/lib/formatter/http_stream.js +7 -7
  70. package/lib/formatter/http_stream.js.map +1 -1
  71. package/lib/formatter/index.d.ts +1 -0
  72. package/lib/formatter/index.js.map +1 -1
  73. package/lib/formatter/json_formatter.d.ts +1 -0
  74. package/lib/formatter/json_formatter.js +25 -20
  75. package/lib/formatter/json_formatter.js.map +1 -1
  76. package/lib/formatter/message_formatter.d.ts +1 -0
  77. package/lib/formatter/message_formatter.js +1 -0
  78. package/lib/formatter/message_formatter.js.map +1 -1
  79. package/lib/formatter/progress_bar_formatter.d.ts +1 -0
  80. package/lib/formatter/progress_bar_formatter.js +17 -16
  81. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  82. package/lib/formatter/progress_formatter.d.ts +1 -0
  83. package/lib/formatter/progress_formatter.js +3 -2
  84. package/lib/formatter/progress_formatter.js.map +1 -1
  85. package/lib/formatter/publish.d.ts +1 -0
  86. package/lib/formatter/publish.js +5 -0
  87. package/lib/formatter/publish.js.map +1 -0
  88. package/lib/formatter/rerun_formatter.d.ts +1 -0
  89. package/lib/formatter/rerun_formatter.js +15 -11
  90. package/lib/formatter/rerun_formatter.js.map +1 -1
  91. package/lib/formatter/snippets_formatter.d.ts +1 -0
  92. package/lib/formatter/snippets_formatter.js +3 -2
  93. package/lib/formatter/snippets_formatter.js.map +1 -1
  94. package/lib/formatter/step_definition_snippet_builder/index.js +2 -2
  95. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
  96. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
  97. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  98. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
  99. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
  100. package/lib/formatter/summary_formatter.d.ts +1 -0
  101. package/lib/formatter/summary_formatter.js +10 -10
  102. package/lib/formatter/summary_formatter.js.map +1 -1
  103. package/lib/formatter/usage_formatter.d.ts +1 -0
  104. package/lib/formatter/usage_formatter.js +9 -9
  105. package/lib/formatter/usage_formatter.js.map +1 -1
  106. package/lib/formatter/usage_json_formatter.d.ts +1 -0
  107. package/lib/formatter/usage_json_formatter.js +3 -2
  108. package/lib/formatter/usage_json_formatter.js.map +1 -1
  109. package/lib/importer.js +13 -0
  110. package/lib/index.d.ts +2 -0
  111. package/lib/index.js +6 -1
  112. package/lib/index.js.map +1 -1
  113. package/lib/models/data_table.js +9 -7
  114. package/lib/models/data_table.js.map +1 -1
  115. package/lib/models/step_definition.js +4 -5
  116. package/lib/models/step_definition.js.map +1 -1
  117. package/lib/pickle_filter.js +13 -13
  118. package/lib/pickle_filter.js.map +1 -1
  119. package/lib/run/formatters.d.ts +14 -0
  120. package/lib/run/formatters.js +76 -0
  121. package/lib/run/formatters.js.map +1 -0
  122. package/lib/run/index.d.ts +2 -0
  123. package/lib/run/index.js +15 -0
  124. package/lib/run/index.js.map +1 -0
  125. package/lib/run/paths.d.ts +6 -0
  126. package/lib/run/paths.js +83 -0
  127. package/lib/run/paths.js.map +1 -0
  128. package/lib/run/runCucumber.d.ts +3 -0
  129. package/lib/run/runCucumber.js +88 -0
  130. package/lib/run/runCucumber.js.map +1 -0
  131. package/lib/run/runtime.d.ts +19 -0
  132. package/lib/run/runtime.js +58 -0
  133. package/lib/run/runtime.js.map +1 -0
  134. package/lib/run/support.d.ts +8 -0
  135. package/lib/run/support.js +26 -0
  136. package/lib/run/support.js.map +1 -0
  137. package/lib/run/types.d.ts +12 -0
  138. package/lib/run/types.js +3 -0
  139. package/lib/run/types.js.map +1 -0
  140. package/lib/runtime/assemble_test_cases.js +3 -3
  141. package/lib/runtime/assemble_test_cases.js.map +1 -1
  142. package/lib/runtime/attachment_manager/index.js +4 -4
  143. package/lib/runtime/attachment_manager/index.js.map +1 -1
  144. package/lib/runtime/helpers.d.ts +1 -0
  145. package/lib/runtime/helpers.js +42 -4
  146. package/lib/runtime/helpers.js.map +1 -1
  147. package/lib/runtime/index.d.ts +5 -3
  148. package/lib/runtime/index.js +22 -46
  149. package/lib/runtime/index.js.map +1 -1
  150. package/lib/runtime/parallel/coordinator.d.ts +6 -5
  151. package/lib/runtime/parallel/coordinator.js +19 -22
  152. package/lib/runtime/parallel/coordinator.js.map +1 -1
  153. package/lib/runtime/parallel/run_worker.js +1 -1
  154. package/lib/runtime/parallel/run_worker.js.map +1 -1
  155. package/lib/runtime/parallel/worker.js +21 -13
  156. package/lib/runtime/parallel/worker.js.map +1 -1
  157. package/lib/runtime/step_runner.js +5 -7
  158. package/lib/runtime/step_runner.js.map +1 -1
  159. package/lib/runtime/stopwatch.js +4 -4
  160. package/lib/runtime/stopwatch.js.map +1 -1
  161. package/lib/runtime/test_case_runner.d.ts +3 -3
  162. package/lib/runtime/test_case_runner.js +19 -28
  163. package/lib/runtime/test_case_runner.js.map +1 -1
  164. package/lib/stack_trace_filter.js +6 -7
  165. package/lib/stack_trace_filter.js.map +1 -1
  166. package/lib/step_arguments.js +2 -2
  167. package/lib/step_arguments.js.map +1 -1
  168. package/lib/support_code_library_builder/{build_helpers.d.ts → build_parameter_type.d.ts} +0 -2
  169. package/lib/support_code_library_builder/build_parameter_type.js +13 -0
  170. package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
  171. package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
  172. package/lib/support_code_library_builder/get_definition_line_and_uri.js +30 -0
  173. package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
  174. package/lib/support_code_library_builder/index.js +18 -31
  175. package/lib/support_code_library_builder/index.js.map +1 -1
  176. package/lib/support_code_library_builder/types.d.ts +2 -1
  177. package/lib/support_code_library_builder/types.js.map +1 -1
  178. package/lib/support_code_library_builder/validate_arguments.js +14 -19
  179. package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
  180. package/lib/time.d.ts +1 -0
  181. package/lib/time.js +17 -2
  182. package/lib/time.js.map +1 -1
  183. package/lib/user_code_runner.js +10 -17
  184. package/lib/user_code_runner.js.map +1 -1
  185. package/lib/value_checker.d.ts +2 -2
  186. package/lib/value_checker.js.map +1 -1
  187. package/lib/version.d.ts +1 -0
  188. package/lib/version.js +6 -0
  189. package/lib/version.js.map +1 -0
  190. package/lib/wrapper.mjs +38 -0
  191. package/package.json +77 -67
  192. package/CHANGELOG.md +0 -1908
  193. package/lib/support_code_library_builder/build_helpers.js +0 -41
  194. package/lib/support_code_library_builder/build_helpers.js.map +0 -1
  195. package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
  196. package/lib/support_code_library_builder/finalize_helpers.js +0 -26
  197. package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/index.ts"],"names":[],"mappings":";;AAAA,wCAAwC;AACxC,yDAAwD;AAExD,yEAGuC;AAEvC,uDAAmD;AAYnD,MAAqB,4BAA4B;IAI/C,YAAY,EACV,aAAa,EACb,qBAAqB,GACmB;QACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,2BAA2B,GAAG,IAAI,kDAA2B,CAChE,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAC3C,CAAA;IACH,CAAC;IAED,KAAK,CAAC,EAAE,WAAW,EAAE,UAAU,EAAiB;QAC9C,MAAM,OAAO,GACX,mEAAmE,CAAA;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QACtD,MAAM,oBAAoB,GACxB,IAAI,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACvE,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;QACjE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YAC9B,OAAO;YACP,YAAY;YACZ,oBAAoB;YACpB,kBAAkB;SACnB,CAAC,CAAA;IACJ,CAAC;IAED,eAAe,CAAC,WAAwB;QACtC,QAAQ,WAAW,EAAE;YACnB,KAAK,qBAAW,CAAC,KAAK;gBACpB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,OAAO;gBACtB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,YAAY;gBAC3B,OAAO,OAAO,CAAA;SACjB;IACH,CAAC;IAED,qBAAqB,CAAC,IAAyB;QAC7C,IAAI,6BAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAChC,MAAM,YAAY,GAAG,kCAAiB,CAAC,IAAI,CAAC,QAAQ,EAAE;gBACpD,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;gBAC5B,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;aAC7B,CAAC,CAAA;YACF,OAAO,CAAC,YAAY,CAAC,CAAA;SACtB;QACD,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAlDD,+CAkDC","sourcesContent":["import { KeywordType } from '../helpers'\nimport { parseStepArgument } from '../../step_arguments'\nimport { ISnippetSnytax } from './snippet_syntax'\nimport {\n CucumberExpressionGenerator,\n ParameterTypeRegistry,\n} from '@cucumber/cucumber-expressions'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport interface INewStepDefinitionSnippetBuilderOptions {\n snippetSyntax: ISnippetSnytax\n parameterTypeRegistry: ParameterTypeRegistry\n}\n\nexport interface IBuildRequest {\n keywordType: KeywordType\n pickleStep: messages.PickleStep\n}\n\nexport default class StepDefinitionSnippetBuilder {\n private readonly snippetSyntax: ISnippetSnytax\n private readonly cucumberExpressionGenerator: CucumberExpressionGenerator\n\n constructor({\n snippetSyntax,\n parameterTypeRegistry,\n }: INewStepDefinitionSnippetBuilderOptions) {\n this.snippetSyntax = snippetSyntax\n this.cucumberExpressionGenerator = new CucumberExpressionGenerator(\n () => parameterTypeRegistry.parameterTypes\n )\n }\n\n build({ keywordType, pickleStep }: IBuildRequest): string {\n const comment =\n 'Write code here that turns the phrase above into concrete actions'\n const functionName = this.getFunctionName(keywordType)\n const generatedExpressions =\n this.cucumberExpressionGenerator.generateExpressions(pickleStep.text)\n const stepParameterNames = this.getStepParameterNames(pickleStep)\n return this.snippetSyntax.build({\n comment,\n functionName,\n generatedExpressions,\n stepParameterNames,\n })\n }\n\n getFunctionName(keywordType: KeywordType): string {\n switch (keywordType) {\n case KeywordType.Event:\n return 'When'\n case KeywordType.Outcome:\n return 'Then'\n case KeywordType.Precondition:\n return 'Given'\n }\n }\n\n getStepParameterNames(step: messages.PickleStep): string[] {\n if (doesHaveValue(step.argument)) {\n const argumentName = parseStepArgument(step.argument, {\n dataTable: () => 'dataTable',\n docString: () => 'docString',\n })\n return [argumentName]\n }\n return []\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/index.ts"],"names":[],"mappings":";;AAAA,wCAAwC;AACxC,yDAAwD;AAExD,yEAGuC;AAEvC,uDAAmD;AAYnD,MAAqB,4BAA4B;IAI/C,YAAY,EACV,aAAa,EACb,qBAAqB,GACmB;QACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,2BAA2B,GAAG,IAAI,kDAA2B,CAChE,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAC3C,CAAA;IACH,CAAC;IAED,KAAK,CAAC,EAAE,WAAW,EAAE,UAAU,EAAiB;QAC9C,MAAM,OAAO,GACX,mEAAmE,CAAA;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QACtD,MAAM,oBAAoB,GACxB,IAAI,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACvE,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;QACjE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YAC9B,OAAO;YACP,YAAY;YACZ,oBAAoB;YACpB,kBAAkB;SACnB,CAAC,CAAA;IACJ,CAAC;IAED,eAAe,CAAC,WAAwB;QACtC,QAAQ,WAAW,EAAE;YACnB,KAAK,qBAAW,CAAC,KAAK;gBACpB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,OAAO;gBACtB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,YAAY;gBAC3B,OAAO,OAAO,CAAA;SACjB;IACH,CAAC;IAED,qBAAqB,CAAC,IAAyB;QAC7C,IAAI,IAAA,6BAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAChC,MAAM,YAAY,GAAG,IAAA,kCAAiB,EAAC,IAAI,CAAC,QAAQ,EAAE;gBACpD,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;gBAC5B,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;aAC7B,CAAC,CAAA;YACF,OAAO,CAAC,YAAY,CAAC,CAAA;SACtB;QACD,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAlDD,+CAkDC","sourcesContent":["import { KeywordType } from '../helpers'\nimport { parseStepArgument } from '../../step_arguments'\nimport { ISnippetSnytax } from './snippet_syntax'\nimport {\n CucumberExpressionGenerator,\n ParameterTypeRegistry,\n} from '@cucumber/cucumber-expressions'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport interface INewStepDefinitionSnippetBuilderOptions {\n snippetSyntax: ISnippetSnytax\n parameterTypeRegistry: ParameterTypeRegistry\n}\n\nexport interface IBuildRequest {\n keywordType: KeywordType\n pickleStep: messages.PickleStep\n}\n\nexport default class StepDefinitionSnippetBuilder {\n private readonly snippetSyntax: ISnippetSnytax\n private readonly cucumberExpressionGenerator: CucumberExpressionGenerator\n\n constructor({\n snippetSyntax,\n parameterTypeRegistry,\n }: INewStepDefinitionSnippetBuilderOptions) {\n this.snippetSyntax = snippetSyntax\n this.cucumberExpressionGenerator = new CucumberExpressionGenerator(\n () => parameterTypeRegistry.parameterTypes\n )\n }\n\n build({ keywordType, pickleStep }: IBuildRequest): string {\n const comment =\n 'Write code here that turns the phrase above into concrete actions'\n const functionName = this.getFunctionName(keywordType)\n const generatedExpressions =\n this.cucumberExpressionGenerator.generateExpressions(pickleStep.text)\n const stepParameterNames = this.getStepParameterNames(pickleStep)\n return this.snippetSyntax.build({\n comment,\n functionName,\n generatedExpressions,\n stepParameterNames,\n })\n }\n\n getFunctionName(keywordType: KeywordType): string {\n switch (keywordType) {\n case KeywordType.Event:\n return 'When'\n case KeywordType.Outcome:\n return 'Then'\n case KeywordType.Precondition:\n return 'Given'\n }\n }\n\n getStepParameterNames(step: messages.PickleStep): string[] {\n if (doesHaveValue(step.argument)) {\n const argumentName = parseStepArgument(step.argument, {\n dataTable: () => 'dataTable',\n docString: () => 'docString',\n })\n return [argumentName]\n }\n return []\n }\n}\n"]}
@@ -18,6 +18,9 @@ class JavaScriptSnippetSyntax {
18
18
  if (this.snippetInterface === snippet_syntax_1.SnippetInterface.Callback) {
19
19
  implementation = `${CALLBACK_NAME}(null, 'pending');`;
20
20
  }
21
+ else if (this.snippetInterface === snippet_syntax_1.SnippetInterface.Promise) {
22
+ implementation = "return Promise.resolve('pending');";
23
+ }
21
24
  else {
22
25
  implementation = "return 'pending';";
23
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"javascript_snippet_syntax.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/javascript_snippet_syntax.ts"],"names":[],"mappings":";;AAAA,qDAIyB;AAEzB,MAAM,aAAa,GAAG,UAAU,CAAA;AAEhC,MAAqB,uBAAuB;IAG1C,YAAY,gBAAkC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,EACJ,OAAO,EACP,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,GACS;QAC3B,IAAI,eAAe,GAAG,WAAW,CAAA;QACjC,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,UAAU,EAAE;YACzD,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAA;SAC7C;aAAM,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,SAAS,EAAE;YAC/D,eAAe,IAAI,GAAG,CAAA;SACvB;QAED,IAAI,cAAsB,CAAA;QAC1B,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;YACvD,cAAc,GAAG,GAAG,aAAa,oBAAoB,CAAA;SACtD;aAAM;YACL,cAAc,GAAG,mBAAmB,CAAA;SACrC;QAED,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAChD,CAAC,mBAAmB,EAAE,KAAK,EAAE,EAAE;YAC7B,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACvC,MAAM,iBAAiB,GACrB,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA;YAC/D,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;gBACvD,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;aACtC;YACD,OAAO,GAAG,MAAM,GAAG,YAAY,KAAK,mBAAmB,CAAC,MAAM,CAAC,OAAO,CACpE,IAAI,EACJ,KAAK,CACN,MAAM,eAAe,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;QAC/D,CAAC,CACF,CAAA;QAED,OAAO,CACL,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,OAAO,IAAI;YAChD,KAAK,cAAc,IAAI;YACvB,KAAK,CACN,CAAA;IACH,CAAC;CACF;AAhDD,0CAgDC","sourcesContent":["import {\n ISnippetSnytax,\n ISnippetSyntaxBuildOptions,\n SnippetInterface,\n} from './snippet_syntax'\n\nconst CALLBACK_NAME = 'callback'\n\nexport default class JavaScriptSnippetSyntax implements ISnippetSnytax {\n private readonly snippetInterface: SnippetInterface\n\n constructor(snippetInterface: SnippetInterface) {\n this.snippetInterface = snippetInterface\n }\n\n build({\n comment,\n generatedExpressions,\n functionName,\n stepParameterNames,\n }: ISnippetSyntaxBuildOptions): string {\n let functionKeyword = 'function '\n if (this.snippetInterface === SnippetInterface.AsyncAwait) {\n functionKeyword = 'async ' + functionKeyword\n } else if (this.snippetInterface === SnippetInterface.Generator) {\n functionKeyword += '*'\n }\n\n let implementation: string\n if (this.snippetInterface === SnippetInterface.Callback) {\n implementation = `${CALLBACK_NAME}(null, 'pending');`\n } else {\n implementation = \"return 'pending';\"\n }\n\n const definitionChoices = generatedExpressions.map(\n (generatedExpression, index) => {\n const prefix = index === 0 ? '' : '// '\n const allParameterNames =\n generatedExpression.parameterNames.concat(stepParameterNames)\n if (this.snippetInterface === SnippetInterface.Callback) {\n allParameterNames.push(CALLBACK_NAME)\n }\n return `${prefix + functionName}('${generatedExpression.source.replace(\n /'/g,\n \"\\\\'\"\n )}', ${functionKeyword}(${allParameterNames.join(', ')}) {\\n`\n }\n )\n\n return (\n `${definitionChoices.join('')} // ${comment}\\n` +\n ` ${implementation}\\n` +\n '});'\n )\n }\n}\n"]}
1
+ {"version":3,"file":"javascript_snippet_syntax.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/javascript_snippet_syntax.ts"],"names":[],"mappings":";;AAAA,qDAIyB;AAEzB,MAAM,aAAa,GAAG,UAAU,CAAA;AAEhC,MAAqB,uBAAuB;IAG1C,YAAY,gBAAkC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,EACJ,OAAO,EACP,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,GACS;QAC3B,IAAI,eAAe,GAAG,WAAW,CAAA;QACjC,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,UAAU,EAAE;YACzD,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAA;SAC7C;aAAM,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,SAAS,EAAE;YAC/D,eAAe,IAAI,GAAG,CAAA;SACvB;QAED,IAAI,cAAsB,CAAA;QAC1B,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;YACvD,cAAc,GAAG,GAAG,aAAa,oBAAoB,CAAA;SACtD;aAAM,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,OAAO,EAAE;YAC7D,cAAc,GAAG,oCAAoC,CAAA;SACtD;aAAM;YACL,cAAc,GAAG,mBAAmB,CAAA;SACrC;QAED,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAChD,CAAC,mBAAmB,EAAE,KAAK,EAAE,EAAE;YAC7B,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACvC,MAAM,iBAAiB,GACrB,mBAAmB,CAAC,cAAc,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAA;YAC/D,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,QAAQ,EAAE;gBACvD,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;aACtC;YACD,OAAO,GAAG,MAAM,GAAG,YAAY,KAAK,mBAAmB,CAAC,MAAM,CAAC,OAAO,CACpE,IAAI,EACJ,KAAK,CACN,MAAM,eAAe,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;QAC/D,CAAC,CACF,CAAA;QAED,OAAO,CACL,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,OAAO,IAAI;YAChD,KAAK,cAAc,IAAI;YACvB,KAAK,CACN,CAAA;IACH,CAAC;CACF;AAlDD,0CAkDC","sourcesContent":["import {\n ISnippetSnytax,\n ISnippetSyntaxBuildOptions,\n SnippetInterface,\n} from './snippet_syntax'\n\nconst CALLBACK_NAME = 'callback'\n\nexport default class JavaScriptSnippetSyntax implements ISnippetSnytax {\n private readonly snippetInterface: SnippetInterface\n\n constructor(snippetInterface: SnippetInterface) {\n this.snippetInterface = snippetInterface\n }\n\n build({\n comment,\n generatedExpressions,\n functionName,\n stepParameterNames,\n }: ISnippetSyntaxBuildOptions): string {\n let functionKeyword = 'function '\n if (this.snippetInterface === SnippetInterface.AsyncAwait) {\n functionKeyword = 'async ' + functionKeyword\n } else if (this.snippetInterface === SnippetInterface.Generator) {\n functionKeyword += '*'\n }\n\n let implementation: string\n if (this.snippetInterface === SnippetInterface.Callback) {\n implementation = `${CALLBACK_NAME}(null, 'pending');`\n } else if (this.snippetInterface === SnippetInterface.Promise) {\n implementation = \"return Promise.resolve('pending');\"\n } else {\n implementation = \"return 'pending';\"\n }\n\n const definitionChoices = generatedExpressions.map(\n (generatedExpression, index) => {\n const prefix = index === 0 ? '' : '// '\n const allParameterNames =\n generatedExpression.parameterNames.concat(stepParameterNames)\n if (this.snippetInterface === SnippetInterface.Callback) {\n allParameterNames.push(CALLBACK_NAME)\n }\n return `${prefix + functionName}('${generatedExpression.source.replace(\n /'/g,\n \"\\\\'\"\n )}', ${functionKeyword}(${allParameterNames.join(', ')}) {\\n`\n }\n )\n\n return (\n `${definitionChoices.join('')} // ${comment}\\n` +\n ` ${implementation}\\n` +\n '});'\n )\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import GeneratedExpression from '@cucumber/cucumber-expressions/dist/src/GeneratedExpression';
1
+ import { GeneratedExpression } from '@cucumber/cucumber-expressions';
2
2
  export declare enum SnippetInterface {
3
3
  AsyncAwait = "async-await",
4
4
  Callback = "callback",
@@ -1 +1 @@
1
- {"version":3,"file":"snippet_syntax.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/snippet_syntax.ts"],"names":[],"mappings":";;;AAEA,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,8CAA0B,CAAA;IAC1B,yCAAqB,CAAA;IACrB,2CAAuB,CAAA;IACvB,uCAAmB,CAAA;IACnB,+CAA2B,CAAA;AAC7B,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B","sourcesContent":["import GeneratedExpression from '@cucumber/cucumber-expressions/dist/src/GeneratedExpression'\n\nexport enum SnippetInterface {\n AsyncAwait = 'async-await',\n Callback = 'callback',\n Generator = 'generator',\n Promise = 'promise',\n Synchronous = 'synchronous',\n}\n\nexport interface ISnippetSyntaxBuildOptions {\n comment: string\n functionName: string\n generatedExpressions: readonly GeneratedExpression[]\n stepParameterNames: string[]\n}\n\nexport interface ISnippetSnytax {\n build: (options: ISnippetSyntaxBuildOptions) => string\n}\n"]}
1
+ {"version":3,"file":"snippet_syntax.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/snippet_syntax.ts"],"names":[],"mappings":";;;AAEA,IAAY,gBAMX;AAND,WAAY,gBAAgB;IAC1B,8CAA0B,CAAA;IAC1B,yCAAqB,CAAA;IACrB,2CAAuB,CAAA;IACvB,uCAAmB,CAAA;IACnB,+CAA2B,CAAA;AAC7B,CAAC,EANW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAM3B","sourcesContent":["import { GeneratedExpression } from '@cucumber/cucumber-expressions'\n\nexport enum SnippetInterface {\n AsyncAwait = 'async-await',\n Callback = 'callback',\n Generator = 'generator',\n Promise = 'promise',\n Synchronous = 'synchronous',\n}\n\nexport interface ISnippetSyntaxBuildOptions {\n comment: string\n functionName: string\n generatedExpressions: readonly GeneratedExpression[]\n stepParameterNames: string[]\n}\n\nexport interface ISnippetSnytax {\n build: (options: ISnippetSyntaxBuildOptions) => string\n}\n"]}
@@ -6,6 +6,7 @@ interface ILogIssuesRequest {
6
6
  title: string;
7
7
  }
8
8
  export default class SummaryFormatter extends Formatter {
9
+ static readonly documentation: string;
9
10
  constructor(options: IFormatterOptions);
10
11
  logSummary(testRunDuration: messages.Duration): void;
11
12
  logIssues({ issues, title }: ILogIssuesRequest): void;
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const lodash_1 = __importDefault(require("lodash"));
7
6
  const helpers_1 = require("./helpers");
8
7
  const _1 = __importDefault(require("./"));
9
8
  const value_checker_1 = require("../value_checker");
@@ -14,12 +13,12 @@ class SummaryFormatter extends _1.default {
14
13
  super(options);
15
14
  let testRunStartedTimestamp;
16
15
  options.eventBroadcaster.on('envelope', (envelope) => {
17
- if (value_checker_1.doesHaveValue(envelope.testRunStarted)) {
16
+ if ((0, value_checker_1.doesHaveValue)(envelope.testRunStarted)) {
18
17
  testRunStartedTimestamp = envelope.testRunStarted.timestamp;
19
18
  }
20
- if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
19
+ if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
21
20
  const testRunFinishedTimestamp = envelope.testRunFinished.timestamp;
22
- this.logSummary(time_1.durationBetweenTimestamps(testRunStartedTimestamp, testRunFinishedTimestamp));
21
+ this.logSummary((0, time_1.durationBetweenTimestamps)(testRunStartedTimestamp, testRunFinishedTimestamp));
23
22
  }
24
23
  });
25
24
  }
@@ -27,16 +26,16 @@ class SummaryFormatter extends _1.default {
27
26
  const failures = [];
28
27
  const warnings = [];
29
28
  const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts();
30
- lodash_1.default.each(testCaseAttempts, (testCaseAttempt) => {
31
- if (helpers_1.isFailure(testCaseAttempt.worstTestStepResult)) {
29
+ testCaseAttempts.forEach((testCaseAttempt) => {
30
+ if ((0, helpers_1.isFailure)(testCaseAttempt.worstTestStepResult, testCaseAttempt.willBeRetried)) {
32
31
  failures.push(testCaseAttempt);
33
32
  }
34
- else if (helpers_1.isWarning(testCaseAttempt.worstTestStepResult)) {
33
+ else if ((0, helpers_1.isWarning)(testCaseAttempt.worstTestStepResult, testCaseAttempt.willBeRetried)) {
35
34
  warnings.push(testCaseAttempt);
36
35
  }
37
36
  });
38
37
  if (this.eventDataCollector.undefinedParameterTypes.length > 0) {
39
- this.log(issue_helpers_1.formatUndefinedParameterTypes(this.eventDataCollector.undefinedParameterTypes));
38
+ this.log((0, issue_helpers_1.formatUndefinedParameterTypes)(this.eventDataCollector.undefinedParameterTypes));
40
39
  }
41
40
  if (failures.length > 0) {
42
41
  this.logIssues({ issues: failures, title: 'Failures' });
@@ -44,7 +43,7 @@ class SummaryFormatter extends _1.default {
44
43
  if (warnings.length > 0) {
45
44
  this.logIssues({ issues: warnings, title: 'Warnings' });
46
45
  }
47
- this.log(helpers_1.formatSummary({
46
+ this.log((0, helpers_1.formatSummary)({
48
47
  colorFns: this.colorFns,
49
48
  testCaseAttempts,
50
49
  testRunDuration,
@@ -53,7 +52,7 @@ class SummaryFormatter extends _1.default {
53
52
  logIssues({ issues, title }) {
54
53
  this.log(`${title}:\n\n`);
55
54
  issues.forEach((testCaseAttempt, index) => {
56
- this.log(helpers_1.formatIssue({
55
+ this.log((0, helpers_1.formatIssue)({
57
56
  colorFns: this.colorFns,
58
57
  cwd: this.cwd,
59
58
  number: index + 1,
@@ -65,4 +64,5 @@ class SummaryFormatter extends _1.default {
65
64
  }
66
65
  }
67
66
  exports.default = SummaryFormatter;
67
+ SummaryFormatter.documentation = 'Summary output of feature and scenarios';
68
68
  //# sourceMappingURL=summary_formatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AACtB,uCAA4E;AAC5E,0CAAiD;AACjD,oDAAgD;AAGhD,2DAAuE;AACvE,kCAAmD;AAOnD,MAAqB,gBAAiB,SAAQ,UAAS;IACrD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,uBAA2C,CAAA;QAC/C,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACtE,IAAI,6BAAa,CAAC,QAAQ,C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,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;SACxD;QACD,IAAI,CAAC,GAAG,CACN,uBAAa,CAAC;YACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,gBAAgB;YAChB,eAAe;SAChB,CAAC,CACH,CAAA;IACH,CAAC;IAED,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAqB;QAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,CAAA;QACzB,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CACN,qBAAW,CAAC;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,MAAM,EAAE,KAAK,GAAG,CAAC;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AApED,mCAoEC","sourcesContent":["import _ from 'lodash'\nimport { formatIssue, formatSummary, isFailure, isWarning } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport { ITestCaseAttempt } from './helpers/event_data_collector'\nimport { formatUndefinedParameterTypes } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\n\ninterface ILogIssuesRequest {\n issues: ITestCaseAttempt[]\n title: string\n}\n\nexport default class SummaryFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n let testRunStartedTimestamp: messages.Timestamp\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunStarted)) {\n testRunStartedTimestamp = envelope.testRunStarted.timestamp\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n const testRunFinishedTimestamp = envelope.testRunFinished.timestamp\n this.logSummary(\n durationBetweenTimestamps(\n testRunStartedTimestamp,\n testRunFinishedTimestamp\n )\n )\n }\n })\n }\n\n logSummary(testRunDuration: messages.Duration): void {\n const failures: ITestCaseAttempt[] = []\n const warnings: ITestCaseAttempt[] = []\n const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts()\n _.each(testCaseAttempts, (testCaseAttempt) => {\n if (isFailure(testCaseAttempt.worstTestStepResult)) {\n failures.push(testCaseAttempt)\n } else if (isWarning(testCaseAttempt.worstTestStepResult)) {\n warnings.push(testCaseAttempt)\n }\n })\n if (this.eventDataCollector.undefinedParameterTypes.length > 0) {\n this.log(\n formatUndefinedParameterTypes(\n this.eventDataCollector.undefinedParameterTypes\n )\n )\n }\n if (failures.length > 0) {\n this.logIssues({ issues: failures, title: 'Failures' })\n }\n if (warnings.length > 0) {\n this.logIssues({ issues: warnings, title: 'Warnings' })\n }\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts,\n testRunDuration,\n })\n )\n }\n\n logIssues({ issues, title }: ILogIssuesRequest): void {\n this.log(`${title}:\\n\\n`)\n issues.forEach((testCaseAttempt, index) => {\n this.log(\n formatIssue({\n colorFns: this.colorFns,\n cwd: this.cwd,\n number: index + 1,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n )\n })\n }\n}\n"]}
1
+ {"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAA4E;AAC5E,0CAAiD;AACjD,oDAAgD;AAGhD,2DAAuE;AACvE,kCAAmD;AAOnD,MAAqB,gBAAiB,SAAQ,UAAS;IAIrD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,uBAA2C,CAAA;QAC/C,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE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AE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;SACxD;QACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;SACxD;QACD,IAAI,CAAC,GAAG,CACN,IAAA,uBAAa,EAAC;YACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,gBAAgB;YAChB,eAAe;SAChB,CAAC,CACH,CAAA;IACH,CAAC;IAED,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAqB;QAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,CAAA;QACzB,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CACN,IAAA,qBAAW,EAAC;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,MAAM,EAAE,KAAK,GAAG,CAAC;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;;AAhFH,mCAiFC;AAhFwB,8BAAa,GAClC,yCAAyC,CAAA","sourcesContent":["import { formatIssue, formatSummary, isFailure, isWarning } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport { ITestCaseAttempt } from './helpers/event_data_collector'\nimport { formatUndefinedParameterTypes } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\n\ninterface ILogIssuesRequest {\n issues: ITestCaseAttempt[]\n title: string\n}\n\nexport default class SummaryFormatter extends Formatter {\n public static readonly documentation: string =\n 'Summary output of feature and scenarios'\n\n constructor(options: IFormatterOptions) {\n super(options)\n let testRunStartedTimestamp: messages.Timestamp\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunStarted)) {\n testRunStartedTimestamp = envelope.testRunStarted.timestamp\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n const testRunFinishedTimestamp = envelope.testRunFinished.timestamp\n this.logSummary(\n durationBetweenTimestamps(\n testRunStartedTimestamp,\n testRunFinishedTimestamp\n )\n )\n }\n })\n }\n\n logSummary(testRunDuration: messages.Duration): void {\n const failures: ITestCaseAttempt[] = []\n const warnings: ITestCaseAttempt[] = []\n const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts()\n testCaseAttempts.forEach((testCaseAttempt) => {\n if (\n isFailure(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n failures.push(testCaseAttempt)\n } else if (\n isWarning(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n warnings.push(testCaseAttempt)\n }\n })\n if (this.eventDataCollector.undefinedParameterTypes.length > 0) {\n this.log(\n formatUndefinedParameterTypes(\n this.eventDataCollector.undefinedParameterTypes\n )\n )\n }\n if (failures.length > 0) {\n this.logIssues({ issues: failures, title: 'Failures' })\n }\n if (warnings.length > 0) {\n this.logIssues({ issues: warnings, title: 'Warnings' })\n }\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts,\n testRunDuration,\n })\n )\n }\n\n logIssues({ issues, title }: ILogIssuesRequest): void {\n this.log(`${title}:\\n\\n`)\n issues.forEach((testCaseAttempt, index) => {\n this.log(\n formatIssue({\n colorFns: this.colorFns,\n cwd: this.cwd,\n number: index + 1,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n )\n })\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import Formatter, { IFormatterOptions } from './';
2
2
  export default class UsageFormatter extends Formatter {
3
+ static readonly documentation: string;
3
4
  constructor(options: IFormatterOptions);
4
5
  logUsage(): void;
5
6
  }
@@ -22,7 +22,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- const lodash_1 = __importDefault(require("lodash"));
26
25
  const helpers_1 = require("./helpers");
27
26
  const _1 = __importDefault(require("./"));
28
27
  const cli_table3_1 = __importDefault(require("cli-table3"));
@@ -32,13 +31,13 @@ class UsageFormatter extends _1.default {
32
31
  constructor(options) {
33
32
  super(options);
34
33
  options.eventBroadcaster.on('envelope', (envelope) => {
35
- if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
34
+ if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
36
35
  this.logUsage();
37
36
  }
38
37
  });
39
38
  }
40
39
  logUsage() {
41
- const usage = helpers_1.getUsage({
40
+ const usage = (0, helpers_1.getUsage)({
42
41
  cwd: this.cwd,
43
42
  stepDefinitions: this.supportCodeLibrary.stepDefinitions,
44
43
  eventDataCollector: this.eventDataCollector,
@@ -62,7 +61,7 @@ class UsageFormatter extends _1.default {
62
61
  const col1 = [formattedPattern];
63
62
  const col2 = [];
64
63
  if (matches.length > 0) {
65
- if (value_checker_1.doesHaveValue(meanDuration)) {
64
+ if ((0, value_checker_1.doesHaveValue)(meanDuration)) {
66
65
  col2.push(`${messages.TimeConversion.durationToMilliseconds(meanDuration).toFixed(2)}ms`);
67
66
  }
68
67
  else {
@@ -72,16 +71,16 @@ class UsageFormatter extends _1.default {
72
71
  else {
73
72
  col2.push('UNUSED');
74
73
  }
75
- const col3 = [helpers_1.formatLocation({ line, uri })];
76
- lodash_1.default.take(matches, 5).forEach((match) => {
74
+ const col3 = [(0, helpers_1.formatLocation)({ line, uri })];
75
+ matches.slice(0, 5).forEach((match) => {
77
76
  col1.push(` ${match.text}`);
78
- if (value_checker_1.doesHaveValue(match.duration)) {
79
- col2.push(`${messages.TimeConversion.durationToMilliseconds(match.duration).toString()}ms`);
77
+ if ((0, value_checker_1.doesHaveValue)(match.duration)) {
78
+ col2.push(`${messages.TimeConversion.durationToMilliseconds(match.duration).toFixed(2)}ms`);
80
79
  }
81
80
  else {
82
81
  col2.push('-');
83
82
  }
84
- col3.push(helpers_1.formatLocation(match));
83
+ col3.push((0, helpers_1.formatLocation)(match));
85
84
  });
86
85
  if (matches.length > 5) {
87
86
  col1.push(` ${(matches.length - 5).toString()} more`);
@@ -92,4 +91,5 @@ class UsageFormatter extends _1.default {
92
91
  }
93
92
  }
94
93
  exports.default = UsageFormatter;
94
+ UsageFormatter.documentation = 'Prints where step definitions are used. The slowest step definitions (with duration) are listed first. If --dry-run is used the duration is not shown, and step definitions are sorted by filename instead.';
95
95
  //# sourceMappingURL=usage_formatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsB;AACtB,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,cAAe,SAAQ,UAAS;IACnD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,kBAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,C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I,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;gBAC5B,IAAI,6BAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;oBACjC,IAAI,CAAC,IAAI,CACP,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAC/C,KAAK,CAAC,QAAQ,CACf,CAAC,QAAQ,EAAE,IAAI,CACjB,CAAA;iBACF;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;iBACf;gBACD,IAAI,CAAC,IAAI,CAAC,wBAAc,CAAC,KAAK,CAAC,CAAC,CAAA;YAClC,CAAC,CAAC,CAAA;YACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;aACvD;YACD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,CAAC,CAAA;QACxE,CAAC,CACF,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;CACF;AAtED,iCAsEC","sourcesContent":["import _ from 'lodash'\nimport { formatLocation, getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport Table from 'cli-table3'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n if (usage.length === 0) {\n this.log('No step definitions')\n return\n }\n const table = new Table({\n head: ['Pattern / Text', 'Duration', 'Location'],\n style: {\n border: [],\n head: [],\n },\n })\n usage.forEach(\n ({ line, matches, meanDuration, pattern, patternType, uri }) => {\n let formattedPattern = pattern\n if (patternType === 'RegularExpression') {\n formattedPattern = '/' + formattedPattern + '/'\n }\n const col1 = [formattedPattern]\n const col2 = []\n if (matches.length > 0) {\n if (doesHaveValue(meanDuration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n meanDuration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n } else {\n col2.push('UNUSED')\n }\n const col3 = [formatLocation({ line, uri })]\n _.take(matches, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n match.duration\n ).toString()}ms`\n )\n } else {\n col2.push('-')\n }\n col3.push(formatLocation(match))\n })\n if (matches.length > 5) {\n col1.push(` ${(matches.length - 5).toString()} more`)\n }\n table.push([col1.join('\\n'), col2.join('\\n'), col3.join('\\n')] as any)\n }\n )\n this.log(`${table.toString()}\\n`)\n }\n}\n"]}
1
+ {"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoD;AACpD,0CAAiD;AACjD,4DAA8B;AAC9B,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,cAAe,SAAQ,UAAS;IAInD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;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,CAAA","sourcesContent":["import { formatLocation, getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport Table from 'cli-table3'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageFormatter extends Formatter {\n public static readonly documentation: string =\n 'Prints where step definitions are used. The slowest step definitions (with duration) are listed first. If --dry-run is used the duration is not shown, and step definitions are sorted by filename instead.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n if (usage.length === 0) {\n this.log('No step definitions')\n return\n }\n const table = new Table({\n head: ['Pattern / Text', 'Duration', 'Location'],\n style: {\n border: [],\n head: [],\n },\n })\n usage.forEach(\n ({ line, matches, meanDuration, pattern, patternType, uri }) => {\n let formattedPattern = pattern\n if (patternType === 'RegularExpression') {\n formattedPattern = '/' + formattedPattern + '/'\n }\n const col1 = [formattedPattern]\n const col2 = []\n if (matches.length > 0) {\n if (doesHaveValue(meanDuration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n meanDuration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n } else {\n col2.push('UNUSED')\n }\n const col3 = [formatLocation({ line, uri })]\n matches.slice(0, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n match.duration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n col3.push(formatLocation(match))\n })\n if (matches.length > 5) {\n col1.push(` ${(matches.length - 5).toString()} more`)\n }\n table.push([col1.join('\\n'), col2.join('\\n'), col3.join('\\n')] as any)\n }\n )\n this.log(`${table.toString()}\\n`)\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import Formatter, { IFormatterOptions } from './';
2
2
  export default class UsageJsonFormatter extends Formatter {
3
+ static readonly documentation: string;
3
4
  constructor(options: IFormatterOptions);
4
5
  logUsage(): void;
5
6
  replacer(key: string, value: any): any;
@@ -10,13 +10,13 @@ class UsageJsonFormatter extends _1.default {
10
10
  constructor(options) {
11
11
  super(options);
12
12
  options.eventBroadcaster.on('envelope', (envelope) => {
13
- if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
13
+ if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
14
14
  this.logUsage();
15
15
  }
16
16
  });
17
17
  }
18
18
  logUsage() {
19
- const usage = helpers_1.getUsage({
19
+ const usage = (0, helpers_1.getUsage)({
20
20
  cwd: this.cwd,
21
21
  stepDefinitions: this.supportCodeLibrary.stepDefinitions,
22
22
  eventDataCollector: this.eventDataCollector,
@@ -31,4 +31,5 @@ class UsageJsonFormatter extends _1.default {
31
31
  }
32
32
  }
33
33
  exports.default = UsageJsonFormatter;
34
+ UsageJsonFormatter.documentation = 'Does what the Usage Formatter does, but outputs JSON, which can be output to a file and then consumed by other tools.';
34
35
  //# sourceMappingURL=usage_json_formatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAAoC;AACpC,0CAAiD;AACjD,oDAAgD;AAIhD,MAAqB,kBAAmB,SAAQ,UAAS;IACvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,6BAAa,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,kBAAQ,CAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAU;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;SACvB;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAzBD,qCAyBC","sourcesContent":["import { getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageJsonFormatter extends Formatter {\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n this.log(JSON.stringify(usage, this.replacer, 2))\n }\n\n replacer(key: string, value: any): any {\n if (key === 'seconds') {\n return parseInt(value)\n }\n return value\n }\n}\n"]}
1
+ {"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAAoC;AACpC,0CAAiD;AACjD,oDAAgD;AAIhD,MAAqB,kBAAmB,SAAQ,UAAS;IAIvD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,QAAQ,EAAE,CAAA;aAChB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAU;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;SACvB;QACD,OAAO,KAAK,CAAA;IACd,CAAC;;AA3BH,qCA4BC;AA3BwB,gCAAa,GAClC,uHAAuH,CAAA","sourcesContent":["import { getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageJsonFormatter extends Formatter {\n public static readonly documentation: string =\n 'Does what the Usage Formatter does, but outputs JSON, which can be output to a file and then consumed by other tools.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n cwd: this.cwd,\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n this.log(JSON.stringify(usage, this.replacer, 2))\n }\n\n replacer(key: string, value: any): any {\n if (key === 'seconds') {\n return parseInt(value)\n }\n return value\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Provides the async `import()` function to source code that needs it,
3
+ * without having it transpiled down to commonjs `require()` by TypeScript.
4
+ * See https://github.com/microsoft/TypeScript/issues/43329.
5
+ *
6
+ * @param {any} descriptor - A URL or path for the module to load
7
+ * @return {Promise<any>} Promise that resolves to the loaded module
8
+ */
9
+ async function importer(descriptor) {
10
+ return await import(descriptor)
11
+ }
12
+
13
+ module.exports = { importer }
package/lib/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { default as PickleFilter } from './pickle_filter';
6
6
  export { default as Runtime, INewRuntimeOptions, IRuntimeOptions, } from './runtime';
7
7
  export { default as supportCodeLibraryBuilder } from './support_code_library_builder';
8
8
  export { default as DataTable } from './models/data_table';
9
+ export { version } from './version';
9
10
  export { default as Formatter, IFormatterOptions } from './formatter';
10
11
  export { default as FormatterBuilder } from './formatter/builder';
11
12
  export { default as JsonFormatter } from './formatter/json_formatter';
@@ -33,3 +34,4 @@ export declare const When: (<WorldType = import("./support_code_library_builder/
33
34
  export { default as World, IWorld, IWorldOptions, } from './support_code_library_builder/world';
34
35
  export { ITestCaseHookParameter, ITestStepHookParameter, } from './support_code_library_builder/types';
35
36
  export declare const Status: typeof messages.TestStepResultStatus;
37
+ export { wrapPromiseWithTimeout } from './time';
package/lib/index.js CHANGED
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.Status = exports.World = exports.When = exports.Then = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineStep = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
25
+ exports.wrapPromiseWithTimeout = exports.Status = exports.World = exports.When = exports.Then = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineStep = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.version = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
26
26
  const formatterHelpers = __importStar(require("./formatter/helpers"));
27
27
  exports.formatterHelpers = formatterHelpers;
28
28
  const support_code_library_builder_1 = __importDefault(require("./support_code_library_builder"));
@@ -40,6 +40,8 @@ var support_code_library_builder_2 = require("./support_code_library_builder");
40
40
  Object.defineProperty(exports, "supportCodeLibraryBuilder", { enumerable: true, get: function () { return __importDefault(support_code_library_builder_2).default; } });
41
41
  var data_table_1 = require("./models/data_table");
42
42
  Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return __importDefault(data_table_1).default; } });
43
+ var version_1 = require("./version");
44
+ Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_1.version; } });
43
45
  // Formatters
44
46
  var formatter_1 = require("./formatter");
45
47
  Object.defineProperty(exports, "Formatter", { enumerable: true, get: function () { return __importDefault(formatter_1).default; } });
@@ -78,4 +80,7 @@ exports.When = methods.When;
78
80
  var world_1 = require("./support_code_library_builder/world");
79
81
  Object.defineProperty(exports, "World", { enumerable: true, get: function () { return __importDefault(world_1).default; } });
80
82
  exports.Status = messages.TestStepResultStatus;
83
+ // Time helpers
84
+ var time_1 = require("./time");
85
+ Object.defineProperty(exports, "wrapPromiseWithTimeout", { enumerable: true, get: function () { return time_1.wrapPromiseWithTimeout; } });
81
86
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAuD;AA0B9C,4CAAgB;AAzBzB,kGAAsE;AACtE,6DAA8C;AAE9C,YAAY;AACZ,6BAAsC;AAA7B,2GAAA,OAAO,OAAO;AACvB,yCAAyD;AAAhD,oHAAA,yBAAyB,OAAA;AAClC,iDAAyD;AAAhD,8HAAA,OAAO,OAAgB;AAChC,qCAIkB;AAHhB,mHAAA,OAAO,OAAW;AAIpB,+EAAqF;AAA5E,0JAAA,OAAO,OAA6B;AAC7C,kDAA0D;AAAjD,wHAAA,OAAO,OAAa;AAE7B,aAAa;AACb,yCAAqE;AAA5D,uHAAA,OAAO,OAAa;AAC7B,+CAAiE;AAAxD,4HAAA,OAAO,OAAoB;AACpC,6DAAqE;AAA5D,gIAAA,OAAO,OAAiB;AACjC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,mEAA2E;AAAlE,sIAAA,OAAO,OAAoB;AACpC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,yEAAgF;AAAvE,2IAAA,OAAO,OAAsB;AAGtC,yBAAyB;AACzB,MAAM,EAAE,OAAO,EAAE,GAAG,sCAAyB,CAAA;AAChC,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAC3B,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AACvB,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AACjD,QAAA,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAC7C,QAAA,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAA;AACnE,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AACjD,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AACnB,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AAChC,8DAI6C;AAH3C,+GAAA,OAAO,OAAS;AAQL,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAA","sourcesContent":["import * as formatterHelpers from './formatter/helpers'\nimport supportCodeLibraryBuilder from './support_code_library_builder'\nimport * as messages from '@cucumber/messages'\n\n// Top level\nexport { default as Cli } from './cli'\nexport { parseGherkinMessageStream } from './cli/helpers'\nexport { default as PickleFilter } from './pickle_filter'\nexport {\n default as Runtime,\n INewRuntimeOptions,\n IRuntimeOptions,\n} from './runtime'\nexport { default as supportCodeLibraryBuilder } from './support_code_library_builder'\nexport { default as DataTable } from './models/data_table'\n\n// Formatters\nexport { default as Formatter, IFormatterOptions } from './formatter'\nexport { default as FormatterBuilder } from './formatter/builder'\nexport { default as JsonFormatter } from './formatter/json_formatter'\nexport { default as ProgressFormatter } from './formatter/progress_formatter'\nexport { default as RerunFormatter } from './formatter/rerun_formatter'\nexport { default as SnippetsFormatter } from './formatter/snippets_formatter'\nexport { default as SummaryFormatter } from './formatter/summary_formatter'\nexport { default as UsageFormatter } from './formatter/usage_formatter'\nexport { default as UsageJsonFormatter } from './formatter/usage_json_formatter'\nexport { formatterHelpers }\n\n// Support Code Functions\nconst { methods } = supportCodeLibraryBuilder\nexport const After = methods.After\nexport const AfterAll = methods.AfterAll\nexport const AfterStep = methods.AfterStep\nexport const Before = methods.Before\nexport const BeforeAll = methods.BeforeAll\nexport const BeforeStep = methods.BeforeStep\nexport const defineParameterType = methods.defineParameterType\nexport const defineStep = methods.defineStep\nexport const Given = methods.Given\nexport const setDefaultTimeout = methods.setDefaultTimeout\nexport const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper\nexport const setWorldConstructor = methods.setWorldConstructor\nexport const Then = methods.Then\nexport const When = methods.When\nexport {\n default as World,\n IWorld,\n IWorldOptions,\n} from './support_code_library_builder/world'\nexport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n} from './support_code_library_builder/types'\nexport const Status = messages.TestStepResultStatus\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAuD;AA2B9C,4CAAgB;AA1BzB,kGAAsE;AACtE,6DAA8C;AAE9C,YAAY;AACZ,6BAAsC;AAA7B,2GAAA,OAAO,OAAO;AACvB,yCAAyD;AAAhD,oHAAA,yBAAyB,OAAA;AAClC,iDAAyD;AAAhD,8HAAA,OAAO,OAAgB;AAChC,qCAIkB;AAHhB,mHAAA,OAAO,OAAW;AAIpB,+EAAqF;AAA5E,0JAAA,OAAO,OAA6B;AAC7C,kDAA0D;AAAjD,wHAAA,OAAO,OAAa;AAC7B,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAEhB,aAAa;AACb,yCAAqE;AAA5D,uHAAA,OAAO,OAAa;AAC7B,+CAAiE;AAAxD,4HAAA,OAAO,OAAoB;AACpC,6DAAqE;AAA5D,gIAAA,OAAO,OAAiB;AACjC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,mEAA2E;AAAlE,sIAAA,OAAO,OAAoB;AACpC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,yEAAgF;AAAvE,2IAAA,OAAO,OAAsB;AAGtC,yBAAyB;AACzB,MAAM,EAAE,OAAO,EAAE,GAAG,sCAAyB,CAAA;AAChC,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAC3B,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AACvB,QAAA,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAC7B,QAAA,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AACjD,QAAA,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;AAC/B,QAAA,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;AACrB,QAAA,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAA;AAC7C,QAAA,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAA;AACnE,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;AACjD,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AACnB,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AAChC,8DAI6C;AAH3C,+GAAA,OAAO,OAAS;AASL,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAA;AAEnD,eAAe;AACf,+BAA+C;AAAtC,8GAAA,sBAAsB,OAAA","sourcesContent":["import * as formatterHelpers from './formatter/helpers'\nimport supportCodeLibraryBuilder from './support_code_library_builder'\nimport * as messages from '@cucumber/messages'\n\n// Top level\nexport { default as Cli } from './cli'\nexport { parseGherkinMessageStream } from './cli/helpers'\nexport { default as PickleFilter } from './pickle_filter'\nexport {\n default as Runtime,\n INewRuntimeOptions,\n IRuntimeOptions,\n} from './runtime'\nexport { default as supportCodeLibraryBuilder } from './support_code_library_builder'\nexport { default as DataTable } from './models/data_table'\nexport { version } from './version'\n\n// Formatters\nexport { default as Formatter, IFormatterOptions } from './formatter'\nexport { default as FormatterBuilder } from './formatter/builder'\nexport { default as JsonFormatter } from './formatter/json_formatter'\nexport { default as ProgressFormatter } from './formatter/progress_formatter'\nexport { default as RerunFormatter } from './formatter/rerun_formatter'\nexport { default as SnippetsFormatter } from './formatter/snippets_formatter'\nexport { default as SummaryFormatter } from './formatter/summary_formatter'\nexport { default as UsageFormatter } from './formatter/usage_formatter'\nexport { default as UsageJsonFormatter } from './formatter/usage_json_formatter'\nexport { formatterHelpers }\n\n// Support Code Functions\nconst { methods } = supportCodeLibraryBuilder\nexport const After = methods.After\nexport const AfterAll = methods.AfterAll\nexport const AfterStep = methods.AfterStep\nexport const Before = methods.Before\nexport const BeforeAll = methods.BeforeAll\nexport const BeforeStep = methods.BeforeStep\nexport const defineParameterType = methods.defineParameterType\nexport const defineStep = methods.defineStep\nexport const Given = methods.Given\nexport const setDefaultTimeout = methods.setDefaultTimeout\nexport const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper\nexport const setWorldConstructor = methods.setWorldConstructor\nexport const Then = methods.Then\nexport const When = methods.When\nexport {\n default as World,\n IWorld,\n IWorldOptions,\n} from './support_code_library_builder/world'\n\nexport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n} from './support_code_library_builder/types'\nexport const Status = messages.TestStepResultStatus\n\n// Time helpers\nexport { wrapPromiseWithTimeout } from './time'\n"]}
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const lodash_1 = __importDefault(require("lodash"));
7
3
  class DataTable {
8
4
  constructor(sourceTable) {
9
5
  if (sourceTable instanceof Array) {
@@ -17,7 +13,11 @@ class DataTable {
17
13
  const copy = this.raw();
18
14
  const keys = copy[0];
19
15
  const valuesArray = copy.slice(1);
20
- return valuesArray.map((values) => lodash_1.default.zipObject(keys, values));
16
+ return valuesArray.map((values) => {
17
+ const rowObject = {};
18
+ keys.forEach((key, index) => (rowObject[key] = values[index]));
19
+ return rowObject;
20
+ });
21
21
  }
22
22
  raw() {
23
23
  return this.rawTable.slice(0);
@@ -29,11 +29,13 @@ class DataTable {
29
29
  }
30
30
  rowsHash() {
31
31
  const rows = this.raw();
32
- const everyRowHasTwoColumns = lodash_1.default.every(rows, (row) => row.length === 2);
32
+ const everyRowHasTwoColumns = rows.every((row) => row.length === 2);
33
33
  if (!everyRowHasTwoColumns) {
34
34
  throw new Error('rowsHash can only be called on a data table where all rows have exactly two columns');
35
35
  }
36
- return lodash_1.default.fromPairs(rows);
36
+ const result = {};
37
+ rows.forEach((x) => (result[x[0]] = x[1]));
38
+ return result;
37
39
  }
38
40
  transpose() {
39
41
  const transposed = this.rawTable[0].map((x, i) => this.rawTable.map((y) => y[i]));
@@ -1 +1 @@
1
- {"version":3,"file":"data_table.js","sourceRoot":"","sources":["../../src/models/data_table.ts"],"names":[],"mappings":";;;;;AAAA,oDAAsB;AAGtB,MAAqB,SAAS;IAG5B,YAAY,WAA8C;QACxD,IAAI,WAAW,YAAY,KAAK,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAA;SAC5B;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3C,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CACpC,CAAA;SACF;IACH,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACjC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAC,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/D,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC/B,CAAC;IAED,IAAI;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACvB,IAAI,CAAC,KAAK,EAAE,CAAA;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ;QACN,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACvB,MAAM,qBAAqB,GAAG,gBAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QACtE,IAAI,CAAC,qBAAqB,EAAE;YAC1B,MAAM,IAAI,KAAK,CACb,qFAAqF,CACtF,CAAA;SACF;QACD,OAAO,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,SAAS;QACP,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAA;QACD,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC;CACF;AA/CD,4BA+CC","sourcesContent":["import _ from 'lodash'\nimport * as messages from '@cucumber/messages'\n\nexport default class DataTable {\n private readonly rawTable: string[][]\n\n constructor(sourceTable: messages.PickleTable | string[][]) {\n if (sourceTable instanceof Array) {\n this.rawTable = sourceTable\n } else {\n this.rawTable = sourceTable.rows.map((row) =>\n row.cells.map((cell) => cell.value)\n )\n }\n }\n\n hashes(): any[] {\n const copy = this.raw()\n const keys = copy[0]\n const valuesArray = copy.slice(1)\n return valuesArray.map((values) => _.zipObject(keys, values))\n }\n\n raw(): string[][] {\n return this.rawTable.slice(0)\n }\n\n rows(): string[][] {\n const copy = this.raw()\n copy.shift()\n return copy\n }\n\n rowsHash(): Record<string, string> {\n const rows = this.raw()\n const everyRowHasTwoColumns = _.every(rows, (row) => row.length === 2)\n if (!everyRowHasTwoColumns) {\n throw new Error(\n 'rowsHash can only be called on a data table where all rows have exactly two columns'\n )\n }\n return _.fromPairs(rows)\n }\n\n transpose(): DataTable {\n const transposed = this.rawTable[0].map((x, i) =>\n this.rawTable.map((y) => y[i])\n )\n return new DataTable(transposed)\n }\n}\n"]}
1
+ {"version":3,"file":"data_table.js","sourceRoot":"","sources":["../../src/models/data_table.ts"],"names":[],"mappings":";;AAEA,MAAqB,SAAS;IAG5B,YAAY,WAA8C;QACxD,IAAI,WAAW,YAAY,KAAK,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAA;SAC5B;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3C,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CACpC,CAAA;SACF;IACH,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACjC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,MAA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AAA;QACD,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC;CACF;AArDD,4BAqDC","sourcesContent":["import * as messages from '@cucumber/messages'\n\nexport default class DataTable {\n private readonly rawTable: string[][]\n\n constructor(sourceTable: messages.PickleTable | string[][]) {\n if (sourceTable instanceof Array) {\n this.rawTable = sourceTable\n } else {\n this.rawTable = sourceTable.rows.map((row) =>\n row.cells.map((cell) => cell.value)\n )\n }\n }\n\n hashes(): any[] {\n const copy = this.raw()\n const keys = copy[0]\n const valuesArray = copy.slice(1)\n return valuesArray.map((values) => {\n const rowObject: Record<string, string> = {}\n keys.forEach((key, index) => (rowObject[key] = values[index]))\n return rowObject\n })\n }\n\n raw(): string[][] {\n return this.rawTable.slice(0)\n }\n\n rows(): string[][] {\n const copy = this.raw()\n copy.shift()\n return copy\n }\n\n rowsHash(): Record<string, string> {\n const rows = this.raw()\n const everyRowHasTwoColumns = rows.every((row) => row.length === 2)\n if (!everyRowHasTwoColumns) {\n throw new Error(\n 'rowsHash can only be called on a data table where all rows have exactly two columns'\n )\n }\n const result: Record<string, string> = {}\n rows.forEach((x) => (result[x[0]] = x[1]))\n return result\n }\n\n transpose(): DataTable {\n const transposed = this.rawTable[0].map((x, i) =>\n this.rawTable.map((y) => y[i])\n )\n return new DataTable(transposed)\n }\n}\n"]}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const data_table_1 = __importDefault(require("./data_table"));
7
7
  const definition_1 = __importDefault(require("./definition"));
8
8
  const step_arguments_1 = require("../step_arguments");
9
- const bluebird_1 = __importDefault(require("bluebird"));
10
9
  const value_checker_1 = require("../value_checker");
11
10
  class StepDefinition extends definition_1.default {
12
11
  constructor(data) {
@@ -15,9 +14,9 @@ class StepDefinition extends definition_1.default {
15
14
  this.expression = data.expression;
16
15
  }
17
16
  async getInvocationParameters({ step, world, }) {
18
- const parameters = await bluebird_1.default.all(this.expression.match(step.text).map((arg) => arg.getValue(world)));
19
- if (value_checker_1.doesHaveValue(step.argument)) {
20
- const argumentParamater = step_arguments_1.parseStepArgument(step.argument, {
17
+ const parameters = await Promise.all(this.expression.match(step.text).map((arg) => arg.getValue(world)));
18
+ if ((0, value_checker_1.doesHaveValue)(step.argument)) {
19
+ const argumentParamater = (0, step_arguments_1.parseStepArgument)(step.argument, {
21
20
  dataTable: (arg) => new data_table_1.default(arg),
22
21
  docString: (arg) => arg.content,
23
22
  });
@@ -30,7 +29,7 @@ class StepDefinition extends definition_1.default {
30
29
  };
31
30
  }
32
31
  matchesStepName(stepName) {
33
- return value_checker_1.doesHaveValue(this.expression.match(stepName));
32
+ return (0, value_checker_1.doesHaveValue)(this.expression.match(stepName));
34
33
  }
35
34
  }
36
35
  exports.default = StepDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"step_definition.js","sourceRoot":"","sources":["../../src/models/step_definition.ts"],"names":[],"mappings":";;;;;AAAA,8DAAoC;AACpC,8DAKqB;AACrB,sDAAqD;AAErD,wDAA+B;AAC/B,oDAAgD;AAEhD,MAAqB,cAAe,SAAQ,oBAAU;IAIpD,YAAY,IAA+B;QACzC,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,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,kBAAQ,CAAC,GAAG,CACnC,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,6BAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAChC,MAAM,iBAAiB,GAAG,kCAAiB,CAAM,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,6BAAa,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AAnCD,iCAmCC","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 bluebird from 'bluebird'\nimport { doesHaveValue } from '../value_checker'\n\nexport default class StepDefinition extends Definition implements IDefinition {\n public readonly pattern: string | RegExp\n public readonly expression: Expression\n\n constructor(data: IStepDefinitionParameters) {\n super(data)\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 bluebird.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"]}
1
+ {"version":3,"file":"step_definition.js","sourceRoot":"","sources":["../../src/models/step_definition.ts"],"names":[],"mappings":";;;;;AAAA,8DAAoC;AACpC,8DAKqB;AACrB,sDAAqD;AAErD,oDAAgD;AAEhD,MAAqB,cAAe,SAAQ,oBAAU;IAIpD,YAAY,IAA+B;QACzC,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,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;AAnCD,iCAmCC","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'\n\nexport default class StepDefinition extends Definition implements IDefinition {\n public readonly pattern: string | RegExp\n public readonly expression: Expression\n\n constructor(data: IStepDefinitionParameters) {\n super(data)\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"]}
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PickleTagFilter = exports.PickleNameFilter = exports.PickleLineFilter = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
7
  const path_1 = __importDefault(require("path"));
9
8
  const tag_expressions_1 = __importDefault(require("@cucumber/tag-expressions"));
10
9
  const gherkin_document_parser_1 = require("./formatter/helpers/gherkin_document_parser");
@@ -33,11 +32,11 @@ class PickleLineFilter {
33
32
  const mapping = {};
34
33
  featurePaths.forEach((featurePath) => {
35
34
  const match = FEATURE_LINENUM_REGEXP.exec(featurePath);
36
- if (value_checker_1.doesHaveValue(match)) {
35
+ if ((0, value_checker_1.doesHaveValue)(match)) {
37
36
  const uri = path_1.default.normalize(match[1]);
38
37
  const linesExpression = match[2];
39
- if (value_checker_1.doesHaveValue(linesExpression)) {
40
- if (value_checker_1.doesNotHaveValue(mapping[uri])) {
38
+ if ((0, value_checker_1.doesHaveValue)(linesExpression)) {
39
+ if ((0, value_checker_1.doesNotHaveValue)(mapping[uri])) {
41
40
  mapping[uri] = [];
42
41
  }
43
42
  linesExpression
@@ -54,10 +53,11 @@ class PickleLineFilter {
54
53
  matchesAnyLine({ gherkinDocument, pickle }) {
55
54
  const uri = path_1.default.normalize(pickle.uri);
56
55
  const linesToMatch = this.featureUriToLinesMapping[uri];
57
- if (value_checker_1.doesHaveValue(linesToMatch)) {
58
- const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
59
- const pickleLines = pickle.astNodeIds.map((sourceId) => gherkinScenarioLocationMap[sourceId].line);
60
- return lodash_1.default.size(lodash_1.default.intersection(linesToMatch, pickleLines)) > 0;
56
+ if ((0, value_checker_1.doesHaveValue)(linesToMatch)) {
57
+ const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
58
+ const pickleLines = new Set(pickle.astNodeIds.map((sourceId) => gherkinScenarioLocationMap[sourceId].line));
59
+ const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x));
60
+ return linesIntersection.length > 0;
61
61
  }
62
62
  return true;
63
63
  }
@@ -71,21 +71,21 @@ class PickleNameFilter {
71
71
  if (this.names.length === 0) {
72
72
  return true;
73
73
  }
74
- return lodash_1.default.some(this.names, (name) => pickle.name.match(name));
74
+ return this.names.some((name) => pickle.name.match(name));
75
75
  }
76
76
  }
77
77
  exports.PickleNameFilter = PickleNameFilter;
78
78
  class PickleTagFilter {
79
79
  constructor(tagExpression) {
80
- if (value_checker_1.doesHaveValue(tagExpression) && tagExpression !== '') {
81
- this.tagExpressionNode = tag_expressions_1.default(tagExpression);
80
+ if ((0, value_checker_1.doesHaveValue)(tagExpression) && tagExpression !== '') {
81
+ this.tagExpressionNode = (0, tag_expressions_1.default)(tagExpression);
82
82
  }
83
83
  }
84
84
  matchesAllTagExpressions(pickle) {
85
- if (value_checker_1.doesNotHaveValue(this.tagExpressionNode)) {
85
+ if ((0, value_checker_1.doesNotHaveValue)(this.tagExpressionNode)) {
86
86
  return true;
87
87
  }
88
- return this.tagExpressionNode.evaluate(lodash_1.default.map(pickle.tags, 'name'));
88
+ return this.tagExpressionNode.evaluate(pickle.tags.map((x) => x.name));
89
89
  }
90
90
  }
91
91
  exports.PickleTagFilter = PickleTagFilter;
@@ -1 +1 @@
1
- {"version":3,"file":"pickle_filter.js","sourceRoot":"","sources":["../src/pickle_filter.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AACtB,gDAAuB;AACvB,gFAA6C;AAC7C,yFAA2F;AAC3F,mDAAiE;AAKjE,MAAM,sBAAsB,GAAG,uBAAuB,CAAA;AActD,MAAqB,YAAY;IAK/B,YAAY,EACV,GAAG,EACH,YAAY,EACZ,KAAK,EACL,aAAa,GACQ;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QACzD,IAAI,CAAC,UAAU,GAAG,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAA;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,CAAC,EACN,eAAe,EACf,MAAM,GAIP;QACC,OAAO,CACL,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,eAAe,EAAE,MA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C,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,gBAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;IACpE,CAAC;CACF;AAfD,0CAeC","sourcesContent":["import _ from 'lodash'\nimport 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 featurePaths,\n })\n }\n\n getFeatureUriToLinesMapping({\n featurePaths,\n }: {\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 const uri = path.normalize(match[1])\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 = pickle.astNodeIds.map(\n (sourceId) => gherkinScenarioLocationMap[sourceId].line\n )\n return _.size(_.intersection(linesToMatch, pickleLines)) > 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 _.some(this.names, (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(_.map(pickle.tags, 'name'))\n }\n}\n"]}
1
+ {"version":3,"file":"pickle_filter.js","sourceRoot":"","sources":["../src/pickle_filter.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,gFAA6C;AAC7C,yFAA2F;AAC3F,mDAAiE;AAKjE,MAAM,sBAAsB,GAAG,uBAAuB,CAAA;A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AAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3D,CAAC;CACF;AAbD,4CAaC;AAED,MAAa,eAAe;IAG1B,YAAY,aAAqB;QAC/B,IAAI,IAAA,6BAAa,EAAC,aAAa,CAAC,IAAI,aAAa,KAAK,EAAE,EAAE;YACxD,IAAI,CAAC,iBAAiB,GAAG,IAAA,yBAAK,EAAC,aAAa,CAAC,CAAA;SAC9C;IACH,CAAC;IAED,wBAAwB,CAAC,MAAuB;QAC9C,IAAI,IAAA,gCAAgB,EAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE;YAC5C,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACxE,CAAC;CACF;AAfD,0CAeC","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 featurePaths,\n })\n }\n\n getFeatureUriToLinesMapping({\n featurePaths,\n }: {\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 const uri = path.normalize(match[1])\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"]}