@cucumber/cucumber 7.2.1 → 8.0.0-rc.1

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 (177) hide show
  1. package/README.md +11 -4
  2. package/lib/cli/argv_parser.d.ts +1 -2
  3. package/lib/cli/argv_parser.js +8 -12
  4. package/lib/cli/argv_parser.js.map +1 -1
  5. package/lib/cli/configuration_builder.d.ts +0 -1
  6. package/lib/cli/configuration_builder.js +20 -21
  7. package/lib/cli/configuration_builder.js.map +1 -1
  8. package/lib/cli/helpers.d.ts +1 -0
  9. package/lib/cli/helpers.js +49 -22
  10. package/lib/cli/helpers.js.map +1 -1
  11. package/lib/cli/i18n.js +6 -6
  12. package/lib/cli/i18n.js.map +1 -1
  13. package/lib/cli/index.d.ts +1 -1
  14. package/lib/cli/index.js +35 -29
  15. package/lib/cli/index.js.map +1 -1
  16. package/lib/cli/profile_loader.d.ts +3 -3
  17. package/lib/cli/profile_loader.js +17 -10
  18. package/lib/cli/profile_loader.js.map +1 -1
  19. package/lib/cli/publish_banner.js +1 -1
  20. package/lib/cli/publish_banner.js.map +1 -1
  21. package/lib/formatter/builder.d.ts +5 -4
  22. package/lib/formatter/builder.js +38 -52
  23. package/lib/formatter/builder.js.map +1 -1
  24. package/lib/formatter/get_color_fns.d.ts +6 -2
  25. package/lib/formatter/get_color_fns.js +18 -12
  26. package/lib/formatter/get_color_fns.js.map +1 -1
  27. package/lib/formatter/helpers/event_data_collector.d.ts +15 -17
  28. package/lib/formatter/helpers/event_data_collector.js +19 -12
  29. package/lib/formatter/helpers/event_data_collector.js.map +1 -1
  30. package/lib/formatter/helpers/formatters.d.ts +6 -0
  31. package/lib/formatter/helpers/formatters.js +41 -0
  32. package/lib/formatter/helpers/formatters.js.map +1 -0
  33. package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -6
  34. package/lib/formatter/helpers/gherkin_document_parser.js +24 -40
  35. package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
  36. package/lib/formatter/helpers/issue_helpers.d.ts +6 -6
  37. package/lib/formatter/helpers/issue_helpers.js +6 -8
  38. package/lib/formatter/helpers/issue_helpers.js.map +1 -1
  39. package/lib/formatter/helpers/keyword_type.js +1 -5
  40. package/lib/formatter/helpers/keyword_type.js.map +1 -1
  41. package/lib/formatter/helpers/pickle_parser.d.ts +9 -10
  42. package/lib/formatter/helpers/pickle_parser.js +8 -17
  43. package/lib/formatter/helpers/pickle_parser.js.map +1 -1
  44. package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -2
  45. package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
  46. package/lib/formatter/helpers/summary_helpers.d.ts +2 -2
  47. package/lib/formatter/helpers/summary_helpers.js +39 -20
  48. package/lib/formatter/helpers/summary_helpers.js.map +1 -1
  49. package/lib/formatter/helpers/test_case_attempt_formatter.js +34 -15
  50. package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
  51. package/lib/formatter/helpers/test_case_attempt_parser.d.ts +5 -5
  52. package/lib/formatter/helpers/test_case_attempt_parser.js +30 -15
  53. package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
  54. package/lib/formatter/helpers/usage_helpers/index.d.ts +3 -3
  55. package/lib/formatter/helpers/usage_helpers/index.js +48 -45
  56. package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
  57. package/lib/formatter/html_formatter.d.ts +1 -0
  58. package/lib/formatter/html_formatter.js +2 -1
  59. package/lib/formatter/html_formatter.js.map +1 -1
  60. package/lib/formatter/http_stream.js +1 -1
  61. package/lib/formatter/http_stream.js.map +1 -1
  62. package/lib/formatter/index.d.ts +1 -0
  63. package/lib/formatter/index.js.map +1 -1
  64. package/lib/formatter/json_formatter.d.ts +22 -27
  65. package/lib/formatter/json_formatter.js +62 -30
  66. package/lib/formatter/json_formatter.js.map +1 -1
  67. package/lib/formatter/message_formatter.d.ts +1 -0
  68. package/lib/formatter/message_formatter.js +2 -1
  69. package/lib/formatter/message_formatter.js.map +1 -1
  70. package/lib/formatter/progress_bar_formatter.d.ts +7 -6
  71. package/lib/formatter/progress_bar_formatter.js +5 -4
  72. package/lib/formatter/progress_bar_formatter.js.map +1 -1
  73. package/lib/formatter/progress_formatter.d.ts +3 -2
  74. package/lib/formatter/progress_formatter.js +30 -10
  75. package/lib/formatter/progress_formatter.js.map +1 -1
  76. package/lib/formatter/rerun_formatter.d.ts +1 -0
  77. package/lib/formatter/rerun_formatter.js +33 -11
  78. package/lib/formatter/rerun_formatter.js.map +1 -1
  79. package/lib/formatter/snippets_formatter.d.ts +1 -0
  80. package/lib/formatter/snippets_formatter.js +22 -2
  81. package/lib/formatter/snippets_formatter.js.map +1 -1
  82. package/lib/formatter/step_definition_snippet_builder/index.d.ts +3 -3
  83. package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
  84. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
  85. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
  86. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
  87. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
  88. package/lib/formatter/summary_formatter.d.ts +3 -2
  89. package/lib/formatter/summary_formatter.js +4 -4
  90. package/lib/formatter/summary_formatter.js.map +1 -1
  91. package/lib/formatter/usage_formatter.d.ts +1 -0
  92. package/lib/formatter/usage_formatter.js +24 -5
  93. package/lib/formatter/usage_formatter.js.map +1 -1
  94. package/lib/formatter/usage_json_formatter.d.ts +1 -0
  95. package/lib/formatter/usage_json_formatter.js +1 -0
  96. package/lib/formatter/usage_json_formatter.js.map +1 -1
  97. package/lib/importer.js +13 -0
  98. package/lib/index.d.ts +15 -12
  99. package/lib/index.js +6 -3
  100. package/lib/index.js.map +1 -1
  101. package/lib/models/data_table.d.ts +3 -4
  102. package/lib/models/data_table.js +9 -7
  103. package/lib/models/data_table.js.map +1 -1
  104. package/lib/models/definition.d.ts +2 -2
  105. package/lib/models/definition.js.map +1 -1
  106. package/lib/models/step_definition.js +1 -2
  107. package/lib/models/step_definition.js.map +1 -1
  108. package/lib/models/test_case_hook_definition.d.ts +2 -2
  109. package/lib/models/test_case_hook_definition.js.map +1 -1
  110. package/lib/models/test_step_hook_definition.d.ts +2 -2
  111. package/lib/models/test_step_hook_definition.js.map +1 -1
  112. package/lib/pickle_filter.d.ts +9 -11
  113. package/lib/pickle_filter.js +9 -9
  114. package/lib/pickle_filter.js.map +1 -1
  115. package/lib/runtime/assemble_test_cases.d.ts +13 -0
  116. package/lib/runtime/assemble_test_cases.js +88 -0
  117. package/lib/runtime/assemble_test_cases.js.map +1 -0
  118. package/lib/runtime/attachment_manager/index.d.ts +2 -2
  119. package/lib/runtime/attachment_manager/index.js +23 -4
  120. package/lib/runtime/attachment_manager/index.js.map +1 -1
  121. package/lib/runtime/helpers.d.ts +3 -2
  122. package/lib/runtime/helpers.js +36 -1
  123. package/lib/runtime/helpers.js.map +1 -1
  124. package/lib/runtime/index.d.ts +3 -4
  125. package/lib/runtime/index.js +27 -43
  126. package/lib/runtime/index.js.map +1 -1
  127. package/lib/runtime/parallel/command_types.d.ts +10 -9
  128. package/lib/runtime/parallel/command_types.js.map +1 -1
  129. package/lib/runtime/parallel/coordinator.d.ts +9 -9
  130. package/lib/runtime/parallel/coordinator.js +62 -55
  131. package/lib/runtime/parallel/coordinator.js.map +1 -1
  132. package/lib/runtime/parallel/worker.d.ts +2 -2
  133. package/lib/runtime/parallel/worker.js +23 -21
  134. package/lib/runtime/parallel/worker.js.map +1 -1
  135. package/lib/runtime/step_runner.d.ts +3 -3
  136. package/lib/runtime/step_runner.js +16 -14
  137. package/lib/runtime/step_runner.js.map +1 -1
  138. package/lib/runtime/stopwatch.d.ts +4 -4
  139. package/lib/runtime/stopwatch.js +21 -2
  140. package/lib/runtime/stopwatch.js.map +1 -1
  141. package/lib/runtime/test_case_runner.d.ts +51 -0
  142. package/lib/runtime/test_case_runner.js +253 -0
  143. package/lib/runtime/test_case_runner.js.map +1 -0
  144. package/lib/stack_trace_filter.js +4 -5
  145. package/lib/stack_trace_filter.js.map +1 -1
  146. package/lib/step_arguments.d.ts +4 -4
  147. package/lib/step_arguments.js.map +1 -1
  148. package/lib/support_code_library_builder/build_helpers.js +14 -10
  149. package/lib/support_code_library_builder/build_helpers.js.map +1 -1
  150. package/lib/support_code_library_builder/index.d.ts +9 -7
  151. package/lib/support_code_library_builder/index.js +10 -24
  152. package/lib/support_code_library_builder/index.js.map +1 -1
  153. package/lib/support_code_library_builder/types.d.ts +22 -23
  154. package/lib/support_code_library_builder/types.js.map +1 -1
  155. package/lib/support_code_library_builder/validate_arguments.js +14 -19
  156. package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
  157. package/lib/support_code_library_builder/world.d.ts +7 -1
  158. package/lib/support_code_library_builder/world.js.map +1 -1
  159. package/lib/time.d.ts +3 -10
  160. package/lib/time.js +39 -48
  161. package/lib/time.js.map +1 -1
  162. package/lib/user_code_runner.js +7 -14
  163. package/lib/user_code_runner.js.map +1 -1
  164. package/lib/value_checker.d.ts +2 -2
  165. package/lib/value_checker.js.map +1 -1
  166. package/lib/wrapper.mjs +38 -0
  167. package/package.json +73 -64
  168. package/CHANGELOG.md +0 -1881
  169. package/lib/runtime/pickle_runner.d.ts +0 -67
  170. package/lib/runtime/pickle_runner.js +0 -305
  171. package/lib/runtime/pickle_runner.js.map +0 -1
  172. package/lib/status.d.ts +0 -3
  173. package/lib/status.js +0 -5
  174. package/lib/status.js.map +0 -1
  175. package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
  176. package/lib/support_code_library_builder/finalize_helpers.js +0 -26
  177. package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
@@ -3,35 +3,41 @@ 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 safe_1 = __importDefault(require("colors/safe"));
8
- const status_1 = __importDefault(require("../status"));
9
7
  safe_1.default.enable();
10
8
  function getColorFns(enabled) {
11
9
  if (enabled) {
12
10
  return {
13
11
  forStatus(status) {
14
12
  return {
15
- [status_1.default.AMBIGUOUS]: safe_1.default.red.bind(safe_1.default),
16
- [status_1.default.FAILED]: safe_1.default.red.bind(safe_1.default),
17
- [status_1.default.PASSED]: safe_1.default.green.bind(safe_1.default),
18
- [status_1.default.PENDING]: safe_1.default.yellow.bind(safe_1.default),
19
- [status_1.default.SKIPPED]: safe_1.default.cyan.bind(safe_1.default),
20
- [status_1.default.UNDEFINED]: safe_1.default.yellow.bind(safe_1.default),
21
- [status_1.default.UNKNOWN]: safe_1.default.yellow.bind(safe_1.default),
13
+ AMBIGUOUS: safe_1.default.red.bind(safe_1.default),
14
+ FAILED: safe_1.default.red.bind(safe_1.default),
15
+ PASSED: safe_1.default.green.bind(safe_1.default),
16
+ PENDING: safe_1.default.yellow.bind(safe_1.default),
17
+ SKIPPED: safe_1.default.cyan.bind(safe_1.default),
18
+ UNDEFINED: safe_1.default.yellow.bind(safe_1.default),
19
+ UNKNOWN: safe_1.default.yellow.bind(safe_1.default),
22
20
  }[status];
23
21
  },
24
22
  location: safe_1.default.gray.bind(safe_1.default),
25
23
  tag: safe_1.default.cyan.bind(safe_1.default),
24
+ diffAdded: safe_1.default.green.bind(safe_1.default),
25
+ diffRemoved: safe_1.default.red.bind(safe_1.default),
26
+ errorMessage: safe_1.default.red.bind(safe_1.default),
27
+ errorStack: safe_1.default.grey.bind(safe_1.default),
26
28
  };
27
29
  }
28
30
  else {
29
31
  return {
30
32
  forStatus(status) {
31
- return lodash_1.default.identity;
33
+ return (x) => x;
32
34
  },
33
- location: lodash_1.default.identity,
34
- tag: lodash_1.default.identity,
35
+ location: (x) => x,
36
+ tag: (x) => x,
37
+ diffAdded: (x) => x,
38
+ diffRemoved: (x) => x,
39
+ errorMessage: (x) => x,
40
+ errorStack: (x) => x,
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CAAA;YACnB,CAAC;YACD,QAAQ,EAAE,gBAAC,CAAC,QAAQ;YACpB,GAAG,EAAE,gBAAC,CAAC,QAAQ;SAChB,CAAA;KACF;AACH,CAAC;AA1BD,8BA0BC","sourcesContent":["import _ from 'lodash'\nimport colors from 'colors/safe'\nimport Status from '../status'\nimport { messages } from '@cucumber/messages'\n\ncolors.enable()\n\nexport type IColorFn = (text: string) => string\n\nexport interface IColorFns {\n forStatus: (\n status: messages.TestStepFinished.TestStepResult.Status\n ) => IColorFn\n location: IColorFn\n tag: IColorFn\n}\n\nexport default function getColorFns(enabled: boolean): IColorFns {\n if (enabled) {\n return {\n forStatus(status: messages.TestStepFinished.TestStepResult.Status) {\n return {\n [Status.AMBIGUOUS]: colors.red.bind(colors),\n [Status.FAILED]: colors.red.bind(colors),\n [Status.PASSED]: colors.green.bind(colors),\n [Status.PENDING]: colors.yellow.bind(colors),\n [Status.SKIPPED]: colors.cyan.bind(colors),\n [Status.UNDEFINED]: colors.yellow.bind(colors),\n [Status.UNKNOWN]: colors.yellow.bind(colors),\n }[status]\n },\n location: colors.gray.bind(colors),\n tag: colors.cyan.bind(colors),\n }\n } else {\n return {\n forStatus(status: messages.TestStepFinished.TestStepResult.Status) {\n return _.identity\n },\n location: _.identity,\n tag: _.identity,\n }\n }\n}\n"]}
1
+ {"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;AAAA,uDAAgC;AAGhC,cAAM,CAAC,MAAM,EAAE,CAAA;AAcf,SAAwB,WAAW,CAAC,OAAgB;IAClD,IAAI,OAAO,EAAE;QACX,OAAO;YACL,SAAS,CAAC,MAA4B;gBACpC,OAAO;oBACL,SAAS,EAAE,cAAM,CAAC,GAAG,CAAC,IAAI,CAAC,cAAM,CAAC;oBAClC,MAAM,EAAE,cAAM,CAAC,GAAG,CAAC,IAAI,CAAC,cAAM,CAAC;oBAC/B,MAAM,EAAE,cAAM,CAAC,KAAK,CAAC,I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":["import colors from 'colors/safe'\nimport { TestStepResultStatus } from '@cucumber/messages'\n\ncolors.enable()\n\nexport type IColorFn = (text: string) => string\n\nexport interface IColorFns {\n forStatus: (status: TestStepResultStatus) => IColorFn\n location: IColorFn\n tag: IColorFn\n diffAdded: IColorFn\n diffRemoved: IColorFn\n errorMessage: IColorFn\n errorStack: IColorFn\n}\n\nexport default function getColorFns(enabled: boolean): IColorFns {\n if (enabled) {\n return {\n forStatus(status: TestStepResultStatus) {\n return {\n AMBIGUOUS: colors.red.bind(colors),\n FAILED: colors.red.bind(colors),\n PASSED: colors.green.bind(colors),\n PENDING: colors.yellow.bind(colors),\n SKIPPED: colors.cyan.bind(colors),\n UNDEFINED: colors.yellow.bind(colors),\n UNKNOWN: colors.yellow.bind(colors),\n }[status]\n },\n location: colors.gray.bind(colors),\n tag: colors.cyan.bind(colors),\n diffAdded: colors.green.bind(colors),\n diffRemoved: colors.red.bind(colors),\n errorMessage: colors.red.bind(colors),\n errorStack: colors.grey.bind(colors),\n }\n } else {\n return {\n forStatus(status: TestStepResultStatus) {\n return (x) => x\n },\n location: (x) => x,\n tag: (x) => x,\n diffAdded: (x) => x,\n diffRemoved: (x) => x,\n errorMessage: (x) => x,\n errorStack: (x) => x,\n }\n }\n}\n"]}
@@ -1,32 +1,30 @@
1
1
  /// <reference types="node" />
2
- import { Dictionary } from 'lodash';
3
- import { messages } from '@cucumber/messages';
2
+ import * as messages from '@cucumber/messages';
4
3
  import { EventEmitter } from 'events';
5
- import { Query } from '@cucumber/query';
6
4
  export interface ITestCaseAttempt {
7
5
  attempt: number;
8
- gherkinDocument: messages.IGherkinDocument;
9
- pickle: messages.IPickle;
10
- stepAttachments: Dictionary<messages.IAttachment[]>;
11
- stepResults: Dictionary<messages.TestStepFinished.ITestStepResult>;
12
- testCase: messages.ITestCase;
13
- worstTestStepResult: messages.TestStepFinished.ITestStepResult;
6
+ willBeRetried: boolean;
7
+ gherkinDocument: messages.GherkinDocument;
8
+ pickle: messages.Pickle;
9
+ stepAttachments: Record<string, messages.Attachment[]>;
10
+ stepResults: Record<string, messages.TestStepResult>;
11
+ testCase: messages.TestCase;
12
+ worstTestStepResult: messages.TestStepResult;
14
13
  }
15
14
  export default class EventDataCollector {
16
15
  private gherkinDocumentMap;
17
16
  private pickleMap;
18
17
  private testCaseMap;
19
18
  private testCaseAttemptDataMap;
20
- readonly undefinedParameterTypes: messages.IUndefinedParameterType[];
21
- readonly query: Query;
19
+ readonly undefinedParameterTypes: messages.UndefinedParameterType[];
22
20
  constructor(eventBroadcaster: EventEmitter);
23
- getGherkinDocument(uri: string): messages.IGherkinDocument;
24
- getPickle(pickleId: string): messages.IPickle;
21
+ getGherkinDocument(uri: string): messages.GherkinDocument;
22
+ getPickle(pickleId: string): messages.Pickle;
25
23
  getTestCaseAttempts(): ITestCaseAttempt[];
26
24
  getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt;
27
25
  parseEnvelope(envelope: messages.Envelope): void;
28
- initTestCaseAttempt(testCaseStarted: messages.ITestCaseStarted): void;
29
- storeAttachment({ testCaseStartedId, testStepId, body, mediaType, }: messages.IAttachment): void;
30
- storeTestStepResult({ testCaseStartedId, testStepId, testStepResult, }: messages.ITestStepFinished): void;
31
- storeTestCaseResult({ testCaseStartedId }: messages.ITestCaseFinished): void;
26
+ private initTestCaseAttempt;
27
+ storeAttachment(attachment: messages.Attachment): void;
28
+ storeTestStepResult({ testCaseStartedId, testStepId, testStepResult, }: messages.TestStepFinished): void;
29
+ storeTestCaseResult({ testCaseStartedId, willBeRetried, }: messages.TestCaseFinished): void;
32
30
  }
@@ -19,9 +19,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- const lodash_1 = __importStar(require("lodash"));
22
+ const messages = __importStar(require("@cucumber/messages"));
23
23
  const value_checker_1 = require("../../value_checker");
24
- const query_1 = require("@cucumber/query");
25
24
  class EventDataCollector {
26
25
  constructor(eventBroadcaster) {
27
26
  this.gherkinDocumentMap = {};
@@ -29,7 +28,6 @@ class EventDataCollector {
29
28
  this.testCaseMap = {};
30
29
  this.testCaseAttemptDataMap = {};
31
30
  this.undefinedParameterTypes = [];
32
- this.query = new query_1.Query();
33
31
  eventBroadcaster.on('envelope', this.parseEnvelope.bind(this));
34
32
  }
35
33
  getGherkinDocument(uri) {
@@ -39,7 +37,7 @@ class EventDataCollector {
39
37
  return this.pickleMap[pickleId];
40
38
  }
41
39
  getTestCaseAttempts() {
42
- return lodash_1.default.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {
40
+ return Object.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {
43
41
  return this.getTestCaseAttempt(testCaseStartedId);
44
42
  });
45
43
  }
@@ -52,13 +50,13 @@ class EventDataCollector {
52
50
  pickle,
53
51
  testCase,
54
52
  attempt: testCaseAttemptData.attempt,
53
+ willBeRetried: testCaseAttemptData.willBeRetried,
55
54
  stepAttachments: testCaseAttemptData.stepAttachments,
56
55
  stepResults: testCaseAttemptData.stepResults,
57
56
  worstTestStepResult: testCaseAttemptData.worstTestStepResult,
58
57
  };
59
58
  }
60
59
  parseEnvelope(envelope) {
61
- this.query.update(envelope);
62
60
  if (value_checker_1.doesHaveValue(envelope.gherkinDocument)) {
63
61
  this.gherkinDocumentMap[envelope.gherkinDocument.uri] =
64
62
  envelope.gherkinDocument;
@@ -88,27 +86,36 @@ class EventDataCollector {
88
86
  initTestCaseAttempt(testCaseStarted) {
89
87
  this.testCaseAttemptDataMap[testCaseStarted.id] = {
90
88
  attempt: testCaseStarted.attempt,
89
+ willBeRetried: false,
91
90
  testCaseId: testCaseStarted.testCaseId,
92
91
  stepAttachments: {},
93
92
  stepResults: {},
94
- worstTestStepResult: {},
93
+ worstTestStepResult: {
94
+ duration: { seconds: 0, nanos: 0 },
95
+ status: messages.TestStepResultStatus.UNKNOWN,
96
+ },
95
97
  };
96
98
  }
97
- storeAttachment({ testCaseStartedId, testStepId, body, mediaType, }) {
99
+ storeAttachment(attachment) {
100
+ const { testCaseStartedId, testStepId } = attachment;
101
+ // TODO: we shouldn't have to check if these properties have values - they are non-nullable
98
102
  if (value_checker_1.doesHaveValue(testCaseStartedId) && value_checker_1.doesHaveValue(testStepId)) {
99
103
  const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId];
100
104
  if (value_checker_1.doesNotHaveValue(stepAttachments[testStepId])) {
101
105
  stepAttachments[testStepId] = [];
102
106
  }
103
- stepAttachments[testStepId].push({ body, mediaType });
107
+ stepAttachments[testStepId].push(attachment);
104
108
  }
105
109
  }
106
110
  storeTestStepResult({ testCaseStartedId, testStepId, testStepResult, }) {
107
- this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] = testStepResult;
111
+ this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =
112
+ testStepResult;
108
113
  }
109
- storeTestCaseResult({ testCaseStartedId }) {
110
- const stepResults = lodash_1.values(this.testCaseAttemptDataMap[testCaseStartedId].stepResults);
111
- this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult = this.query.getWorstTestStepResult(stepResults);
114
+ storeTestCaseResult({ testCaseStartedId, willBeRetried, }) {
115
+ const stepResults = Object.values(this.testCaseAttemptDataMap[testCaseStartedId].stepResults);
116
+ this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =
117
+ messages.getWorstTestStepResult(stepResults);
118
+ this.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried;
112
119
  }
113
120
  }
114
121
  exports.default = EventDataCollector;
@@ -1 +1 @@
1
- {"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,iDAA8C;AAE9C,uDAAqE;AAErE,2CAAuC;AAoBvC,MAAqB,kBAAkB;IAQrC,YAAY,gBAA8B;QAPlC,uBAAkB,GAA0C,EAAE,CAAA;QAC9D,cAAS,GAAiC,EAAE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ages } from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\nimport { EventEmitter } from 'events'\nimport { Query } from '@cucumber/query'\n\ninterface ITestCaseAttemptData {\n attempt: number\n testCaseId: string\n stepAttachments: Dictionary<messages.IAttachment[]>\n stepResults: Dictionary<messages.TestStepFinished.ITestStepResult>\n worstTestStepResult: messages.TestStepFinished.ITestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n gherkinDocument: messages.IGherkinDocument\n pickle: messages.IPickle\n stepAttachments: Dictionary<messages.IAttachment[]>\n stepResults: Dictionary<messages.TestStepFinished.ITestStepResult>\n testCase: messages.ITestCase\n worstTestStepResult: messages.TestStepFinished.ITestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Dictionary<messages.IGherkinDocument> = {}\n private pickleMap: Dictionary<messages.IPickle> = {}\n private testCaseMap: Dictionary<messages.ITestCase> = {}\n private testCaseAttemptDataMap: Dictionary<ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.IUndefinedParameterType[] = []\n readonly query = new Query()\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.IGherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.IPickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return _.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n this.query.update(envelope)\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n initTestCaseAttempt(testCaseStarted: messages.ITestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {},\n }\n }\n\n storeAttachment({\n testCaseStartedId,\n testStepId,\n body,\n mediaType,\n }: messages.IAttachment): void {\n if (doesHaveValue(testCaseStartedId) && doesHaveValue(testStepId)) {\n const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId]\n if (doesNotHaveValue(stepAttachments[testStepId])) {\n stepAttachments[testStepId] = []\n }\n stepAttachments[testStepId].push({ body, mediaType })\n }\n }\n\n storeTestStepResult({\n testCaseStartedId,\n testStepId,\n testStepResult,\n }: messages.ITestStepFinished): void {\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults[\n testStepId\n ] = testStepResult\n }\n\n storeTestCaseResult({ testCaseStartedId }: messages.ITestCaseFinished): void {\n const stepResults = values(\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults\n )\n this.testCaseAttemptDataMap[\n testCaseStartedId\n ].worstTestStepResult = this.query.getWorstTestStepResult(stepResults)\n }\n}\n"]}
1
+ {"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,uDAAqE;AAuBrE,MAAqB,kBAAkB;IAOrC,YAAY,gBAA8B;QANlC,uBAAkB,GAA6C,EAAE,CAAA;QACjE,cAAS,GAAoC,EAAE,CAAA;QAC/C,gBAAW,GAAsC,EAAE,CAAA;QACnD,2BAAsB,GAAyC,EAAE,CAAA;QAChE,4BAAuB,GAAsC,EAAE,CAAA;QAGtE,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;IAED,SAAS,CAAC,QAAgB;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;IAED,mBAAmB;QACjB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE;YACxE,OAAO,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,kBAAkB,CAAC,iBAAyB;QAC1C,MAAM,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;QAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAA;QACjE,MAAM,MAAM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B,CAAC,EAClB,iBAAiB,EACjB,UAAU,EACV,cAAc,GACY;QAC1B,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC;YACpE,cAAc,CAAA;IAClB,CAAC;IAED,mBAAmB,CAAC,EAClB,iBAAiB,EACjB,aAAa,GACa;QAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAC/B,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAC3D,CAAA;QACD,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,mBAAmB;YAChE,QAAQ,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAA;QAC9C,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,aAAa,GAAG,aAAa,CAAA;IAC9E,CAAC;CACF;AA5GD,qCA4GC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\nimport { EventEmitter } from 'events'\n\ninterface ITestCaseAttemptData {\n attempt: number\n willBeRetried: boolean\n testCaseId: string\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n worstTestStepResult: messages.TestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n willBeRetried: boolean\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n testCase: messages.TestCase\n worstTestStepResult: messages.TestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Record<string, messages.GherkinDocument> = {}\n private pickleMap: Record<string, messages.Pickle> = {}\n private testCaseMap: Record<string, messages.TestCase> = {}\n private testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.UndefinedParameterType[] = []\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.GherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.Pickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return Object.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n willBeRetried: testCaseAttemptData.willBeRetried,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n private initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n willBeRetried: false,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {\n duration: { seconds: 0, nanos: 0 },\n status: messages.TestStepResultStatus.UNKNOWN,\n },\n }\n }\n\n storeAttachment(attachment: messages.Attachment): void {\n const { testCaseStartedId, testStepId } = attachment\n // TODO: we shouldn't have to check if these properties have values - they are non-nullable\n if (doesHaveValue(testCaseStartedId) && doesHaveValue(testStepId)) {\n const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId]\n if (doesNotHaveValue(stepAttachments[testStepId])) {\n stepAttachments[testStepId] = []\n }\n stepAttachments[testStepId].push(attachment)\n }\n }\n\n storeTestStepResult({\n testCaseStartedId,\n testStepId,\n testStepResult,\n }: messages.TestStepFinished): void {\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =\n testStepResult\n }\n\n storeTestCaseResult({\n testCaseStartedId,\n willBeRetried,\n }: messages.TestCaseFinished): void {\n const stepResults = Object.values(\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults\n )\n this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =\n messages.getWorstTestStepResult(stepResults)\n this.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import Formatter from '../.';
2
+ declare const Formatters: {
3
+ getFormatters(): Record<string, typeof Formatter>;
4
+ buildFormattersDocumentationString(): string;
5
+ };
6
+ export default Formatters;
@@ -0,0 +1,41 @@
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 json_formatter_1 = __importDefault(require("../json_formatter"));
7
+ const message_formatter_1 = __importDefault(require("../message_formatter"));
8
+ const progress_bar_formatter_1 = __importDefault(require("../progress_bar_formatter"));
9
+ const progress_formatter_1 = __importDefault(require("../progress_formatter"));
10
+ const rerun_formatter_1 = __importDefault(require("../rerun_formatter"));
11
+ const snippets_formatter_1 = __importDefault(require("../snippets_formatter"));
12
+ const summary_formatter_1 = __importDefault(require("../summary_formatter"));
13
+ const usage_formatter_1 = __importDefault(require("../usage_formatter"));
14
+ const usage_json_formatter_1 = __importDefault(require("../usage_json_formatter"));
15
+ const html_formatter_1 = __importDefault(require("../html_formatter"));
16
+ const Formatters = {
17
+ getFormatters() {
18
+ return {
19
+ json: json_formatter_1.default,
20
+ message: message_formatter_1.default,
21
+ html: html_formatter_1.default,
22
+ progress: progress_formatter_1.default,
23
+ 'progress-bar': progress_bar_formatter_1.default,
24
+ rerun: rerun_formatter_1.default,
25
+ snippets: snippets_formatter_1.default,
26
+ summary: summary_formatter_1.default,
27
+ usage: usage_formatter_1.default,
28
+ 'usage-json': usage_json_formatter_1.default,
29
+ };
30
+ },
31
+ buildFormattersDocumentationString() {
32
+ let concatanatedFormattersDocumentation = '';
33
+ const formatters = this.getFormatters();
34
+ for (const formatterName in formatters) {
35
+ concatanatedFormattersDocumentation += ` ${formatterName}: ${formatters[formatterName].documentation}\n`;
36
+ }
37
+ return concatanatedFormattersDocumentation;
38
+ },
39
+ };
40
+ exports.default = Formatters;
41
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/formatter/helpers/formatters.ts"],"names":[],"mappings":";;;;;AACA,uEAA6C;AAC7C,6EAAmD;AACnD,uFAA4D;AAC5D,+EAAqD;AACrD,yEAA+C;AAC/C,+EAAqD;AACrD,6EAAmD;AACnD,yEAA+C;AAC/C,mFAAwD;AACxD,uEAA6C;AAE7C,MAAM,UAAU,GAAG;IACjB,aAAa;QACX,OAAO;YACL,IAAI,EAAE,wBAAa;YACnB,OAAO,EAAE,2BAAgB;YACzB,IAAI,EAAE,wBAAa;YACnB,QAAQ,EAAE,4BAAiB;YAC3B,cAAc,EAAE,gCAAoB;YACpC,KAAK,EAAE,yBAAc;YACrB,QAAQ,EAAE,4BAAiB;YAC3B,OAAO,EAAE,2BAAgB;YACzB,KAAK,EAAE,yBAAc;YACrB,YAAY,EAAE,8BAAkB;SACjC,CAAA;IACH,CAAC;IACD,kCAAkC;QAChC,IAAI,mCAAmC,GAAW,EAAE,CAAA;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QACvC,KAAK,MAAM,aAAa,IAAI,UAAU,EAAE;YACtC,mCAAmC,IAAI,OAAO,aAAa,KAAK,UAAU,CAAC,aAAa,CAAC,CAAC,aAAa,IAAI,CAAA;SAC5G;QAED,OAAO,mCAAmC,CAAA;IAC5C,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import Formatter from '../.'\nimport JsonFormatter from '../json_formatter'\nimport MessageFormatter from '../message_formatter'\nimport ProgressBarFormatter from '../progress_bar_formatter'\nimport ProgressFormatter from '../progress_formatter'\nimport RerunFormatter from '../rerun_formatter'\nimport SnippetsFormatter from '../snippets_formatter'\nimport SummaryFormatter from '../summary_formatter'\nimport UsageFormatter from '../usage_formatter'\nimport UsageJsonFormatter from '../usage_json_formatter'\nimport HtmlFormatter from '../html_formatter'\n\nconst Formatters = {\n getFormatters(): Record<string, typeof Formatter> {\n return {\n json: JsonFormatter,\n message: MessageFormatter,\n html: HtmlFormatter,\n progress: ProgressFormatter,\n 'progress-bar': ProgressBarFormatter,\n rerun: RerunFormatter,\n snippets: SnippetsFormatter,\n summary: SummaryFormatter,\n usage: UsageFormatter,\n 'usage-json': UsageJsonFormatter,\n }\n },\n buildFormattersDocumentationString(): string {\n let concatanatedFormattersDocumentation: string = ''\n const formatters = this.getFormatters()\n for (const formatterName in formatters) {\n concatanatedFormattersDocumentation += ` ${formatterName}: ${formatters[formatterName].documentation}\\n`\n }\n\n return concatanatedFormattersDocumentation\n },\n}\n\nexport default Formatters\n"]}
@@ -1,6 +1,5 @@
1
- import { Dictionary } from 'lodash';
2
- import { messages } from '@cucumber/messages';
3
- export declare function getGherkinStepMap(gherkinDocument: messages.IGherkinDocument): Dictionary<messages.GherkinDocument.Feature.IStep>;
4
- export declare function getGherkinScenarioMap(gherkinDocument: messages.IGherkinDocument): Dictionary<messages.GherkinDocument.Feature.IScenario>;
5
- export declare function getGherkinExampleRuleMap(gherkinDocument: messages.IGherkinDocument): Dictionary<messages.GherkinDocument.Feature.FeatureChild.IRule>;
6
- export declare function getGherkinScenarioLocationMap(gherkinDocument: messages.IGherkinDocument): Dictionary<messages.ILocation>;
1
+ import * as messages from '@cucumber/messages';
2
+ export declare function getGherkinStepMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Step>;
3
+ export declare function getGherkinScenarioMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Scenario>;
4
+ export declare function getGherkinExampleRuleMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Rule>;
5
+ export declare function getGherkinScenarioLocationMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Location>;
@@ -1,20 +1,14 @@
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
3
  exports.getGherkinScenarioLocationMap = exports.getGherkinExampleRuleMap = exports.getGherkinScenarioMap = exports.getGherkinStepMap = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const value_checker_1 = require("../../value_checker");
9
5
  function getGherkinStepMap(gherkinDocument) {
10
- return lodash_1.default.chain(gherkinDocument.feature.children)
6
+ const result = {};
7
+ gherkinDocument.feature.children
11
8
  .map(extractStepContainers)
12
- .flatten()
13
- .map('steps')
14
- .flatten()
15
- .map((step) => [step.id, step])
16
- .fromPairs()
17
- .value();
9
+ .flat()
10
+ .forEach((x) => x.steps.forEach((step) => (result[step.id] = step)));
11
+ return result;
18
12
  }
19
13
  exports.getGherkinStepMap = getGherkinStepMap;
20
14
  function extractStepContainers(child) {
@@ -29,51 +23,41 @@ function extractStepContainers(child) {
29
23
  return [child.scenario];
30
24
  }
31
25
  function getGherkinScenarioMap(gherkinDocument) {
32
- return lodash_1.default.chain(gherkinDocument.feature.children)
26
+ const result = {};
27
+ gherkinDocument.feature.children
33
28
  .map((child) => {
34
29
  if (value_checker_1.doesHaveValue(child.rule)) {
35
30
  return child.rule.children;
36
31
  }
37
32
  return [child];
38
33
  })
39
- .flatten()
40
- .filter('scenario')
41
- .map('scenario')
42
- .map((scenario) => [
43
- scenario.id,
44
- scenario,
45
- ])
46
- .fromPairs()
47
- .value();
34
+ .flat()
35
+ .forEach((x) => {
36
+ if (x.scenario != null) {
37
+ result[x.scenario.id] = x.scenario;
38
+ }
39
+ });
40
+ return result;
48
41
  }
49
42
  exports.getGherkinScenarioMap = getGherkinScenarioMap;
50
43
  function getGherkinExampleRuleMap(gherkinDocument) {
51
- return lodash_1.default.chain(gherkinDocument.feature.children)
52
- .filter('rule')
53
- .map('rule')
54
- .map((rule) => {
55
- return rule.children
56
- .filter((child) => value_checker_1.doesHaveValue(child.scenario))
57
- .map((child) => [child.scenario.id, rule]);
58
- })
59
- .flatten()
60
- .fromPairs()
61
- .value();
44
+ const result = {};
45
+ gherkinDocument.feature.children
46
+ .filter((x) => x.rule != null)
47
+ .forEach((x) => x.rule.children
48
+ .filter((child) => value_checker_1.doesHaveValue(child.scenario))
49
+ .forEach((child) => (result[child.scenario.id] = x.rule)));
50
+ return result;
62
51
  }
63
52
  exports.getGherkinExampleRuleMap = getGherkinExampleRuleMap;
64
53
  function getGherkinScenarioLocationMap(gherkinDocument) {
65
54
  const locationMap = {};
66
55
  const scenarioMap = getGherkinScenarioMap(gherkinDocument);
67
- lodash_1.default.entries(scenarioMap).forEach(([id, scenario]) => {
56
+ Object.keys(scenarioMap).forEach((id) => {
57
+ const scenario = scenarioMap[id];
68
58
  locationMap[id] = scenario.location;
69
59
  if (value_checker_1.doesHaveValue(scenario.examples)) {
70
- lodash_1.default.chain(scenario.examples)
71
- .map('tableBody')
72
- .flatten()
73
- .forEach((tableRow) => {
74
- locationMap[tableRow.id] = tableRow.location;
75
- })
76
- .value();
60
+ scenario.examples.forEach((x) => x.tableBody.forEach((tableRow) => (locationMap[tableRow.id] = tableRow.location)));
77
61
  }
78
62
  });
79
63
  return locationMap;
@@ -1 +1 @@
1
- {"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsC;AAEtC,uDAAmD;AAEnD,SAAgB,iBAAiB,CAC/B,eAA0C;IAE1C,OAAO,gBAAC,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC7C,GAAG,CAAC,qBAAqB,CAAC;SAC1B,OAAO,EAAE;SACT,GAAG,CAAC,OAAO,CAAC;SACZ,OAAO,EAAE;SACT,GAAG,CAAC,CAAC,IAA4C,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SACtE,SAAS,EAAE;SACX,KAAK,EAAE,CAAA;AACZ,CAAC;AAXD,8CAWC;AAED,SAAS,qBAAqB,CAC5B,KAAqD;IAKrD,IAAI,6BAAa,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;QACnC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;KAC1B;SAAM,IAAI,6BAAa,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACpC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAC3C,6BAAa,CAAC,SAAS,CAAC,UAAU,CAAC;YACjC,CAAC,CAAC,SAAS,CAAC,UAAU;YACtB,CAAC,CAAC,SAAS,CAAC,QAAQ,CACvB,CAAA;KACF;IACD,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AACzB,CAAC;AAED,SAAgB,qBAAqB,CACnC,eAA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,OAAO,CAA6C,WAAW,CAAC,CAAC,OAAO,CACxE,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE;QACjB,WAAW,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAA;QACnC,IAAI,6BAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACpC,gBAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;iBACvB,GAAG,CAAC,WAAW,CAAC;iBAChB,OAAO,EAAE;iBACT,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpB,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAA;YAC9C,CAAC,CAAC;iBACD,KAAK,EAAE,CAAA;SACX;IACH,CAAC,CACF,CAAA;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAtBD,sEAsBC","sourcesContent":["import _, { Dictionary } from 'lodash'\nimport { messages } from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport function getGherkinStepMap(\n gherkinDocument: messages.IGherkinDocument\n): Dictionary<messages.GherkinDocument.Feature.IStep> {\n return _.chain(gherkinDocument.feature.children)\n .map(extractStepContainers)\n .flatten()\n .map('steps')\n .flatten()\n .map((step: messages.GherkinDocument.Feature.IStep) => [step.id, step])\n .fromPairs()\n .value()\n}\n\nfunction extractStepContainers(\n child: messages.GherkinDocument.Feature.IFeatureChild\n): Array<\n | messages.GherkinDocument.Feature.IScenario\n | messages.GherkinDocument.Feature.IBackground\n> {\n if (doesHaveValue(child.background)) {\n return [child.background]\n } else if (doesHaveValue(child.rule)) {\n return child.rule.children.map((ruleChild) =>\n doesHaveValue(ruleChild.background)\n ? ruleChild.background\n : ruleChild.scenario\n )\n }\n return [child.scenario]\n}\n\nexport function getGherkinScenarioMap(\n gherkinDocument: messages.IGherkinDocument\n): Dictionary<messages.GherkinDocument.Feature.IScenario> {\n return _.chain(gherkinDocument.feature.children)\n .map((child: messages.GherkinDocument.Feature.IFeatureChild) => {\n if (doesHaveValue(child.rule)) {\n return child.rule.children\n }\n return [child]\n })\n .flatten()\n .filter('scenario')\n .map('scenario')\n .map((scenario: messages.GherkinDocument.Feature.IScenario) => [\n scenario.id,\n scenario,\n ])\n .fromPairs()\n .value()\n}\n\nexport function getGherkinExampleRuleMap(\n gherkinDocument: messages.IGherkinDocument\n): Dictionary<messages.GherkinDocument.Feature.FeatureChild.IRule> {\n return _.chain(gherkinDocument.feature.children)\n .filter('rule')\n .map('rule')\n .map((rule) => {\n return rule.children\n .filter((child) => doesHaveValue(child.scenario))\n .map((child) => [child.scenario.id, rule])\n })\n .flatten()\n .fromPairs()\n .value()\n}\n\nexport function getGherkinScenarioLocationMap(\n gherkinDocument: messages.IGherkinDocument\n): Dictionary<messages.ILocation> {\n const locationMap: Dictionary<messages.ILocation> = {}\n const scenarioMap: Dictionary<messages.GherkinDocument.Feature.IScenario> = getGherkinScenarioMap(\n gherkinDocument\n )\n _.entries<messages.GherkinDocument.Feature.IScenario>(scenarioMap).forEach(\n ([id, scenario]) => {\n locationMap[id] = scenario.location\n if (doesHaveValue(scenario.examples)) {\n _.chain(scenario.examples)\n .map('tableBody')\n .flatten()\n .forEach((tableRow) => {\n locationMap[tableRow.id] = tableRow.location\n })\n .value()\n }\n }\n )\n return locationMap\n}\n"]}
1
+ {"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":";;;AACA,uDAAmD;AAEnD,SAAgB,iBAAiB,CAC/B,eAAyC;IAEzC,MAAM,MAAM,GAAkC,EAAE,CAAA;IAChD,eAAe,CAAC,OAAO,CAAC,QAAQ;SAC7B,GAAG,CAAC,qBAAqB,CAAC;SAC1B,IAAI,EAAE;SACN,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,CAAC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sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport function getGherkinStepMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Step> {\n const result: Record<string, messages.Step> = {}\n gherkinDocument.feature.children\n .map(extractStepContainers)\n .flat()\n .forEach((x) =>\n x.steps.forEach((step: messages.Step) => (result[step.id] = step))\n )\n return result\n}\n\nfunction extractStepContainers(\n child: messages.FeatureChild\n): Array<messages.Scenario | messages.Background> {\n if (doesHaveValue(child.background)) {\n return [child.background]\n } else if (doesHaveValue(child.rule)) {\n return child.rule.children.map((ruleChild) =>\n doesHaveValue(ruleChild.background)\n ? ruleChild.background\n : ruleChild.scenario\n )\n }\n return [child.scenario]\n}\n\nexport function getGherkinScenarioMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Scenario> {\n const result: Record<string, messages.Scenario> = {}\n gherkinDocument.feature.children\n .map((child: messages.FeatureChild) => {\n if (doesHaveValue(child.rule)) {\n return child.rule.children\n }\n return [child]\n })\n .flat()\n .forEach((x) => {\n if (x.scenario != null) {\n result[x.scenario.id] = x.scenario\n }\n })\n return result\n}\n\nexport function getGherkinExampleRuleMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Rule> {\n const result: Record<string, messages.Rule> = {}\n gherkinDocument.feature.children\n .filter((x) => x.rule != null)\n .forEach((x) =>\n x.rule.children\n .filter((child) => doesHaveValue(child.scenario))\n .forEach((child) => (result[child.scenario.id] = x.rule))\n )\n return result\n}\n\nexport function getGherkinScenarioLocationMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Location> {\n const locationMap: Record<string, messages.Location> = {}\n const scenarioMap: Record<string, messages.Scenario> =\n getGherkinScenarioMap(gherkinDocument)\n Object.keys(scenarioMap).forEach((id) => {\n const scenario = scenarioMap[id]\n locationMap[id] = scenario.location\n if (doesHaveValue(scenario.examples)) {\n scenario.examples.forEach((x) =>\n x.tableBody.forEach(\n (tableRow) => (locationMap[tableRow.id] = tableRow.location)\n )\n )\n }\n })\n return locationMap\n}\n"]}
@@ -1,11 +1,11 @@
1
- import { messages } from '@cucumber/messages';
1
+ import * as messages from '@cucumber/messages';
2
2
  import { IColorFns } from '../get_color_fns';
3
3
  import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
4
4
  import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
5
5
  import { ITestCaseAttempt } from './event_data_collector';
6
- export declare function isFailure(result: messages.TestStepFinished.ITestStepResult): boolean;
7
- export declare function isWarning(result: messages.TestStepFinished.ITestStepResult): boolean;
8
- export declare function isIssue(result: messages.TestStepFinished.ITestStepResult): boolean;
6
+ export declare function isFailure(result: messages.TestStepResult, willBeRetried?: boolean): boolean;
7
+ export declare function isWarning(result: messages.TestStepResult, willBeRetried?: boolean): boolean;
8
+ export declare function isIssue(result: messages.TestStepResult): boolean;
9
9
  export interface IFormatIssueRequest {
10
10
  colorFns: IColorFns;
11
11
  cwd: string;
@@ -15,5 +15,5 @@ export interface IFormatIssueRequest {
15
15
  supportCodeLibrary: ISupportCodeLibrary;
16
16
  }
17
17
  export declare function formatIssue({ colorFns, cwd, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, }: IFormatIssueRequest): string;
18
- export declare function formatUndefinedParameterTypes(undefinedParameterTypes: messages.IUndefinedParameterType[]): string;
19
- export declare function formatUndefinedParameterType(parameterType: messages.IUndefinedParameterType): string;
18
+ export declare function formatUndefinedParameterTypes(undefinedParameterTypes: messages.UndefinedParameterType[]): string;
19
+ export declare function formatUndefinedParameterType(parameterType: messages.UndefinedParameterType): string;
@@ -5,17 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.formatUndefinedParameterType = exports.formatUndefinedParameterTypes = exports.formatIssue = exports.isIssue = exports.isWarning = exports.isFailure = void 0;
7
7
  const indent_string_1 = __importDefault(require("indent-string"));
8
- const status_1 = __importDefault(require("../../status"));
9
8
  const test_case_attempt_formatter_1 = require("./test_case_attempt_formatter");
10
- function isFailure(result) {
11
- return (result.status === status_1.default.AMBIGUOUS ||
12
- result.status === status_1.default.UNDEFINED ||
13
- (result.status === status_1.default.FAILED && !result.willBeRetried));
9
+ function isFailure(result, willBeRetried = false) {
10
+ return (result.status === 'AMBIGUOUS' ||
11
+ result.status === 'UNDEFINED' ||
12
+ (result.status === 'FAILED' && !willBeRetried));
14
13
  }
15
14
  exports.isFailure = isFailure;
16
- function isWarning(result) {
17
- return (result.status === status_1.default.PENDING ||
18
- (result.status === status_1.default.FAILED && result.willBeRetried));
15
+ function isWarning(result, willBeRetried = false) {
16
+ return (result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried));
19
17
  }
20
18
  exports.isWarning = isWarning;
21
19
  function isIssue(result) {
@@ -1 +1 @@
1
- {"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,0DAAiC;AACjC,+EAAqE;AAQrE,SAAgB,SAAS,CACvB,MAAiD;IAEjD,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,gBAAM,CAAC,SAAS;QAClC,MAAM,CAAC,MAAM,KAAK,gBAAM,CAAC,SAAS;QAClC,CAAC,MAAM,CAAC,MAAM,KAAK,gBAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAC3D,CAAA;AACH,CAAC;AARD,8BAQC;AAED,SAAgB,SAAS,CACvB,MAAiD;IAEjD,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,gBAAM,CAAC,OAAO;QAChC,CAAC,MAAM,CAAC,MAAM,KAAK,gBAAM,CAAC,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC,CAC1D,CAAA;AACH,CAAC;AAPD,8BAOC;AAED,SAAgB,OAAO,CACrB,MAAiD;IAEjD,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAA;A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A;IACnB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAjBD,sEAiBC;AAED,SAAgB,4BAA4B,CAC1C,aAA+C;IAE/C,OAAO,IAAI,aAAa,CAAC,IAAI,YAAY,aAAa,CAAC,UAAU,IAAI,CAAA;AACvE,CAAC;AAJD,oEAIC","sourcesContent":["import indentString from 'indent-string'\nimport Status from '../../status'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\nimport { messages } from '@cucumber/messages'\nimport { IColorFns } from '../get_color_fns'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport { Dictionary } from 'lodash'\n\nexport function isFailure(\n result: messages.TestStepFinished.ITestStepResult\n): boolean {\n return (\n result.status === Status.AMBIGUOUS ||\n result.status === Status.UNDEFINED ||\n (result.status === Status.FAILED && !result.willBeRetried)\n )\n}\n\nexport function isWarning(\n result: messages.TestStepFinished.ITestStepResult\n): boolean {\n return (\n result.status === Status.PENDING ||\n (result.status === Status.FAILED && result.willBeRetried)\n )\n}\n\nexport function isIssue(\n result: messages.TestStepFinished.ITestStepResult\n): boolean {\n return isFailure(result) || isWarning(result)\n}\n\nexport interface IFormatIssueRequest {\n colorFns: IColorFns\n cwd: string\n number: number\n snippetBuilder: StepDefinitionSnippetBuilder\n testCaseAttempt: ITestCaseAttempt\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport function formatIssue({\n colorFns,\n cwd,\n number,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n}: IFormatIssueRequest): string {\n const prefix = `${number.toString()}) `\n const formattedTestCaseAttempt = formatTestCaseAttempt({\n colorFns,\n cwd,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n const lines = formattedTestCaseAttempt.split('\\n')\n const updatedLines = lines.map((line, index) => {\n if (index === 0) {\n return `${prefix}${line}`\n }\n return indentString(line, prefix.length)\n })\n return updatedLines.join('\\n')\n}\n\nexport function formatUndefinedParameterTypes(\n undefinedParameterTypes: messages.IUndefinedParameterType[]\n): string {\n const output = [`Undefined parameter types:\\n\\n`]\n const withLatest: Dictionary<messages.IUndefinedParameterType> = {}\n undefinedParameterTypes.forEach((parameterType) => {\n withLatest[parameterType.name] = parameterType\n })\n output.push(\n Object.values(withLatest)\n .map(\n (parameterType) => `- ${formatUndefinedParameterType(parameterType)}`\n )\n .join('\\n')\n )\n output.push('\\n\\n')\n return output.join('')\n}\n\nexport function formatUndefinedParameterType(\n parameterType: messages.IUndefinedParameterType\n): string {\n return `\"${parameterType.name}\" e.g. \\`${parameterType.expression}\\``\n}\n"]}
1
+ {"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,+EAAqE;AAOrE,SAAgB,SAAS,CACvB,MAA+B,EAC/B,gBAAyB,KAAK;IAE9B,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,aAAa,CAAC,CAC/C,CAAA;AACH,CAAC;AATD,8BASC;AAED,SAAgB,SAAS,CACvB,MAA+B,EAC/B,gBAAyB,KAAK;IAE9B,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,aAAa,CAAC,CAC7E,CAAA;AACH,CAAC;AAPD,8BAOC;AAED,SAAgB,OAAO,CAAC,MAA+B;IACrD,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAA;AAC/C,CAAC;AAFD,0BAEC;AAWD,SAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,GAAG,EACH,MAAM,EACN,cAAc,EACd,eAAe,EACf,kBAAkB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AE9C,OAAO,IAAI,aAAa,CAAC,IAAI,YAAY,aAAa,CAAC,UAAU,IAAI,CAAA;AACvE,CAAC;AAJD,oEAIC","sourcesContent":["import indentString from 'indent-string'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\nimport * as messages from '@cucumber/messages'\nimport { IColorFns } from '../get_color_fns'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { ITestCaseAttempt } from './event_data_collector'\n\nexport function isFailure(\n result: messages.TestStepResult,\n willBeRetried: boolean = false\n): boolean {\n return (\n result.status === 'AMBIGUOUS' ||\n result.status === 'UNDEFINED' ||\n (result.status === 'FAILED' && !willBeRetried)\n )\n}\n\nexport function isWarning(\n result: messages.TestStepResult,\n willBeRetried: boolean = false\n): boolean {\n return (\n result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried)\n )\n}\n\nexport function isIssue(result: messages.TestStepResult): boolean {\n return isFailure(result) || isWarning(result)\n}\n\nexport interface IFormatIssueRequest {\n colorFns: IColorFns\n cwd: string\n number: number\n snippetBuilder: StepDefinitionSnippetBuilder\n testCaseAttempt: ITestCaseAttempt\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport function formatIssue({\n colorFns,\n cwd,\n number,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n}: IFormatIssueRequest): string {\n const prefix = `${number.toString()}) `\n const formattedTestCaseAttempt = formatTestCaseAttempt({\n colorFns,\n cwd,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n const lines = formattedTestCaseAttempt.split('\\n')\n const updatedLines = lines.map((line, index) => {\n if (index === 0) {\n return `${prefix}${line}`\n }\n return indentString(line, prefix.length)\n })\n return updatedLines.join('\\n')\n}\n\nexport function formatUndefinedParameterTypes(\n undefinedParameterTypes: messages.UndefinedParameterType[]\n): string {\n const output = [`Undefined parameter types:\\n\\n`]\n const withLatest: Record<string, messages.UndefinedParameterType> = {}\n undefinedParameterTypes.forEach((parameterType) => {\n withLatest[parameterType.name] = parameterType\n })\n output.push(\n Object.values(withLatest)\n .map(\n (parameterType) => `- ${formatUndefinedParameterType(parameterType)}`\n )\n .join('\\n')\n )\n output.push('\\n\\n')\n return output.join('')\n}\n\nexport function formatUndefinedParameterType(\n parameterType: messages.UndefinedParameterType\n): string {\n return `\"${parameterType.name}\" e.g. \\`${parameterType.expression}\\``\n}\n"]}
@@ -1,10 +1,6 @@
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
3
  exports.getStepKeywordType = exports.KeywordType = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const gherkin_1 = require("@cucumber/gherkin");
9
5
  const value_checker_1 = require("../../value_checker");
10
6
  var KeywordType;
@@ -16,7 +12,7 @@ var KeywordType;
16
12
  function getStepKeywordType({ keyword, language, previousKeywordType, }) {
17
13
  const dialect = gherkin_1.dialects[language];
18
14
  const stepKeywords = ['given', 'when', 'then', 'and', 'but'];
19
- const type = lodash_1.default.find(stepKeywords, (key) => lodash_1.default.includes(dialect[key], keyword));
15
+ const type = stepKeywords.find((key) => dialect[key].includes(keyword));
20
16
  switch (type) {
21
17
  case 'when':
22
18
  return KeywordType.Event;
@@ -1 +1 @@
1
- {"version":3,"file":"keyword_type.js","sourceRoot":"","sources":["../../../src/formatter/helpers/keyword_type.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAsB;AACtB,+CAAqD;AACrD,uDAAmD;AAEnD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4CAA6B,CAAA;IAC7B,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAQD,SAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,EACR,mBAAmB,GACQ;IAC3B,MAAM,OAAO,GAAY,kBAAQ,CAAC,QAAQ,CAAC,CAAA;IAC3C,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;IACrE,MAAM,IAAI,GAAG,gBAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA;IAC7E,QAAQ,IAAI,EAAE;QACZ,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,KAAK,CAAA;QAC1B,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,OAAO,CAAA;QAC5B,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,IAAI,6BAAa,CAAC,mBAAmB,CAAC,EAAE;gBACtC,OAAO,mBAAmB,CAAA;aAC3B;QACH,cAAc;QACd;YACE,OAAO,WAAW,CAAC,YAAY,CAAA;KAClC;AACH,CAAC;AAtBD,gDAsBC","sourcesContent":["import _ from 'lodash'\nimport { Dialect, dialects } from '@cucumber/gherkin'\nimport { doesHaveValue } from '../../value_checker'\n\nexport enum KeywordType {\n Precondition = 'precondition',\n Event = 'event',\n Outcome = 'outcome',\n}\n\nexport interface IGetStepKeywordTypeOptions {\n keyword: string\n language: string\n previousKeywordType?: KeywordType\n}\n\nexport function getStepKeywordType({\n keyword,\n language,\n previousKeywordType,\n}: IGetStepKeywordTypeOptions): KeywordType {\n const dialect: Dialect = dialects[language]\n const stepKeywords = ['given', 'when', 'then', 'and', 'but'] as const\n const type = _.find(stepKeywords, (key) => _.includes(dialect[key], keyword))\n switch (type) {\n case 'when':\n return KeywordType.Event\n case 'then':\n return KeywordType.Outcome\n case 'and':\n case 'but':\n if (doesHaveValue(previousKeywordType)) {\n return previousKeywordType\n }\n // fallthrough\n default:\n return KeywordType.Precondition\n }\n}\n"]}
1
+ {"version":3,"file":"keyword_type.js","sourceRoot":"","sources":["../../../src/formatter/helpers/keyword_type.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,uDAAmD;AAEnD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4CAA6B,CAAA;IAC7B,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAQD,SAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,EACR,mBAAmB,GACQ;IAC3B,MAAM,OAAO,GAAY,kBAAQ,CAAC,QAAQ,CAAC,CAAA;IAC3C,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;IACrE,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IACvE,QAAQ,IAAI,EAAE;QACZ,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,KAAK,CAAA;QAC1B,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,OAAO,CAAA;QAC5B,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,IAAI,6BAAa,CAAC,mBAAmB,CAAC,EAAE;gBACtC,OAAO,mBAAmB,CAAA;aAC3B;QACH,cAAc;QACd;YACE,OAAO,WAAW,CAAC,YAAY,CAAA;KAClC;AACH,CAAC;AAtBD,gDAsBC","sourcesContent":["import { Dialect, dialects } from '@cucumber/gherkin'\nimport { doesHaveValue } from '../../value_checker'\n\nexport enum KeywordType {\n Precondition = 'precondition',\n Event = 'event',\n Outcome = 'outcome',\n}\n\nexport interface IGetStepKeywordTypeOptions {\n keyword: string\n language: string\n previousKeywordType?: KeywordType\n}\n\nexport function getStepKeywordType({\n keyword,\n language,\n previousKeywordType,\n}: IGetStepKeywordTypeOptions): KeywordType {\n const dialect: Dialect = dialects[language]\n const stepKeywords = ['given', 'when', 'then', 'and', 'but'] as const\n const type = stepKeywords.find((key) => dialect[key].includes(keyword))\n switch (type) {\n case 'when':\n return KeywordType.Event\n case 'then':\n return KeywordType.Outcome\n case 'and':\n case 'but':\n if (doesHaveValue(previousKeywordType)) {\n return previousKeywordType\n }\n // fallthrough\n default:\n return KeywordType.Precondition\n }\n}\n"]}
@@ -1,18 +1,17 @@
1
- import { Dictionary } from 'lodash';
2
- import { messages } from '@cucumber/messages';
1
+ import * as messages from '@cucumber/messages';
3
2
  export interface IGetPickleLocationRequest {
4
- gherkinDocument: messages.IGherkinDocument;
5
- pickle: messages.IPickle;
3
+ gherkinDocument: messages.GherkinDocument;
4
+ pickle: messages.Pickle;
6
5
  }
7
6
  export interface IGetStepKeywordRequest {
8
- pickleStep: messages.Pickle.IPickleStep;
9
- gherkinStepMap: Dictionary<messages.GherkinDocument.Feature.IStep>;
7
+ pickleStep: messages.PickleStep;
8
+ gherkinStepMap: Record<string, messages.Step>;
10
9
  }
11
10
  export interface IGetScenarioDescriptionRequest {
12
- pickle: messages.IPickle;
13
- gherkinScenarioMap: Dictionary<messages.GherkinDocument.Feature.IScenario>;
11
+ pickle: messages.Pickle;
12
+ gherkinScenarioMap: Record<string, messages.Scenario>;
14
13
  }
15
14
  export declare function getScenarioDescription({ pickle, gherkinScenarioMap, }: IGetScenarioDescriptionRequest): string;
16
15
  export declare function getStepKeyword({ pickleStep, gherkinStepMap, }: IGetStepKeywordRequest): string;
17
- export declare function getPickleStepMap(pickle: messages.IPickle): Dictionary<messages.Pickle.IPickleStep>;
18
- export declare function getPickleLocation({ gherkinDocument, pickle, }: IGetPickleLocationRequest): messages.ILocation;
16
+ export declare function getPickleStepMap(pickle: messages.Pickle): Record<string, messages.PickleStep>;
17
+ export declare function getPickleLocation({ gherkinDocument, pickle, }: IGetPickleLocationRequest): messages.Location;