@dev-blinq/cucumber-js 1.0.6 → 1.0.8

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 (238) hide show
  1. package/bin/cucumber-js +0 -0
  2. package/bin/cucumber.js +0 -0
  3. package/lib/api/console_logger.d.ts +12 -12
  4. package/lib/api/console_logger.js +23 -23
  5. package/lib/api/convert_configuration.d.ts +4 -4
  6. package/lib/api/convert_configuration.js +64 -64
  7. package/lib/api/environment.d.ts +2 -2
  8. package/lib/api/environment.js +13 -13
  9. package/lib/api/formatters.d.ts +20 -20
  10. package/lib/api/formatters.js +60 -60
  11. package/lib/api/gherkin.d.ts +21 -21
  12. package/lib/api/gherkin.js +99 -99
  13. package/lib/api/index.d.ts +12 -12
  14. package/lib/api/index.js +27 -27
  15. package/lib/api/load_configuration.d.ts +9 -9
  16. package/lib/api/load_configuration.js +40 -40
  17. package/lib/api/load_sources.d.ts +9 -9
  18. package/lib/api/load_sources.js +52 -52
  19. package/lib/api/load_support.d.ts +10 -10
  20. package/lib/api/load_support.js +29 -29
  21. package/lib/api/paths.d.ts +8 -8
  22. package/lib/api/paths.js +101 -101
  23. package/lib/api/plugins.d.ts +4 -4
  24. package/lib/api/plugins.js +18 -18
  25. package/lib/api/run_cucumber.d.ts +11 -11
  26. package/lib/api/run_cucumber.js +114 -114
  27. package/lib/api/runtime.d.ts +21 -21
  28. package/lib/api/runtime.js +35 -35
  29. package/lib/api/support.d.ts +9 -9
  30. package/lib/api/support.js +25 -25
  31. package/lib/api/test_helpers.d.ts +3 -3
  32. package/lib/api/test_helpers.js +30 -30
  33. package/lib/api/types.d.ts +175 -175
  34. package/lib/api/types.js +2 -2
  35. package/lib/cli/helpers.d.ts +37 -37
  36. package/lib/cli/helpers.js +202 -202
  37. package/lib/cli/i18n.d.ts +2 -2
  38. package/lib/cli/i18n.js +69 -69
  39. package/lib/cli/index.d.ts +21 -21
  40. package/lib/cli/index.js +58 -58
  41. package/lib/cli/install_validator.d.ts +1 -1
  42. package/lib/cli/install_validator.js +13 -13
  43. package/lib/cli/run.d.ts +1 -1
  44. package/lib/cli/run.js +43 -43
  45. package/lib/cli/validate_node_engine_version.d.ts +10 -10
  46. package/lib/cli/validate_node_engine_version.js +23 -23
  47. package/lib/configuration/argv_parser.d.ts +20 -20
  48. package/lib/configuration/argv_parser.js +100 -100
  49. package/lib/configuration/check_schema.d.ts +2 -2
  50. package/lib/configuration/check_schema.js +59 -59
  51. package/lib/configuration/default_configuration.d.ts +2 -2
  52. package/lib/configuration/default_configuration.js +26 -26
  53. package/lib/configuration/from_file.d.ts +3 -3
  54. package/lib/configuration/from_file.js +84 -84
  55. package/lib/configuration/helpers.d.ts +1 -1
  56. package/lib/configuration/helpers.js +10 -10
  57. package/lib/configuration/index.d.ts +7 -7
  58. package/lib/configuration/index.js +28 -28
  59. package/lib/configuration/locate_file.d.ts +1 -1
  60. package/lib/configuration/locate_file.js +20 -20
  61. package/lib/configuration/merge_configurations.d.ts +2 -2
  62. package/lib/configuration/merge_configurations.js +47 -47
  63. package/lib/configuration/option_splitter.d.ts +3 -3
  64. package/lib/configuration/option_splitter.js +22 -22
  65. package/lib/configuration/types.d.ts +28 -28
  66. package/lib/configuration/types.js +2 -2
  67. package/lib/configuration/validate_configuration.d.ts +3 -3
  68. package/lib/configuration/validate_configuration.js +12 -12
  69. package/lib/filter_stack_trace.d.ts +3 -3
  70. package/lib/filter_stack_trace.js +37 -37
  71. package/lib/formatter/builder.d.ts +37 -37
  72. package/lib/formatter/builder.js +100 -100
  73. package/lib/formatter/bvt_formatter.d.ts +5 -0
  74. package/lib/formatter/bvt_formatter.js +21 -0
  75. package/lib/formatter/bvt_formatter.js.map +1 -0
  76. package/lib/formatter/feature_data_format.d.ts +14 -14
  77. package/lib/formatter/feature_data_format.js +80 -80
  78. package/lib/formatter/feature_data_format.js.map +1 -1
  79. package/lib/formatter/fixtures/typescript.d.ts +2 -2
  80. package/lib/formatter/fixtures/typescript.js +5 -5
  81. package/lib/formatter/get_color_fns.d.ts +15 -15
  82. package/lib/formatter/get_color_fns.js +55 -55
  83. package/lib/formatter/helpers/duration_helpers.d.ts +2 -2
  84. package/lib/formatter/helpers/duration_helpers.js +8 -8
  85. package/lib/formatter/helpers/event_data_collector.d.ts +30 -30
  86. package/lib/formatter/helpers/event_data_collector.js +125 -125
  87. package/lib/formatter/helpers/formatters.d.ts +6 -6
  88. package/lib/formatter/helpers/formatters.js +44 -42
  89. package/lib/formatter/helpers/formatters.js.map +1 -1
  90. package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -5
  91. package/lib/formatter/helpers/gherkin_document_parser.js +65 -65
  92. package/lib/formatter/helpers/index.d.ts +10 -10
  93. package/lib/formatter/helpers/index.js +51 -51
  94. package/lib/formatter/helpers/issue_helpers.d.ts +19 -19
  95. package/lib/formatter/helpers/issue_helpers.js +58 -58
  96. package/lib/formatter/helpers/keyword_type.d.ts +11 -11
  97. package/lib/formatter/helpers/keyword_type.js +31 -31
  98. package/lib/formatter/helpers/location_helpers.d.ts +2 -2
  99. package/lib/formatter/helpers/location_helpers.js +16 -16
  100. package/lib/formatter/helpers/pickle_parser.d.ts +17 -17
  101. package/lib/formatter/helpers/pickle_parser.js +27 -27
  102. package/lib/formatter/helpers/report_generator.d.ts +91 -0
  103. package/lib/formatter/helpers/report_generator.js +235 -0
  104. package/lib/formatter/helpers/report_generator.js.map +1 -0
  105. package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -2
  106. package/lib/formatter/helpers/step_argument_formatter.js +47 -47
  107. package/lib/formatter/helpers/summary_helpers.d.ts +9 -9
  108. package/lib/formatter/helpers/summary_helpers.js +95 -95
  109. package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +12 -12
  110. package/lib/formatter/helpers/test_case_attempt_formatter.js +113 -113
  111. package/lib/formatter/helpers/test_case_attempt_parser.d.ts +32 -32
  112. package/lib/formatter/helpers/test_case_attempt_parser.js +134 -134
  113. package/lib/formatter/helpers/usage_helpers/index.d.ts +23 -23
  114. package/lib/formatter/helpers/usage_helpers/index.js +110 -110
  115. package/lib/formatter/html_formatter.d.ts +7 -7
  116. package/lib/formatter/html_formatter.js +29 -29
  117. package/lib/formatter/index.d.ts +53 -53
  118. package/lib/formatter/index.js +20 -20
  119. package/lib/formatter/json_formatter.d.ts +78 -78
  120. package/lib/formatter/json_formatter.js +229 -229
  121. package/lib/formatter/junit_formatter.d.ts +17 -17
  122. package/lib/formatter/junit_formatter.js +180 -180
  123. package/lib/formatter/message_formatter.d.ts +5 -5
  124. package/lib/formatter/message_formatter.js +14 -14
  125. package/lib/formatter/progress_bar_formatter.d.ts +18 -18
  126. package/lib/formatter/progress_bar_formatter.js +98 -98
  127. package/lib/formatter/progress_formatter.d.ts +9 -9
  128. package/lib/formatter/progress_formatter.js +58 -58
  129. package/lib/formatter/rerun_formatter.d.ts +13 -13
  130. package/lib/formatter/rerun_formatter.js +79 -79
  131. package/lib/formatter/snippets_formatter.d.ts +6 -6
  132. package/lib/formatter/snippets_formatter.js +60 -60
  133. package/lib/formatter/step_definition_snippet_builder/index.d.ts +20 -20
  134. package/lib/formatter/step_definition_snippet_builder/index.js +45 -45
  135. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +7 -7
  136. package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +45 -45
  137. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +16 -16
  138. package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +10 -10
  139. package/lib/formatter/summary_formatter.d.ts +14 -14
  140. package/lib/formatter/summary_formatter.js +67 -67
  141. package/lib/formatter/usage_formatter.d.ts +6 -6
  142. package/lib/formatter/usage_formatter.js +97 -97
  143. package/lib/formatter/usage_json_formatter.d.ts +7 -7
  144. package/lib/formatter/usage_json_formatter.js +33 -33
  145. package/lib/index.d.ts +58 -58
  146. package/lib/index.js +108 -108
  147. package/lib/logger.d.ts +5 -5
  148. package/lib/logger.js +2 -2
  149. package/lib/models/data_table.d.ts +10 -10
  150. package/lib/models/data_table.js +45 -45
  151. package/lib/models/definition.d.ts +55 -55
  152. package/lib/models/definition.js +21 -21
  153. package/lib/models/gherkin_step_keyword.d.ts +1 -1
  154. package/lib/models/gherkin_step_keyword.js +2 -2
  155. package/lib/models/pickle_order.d.ts +1 -1
  156. package/lib/models/pickle_order.js +2 -2
  157. package/lib/models/step_definition.d.ts +11 -11
  158. package/lib/models/step_definition.js +36 -36
  159. package/lib/models/test_case_hook_definition.d.ts +10 -10
  160. package/lib/models/test_case_hook_definition.js +26 -26
  161. package/lib/models/test_run_hook_definition.d.ts +3 -3
  162. package/lib/models/test_run_hook_definition.js +9 -9
  163. package/lib/models/test_step_hook_definition.d.ts +9 -9
  164. package/lib/models/test_step_hook_definition.js +25 -25
  165. package/lib/pickle_filter.d.ts +42 -42
  166. package/lib/pickle_filter.js +98 -98
  167. package/lib/plugin/index.d.ts +2 -2
  168. package/lib/plugin/index.js +18 -18
  169. package/lib/plugin/plugin_manager.d.ts +13 -13
  170. package/lib/plugin/plugin_manager.js +35 -35
  171. package/lib/plugin/types.d.ts +14 -14
  172. package/lib/plugin/types.js +2 -2
  173. package/lib/publish/http_stream.d.ts +30 -30
  174. package/lib/publish/http_stream.js +111 -111
  175. package/lib/publish/index.d.ts +2 -2
  176. package/lib/publish/index.js +4 -4
  177. package/lib/publish/publish_plugin.d.ts +2 -2
  178. package/lib/publish/publish_plugin.js +47 -47
  179. package/lib/runtime/assemble_test_cases.d.ts +13 -13
  180. package/lib/runtime/assemble_test_cases.js +87 -87
  181. package/lib/runtime/attachment_manager/index.d.ts +33 -33
  182. package/lib/runtime/attachment_manager/index.js +118 -118
  183. package/lib/runtime/format_error.d.ts +2 -2
  184. package/lib/runtime/format_error.js +35 -35
  185. package/lib/runtime/helpers.d.ts +6 -6
  186. package/lib/runtime/helpers.js +100 -100
  187. package/lib/runtime/index.d.ts +40 -40
  188. package/lib/runtime/index.js +75 -75
  189. package/lib/runtime/parallel/command_types.d.ts +32 -32
  190. package/lib/runtime/parallel/command_types.js +2 -2
  191. package/lib/runtime/parallel/coordinator.d.ts +72 -72
  192. package/lib/runtime/parallel/coordinator.js +221 -221
  193. package/lib/runtime/parallel/run_worker.d.ts +1 -1
  194. package/lib/runtime/parallel/run_worker.js +28 -28
  195. package/lib/runtime/parallel/worker.d.ts +26 -26
  196. package/lib/runtime/parallel/worker.js +86 -86
  197. package/lib/runtime/run_test_run_hooks.d.ts +3 -3
  198. package/lib/runtime/run_test_run_hooks.js +27 -27
  199. package/lib/runtime/step_runner.d.ts +16 -16
  200. package/lib/runtime/step_runner.js +87 -87
  201. package/lib/runtime/stopwatch.d.ts +12 -12
  202. package/lib/runtime/stopwatch.js +33 -33
  203. package/lib/runtime/test_case_runner.d.ts +54 -54
  204. package/lib/runtime/test_case_runner.js +267 -267
  205. package/lib/step_arguments.d.ts +6 -6
  206. package/lib/step_arguments.js +18 -18
  207. package/lib/support_code_library_builder/build_parameter_type.d.ts +3 -3
  208. package/lib/support_code_library_builder/build_parameter_type.js +12 -12
  209. package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -3
  210. package/lib/support_code_library_builder/get_definition_line_and_uri.js +28 -28
  211. package/lib/support_code_library_builder/index.d.ts +74 -74
  212. package/lib/support_code_library_builder/index.js +296 -296
  213. package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -2
  214. package/lib/support_code_library_builder/parallel_can_assign_helpers.js +15 -15
  215. package/lib/support_code_library_builder/sourced_parameter_type_registry.d.ts +7 -7
  216. package/lib/support_code_library_builder/sourced_parameter_type_registry.js +18 -18
  217. package/lib/support_code_library_builder/types.d.ts +88 -88
  218. package/lib/support_code_library_builder/types.js +2 -2
  219. package/lib/support_code_library_builder/validate_arguments.d.ts +12 -12
  220. package/lib/support_code_library_builder/validate_arguments.js +72 -72
  221. package/lib/support_code_library_builder/world.d.ts +18 -18
  222. package/lib/support_code_library_builder/world.js +10 -10
  223. package/lib/time.d.ts +18 -18
  224. package/lib/time.js +60 -60
  225. package/lib/try_require.d.ts +7 -7
  226. package/lib/try_require.js +22 -22
  227. package/lib/types/index.d.ts +4 -4
  228. package/lib/types/index.js +2 -2
  229. package/lib/uncaught_exception_manager.d.ts +7 -7
  230. package/lib/uncaught_exception_manager.js +11 -11
  231. package/lib/user_code_runner.d.ts +14 -14
  232. package/lib/user_code_runner.js +81 -81
  233. package/lib/value_checker.d.ts +3 -3
  234. package/lib/value_checker.js +18 -18
  235. package/lib/version.d.ts +1 -1
  236. package/lib/version.js +5 -5
  237. package/lib/version.js.map +1 -1
  238. package/package.json +2 -2
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class ReportGenerator {
4
+ constructor() {
5
+ this.report = {
6
+ result: {
7
+ status: 'UNKNOWN',
8
+ },
9
+ testCaseMap: {},
10
+ };
11
+ this.gherkinDocumentMap = new Map();
12
+ this.pickleMap = new Map();
13
+ this.pickleStepMap = new Map();
14
+ this.testCaseMap = new Map();
15
+ this.testStepMap = new Map();
16
+ }
17
+ handleMessage(envelope) {
18
+ const type = Object.keys(envelope)[0];
19
+ switch (type) {
20
+ // case "meta": { break}
21
+ // case "source": { break}
22
+ case 'parseError': {
23
+ const parseError = envelope[type];
24
+ // console.log(parseError)
25
+ // TODO: handle parseError
26
+ break;
27
+ }
28
+ case 'gherkinDocument': {
29
+ const doc = envelope[type];
30
+ this.onGherkinDocument(doc);
31
+ break;
32
+ }
33
+ case 'pickle': {
34
+ const pickle = envelope[type];
35
+ this.onPickle(pickle);
36
+ break;
37
+ }
38
+ // case "stepDefinition": { break}
39
+ // case "hook": { break} // Before Hook
40
+ case 'testRunStarted': {
41
+ const testRunStarted = envelope[type];
42
+ this.onTestRunStarted(testRunStarted);
43
+ break;
44
+ }
45
+ case 'testCase': {
46
+ const testCase = envelope[type];
47
+ this.onTestCase(testCase);
48
+ break;
49
+ }
50
+ case 'testCaseStarted': {
51
+ const testCaseStarted = envelope[type];
52
+ this.onTestCaseStarted(testCaseStarted);
53
+ break;
54
+ }
55
+ case 'testStepStarted': {
56
+ const testStepStarted = envelope[type];
57
+ this.onTestStepStarted(testStepStarted);
58
+ break;
59
+ }
60
+ case 'attachment': {
61
+ const attachment = envelope[type];
62
+ this.onAttachment(attachment);
63
+ break;
64
+ }
65
+ case 'testStepFinished': {
66
+ const testStepFinished = envelope[type];
67
+ this.onTestStepFinished(testStepFinished);
68
+ break;
69
+ }
70
+ case 'testCaseFinished': {
71
+ const testCaseFinished = envelope[type];
72
+ this.onTestCaseFinished(testCaseFinished);
73
+ break;
74
+ }
75
+ // case "hook": { break} // After Hook
76
+ case 'testRunFinished': {
77
+ const testRunFinished = envelope[type];
78
+ this.onTestRunFinished(testRunFinished);
79
+ break;
80
+ }
81
+ // case "parameterType" : { break}
82
+ // case "undefinedParameterType": { break}
83
+ }
84
+ }
85
+ getReport() {
86
+ return this.report;
87
+ }
88
+ onGherkinDocument(doc) {
89
+ this.gherkinDocumentMap.set(doc.uri, doc);
90
+ }
91
+ onPickle(pickle) {
92
+ this.pickleMap.set(pickle.id, pickle);
93
+ pickle.steps.forEach((step) => {
94
+ this.pickleStepMap.set(step.id, step);
95
+ });
96
+ }
97
+ onTestRunStarted(testRunStarted) {
98
+ this.report.result = {
99
+ status: 'STARTED',
100
+ startTimestamp: testRunStarted.timestamp,
101
+ };
102
+ }
103
+ onTestCase(testCase) {
104
+ this.testCaseMap.set(testCase.id, testCase);
105
+ testCase.testSteps.forEach((testStep) => {
106
+ this.testStepMap.set(testStep.id, testStep);
107
+ });
108
+ }
109
+ onTestCaseStarted(testCaseStarted) {
110
+ const { testCaseId, id, timestamp } = testCaseStarted;
111
+ const testCase = this.testCaseMap.get(testCaseId);
112
+ if (testCase === undefined)
113
+ throw new Error(`testCase with id ${testCaseId} not found`);
114
+ const pickle = this.pickleMap.get(testCase.pickleId);
115
+ if (pickle === undefined)
116
+ throw new Error(`pickle with id ${testCase.pickleId} not found`);
117
+ const doc = this.gherkinDocumentMap.get(pickle.uri);
118
+ if (doc === undefined)
119
+ throw new Error(`gherkinDocument with uri ${pickle.uri} not found`);
120
+ const featureName = doc.feature.name;
121
+ const scenarioName = pickle.name;
122
+ const steps = pickle.steps.reduce((s, step) => {
123
+ s[step.id] = {
124
+ type: step.type,
125
+ text: step.text,
126
+ commands: [],
127
+ result: {
128
+ status: 'UNKNOWN',
129
+ },
130
+ };
131
+ return s;
132
+ }, {});
133
+ this.report.testCaseMap[id] = {
134
+ id,
135
+ uri: pickle.uri,
136
+ featureName,
137
+ scenarioName,
138
+ // TODO: compute parameters
139
+ parameters: {},
140
+ steps,
141
+ result: {
142
+ status: 'STARTED',
143
+ startTimestamp: timestamp,
144
+ },
145
+ };
146
+ }
147
+ onTestStepStarted(testStepStarted) {
148
+ const { testStepId, timestamp, testCaseStartedId } = testStepStarted;
149
+ const testStep = this.testStepMap.get(testStepId);
150
+ if (testStep === undefined)
151
+ throw new Error(`testStep with id ${testStepId} not found`);
152
+ if (testStep.pickleStepId === undefined)
153
+ return;
154
+ const pickleStep = this.pickleStepMap.get(testStep.pickleStepId);
155
+ const stepProgess = this.report.testCaseMap[testCaseStartedId].steps[pickleStep.id];
156
+ stepProgess.result = {
157
+ status: 'STARTED',
158
+ startTimestamp: timestamp,
159
+ };
160
+ this.report.testCaseMap[testCaseStartedId].steps[pickleStep.id] =
161
+ stepProgess;
162
+ }
163
+ onAttachment(attachment) {
164
+ const { testCaseStartedId, testStepId, body, mediaType, contentEncoding, fileName, source, url, } = attachment;
165
+ const testStep = this.testStepMap.get(testStepId);
166
+ const pickleStep = this.pickleStepMap.get(testStep.pickleStepId);
167
+ const stepProgess = this.report.testCaseMap[testCaseStartedId].steps[pickleStep.id];
168
+ if (mediaType === 'application/json') {
169
+ stepProgess.commands.push(JSON.parse(body));
170
+ }
171
+ }
172
+ onTestStepFinished(testStepFinished) {
173
+ const { testStepId, testCaseStartedId, testStepResult, timestamp } = testStepFinished;
174
+ const testStep = this.testStepMap.get(testStepId);
175
+ if (testStep.pickleStepId === undefined)
176
+ return;
177
+ const pickleStep = this.pickleStepMap.get(testStep.pickleStepId);
178
+ const stepProgess = this.report.testCaseMap[testCaseStartedId].steps[pickleStep.id];
179
+ const prevStepResult = stepProgess.result;
180
+ stepProgess.result = {
181
+ status: testStepResult.status,
182
+ startTimestamp: prevStepResult.startTimestamp,
183
+ endTimestamp: timestamp,
184
+ message: testStepResult.message,
185
+ exception: testStepResult.exception,
186
+ };
187
+ }
188
+ getTestCaseResult(steps) {
189
+ for (const step of steps) {
190
+ switch (step.result.status) {
191
+ case 'FAILED':
192
+ return {
193
+ status: step.result.status,
194
+ message: step.result.message,
195
+ exception: step.result.exception,
196
+ };
197
+ case 'AMBIGUOUS':
198
+ case 'UNDEFINED':
199
+ case 'PENDING':
200
+ return {
201
+ status: 'FAILED',
202
+ message: `step "${step.text}" is ${step.result.status}`,
203
+ };
204
+ }
205
+ }
206
+ return {
207
+ status: 'PASSED',
208
+ };
209
+ }
210
+ onTestCaseFinished(testCaseFinished) {
211
+ const { testCaseStartedId, timestamp } = testCaseFinished;
212
+ const testProgress = this.report.testCaseMap[testCaseStartedId];
213
+ const prevResult = testProgress.result;
214
+ const steps = Object.values(testProgress.steps);
215
+ const result = this.getTestCaseResult(steps);
216
+ testProgress.result = {
217
+ ...result,
218
+ startTimestamp: prevResult.startTimestamp,
219
+ endTimestamp: timestamp,
220
+ };
221
+ }
222
+ onTestRunFinished(testRunFinished) {
223
+ const { timestamp, success, exception, message } = testRunFinished;
224
+ const prevResult = this.report.result;
225
+ this.report.result = {
226
+ status: success ? 'PASSED' : 'FAILED',
227
+ startTimestamp: prevResult.startTimestamp,
228
+ endTimestamp: timestamp,
229
+ message,
230
+ exception,
231
+ };
232
+ }
233
+ }
234
+ exports.default = ReportGenerator;
235
+ //# sourceMappingURL=report_generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report_generator.js","sourceRoot":"","sources":["../../../src/formatter/helpers/report_generator.ts"],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Z,CAAC;IACO,kBAAkB,CAAC,gBAA2C;QACpE,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,gBAAgB,CAAA;QACzD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAA;QAC/D,MAAM,UAAU,GAAG,YAAY,CAAC,MAG/B,CAAA;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAC5C,YAAY,CAAC,MAAM,GAAG;YACpB,GAAG,MAAM;YACT,cAAc,EAAE,UAAU,CAAC,cAAc;YACzC,YAAY,EAAE,SAAS;SACxB,CAAA;IACH,CAAC;IACO,iBAAiB,CAAC,eAAyC;QACjE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,eAAe,CAAA;QAClE,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,MAG9B,CAAA;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG;YACnB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;YACrC,cAAc,EAAE,UAAU,CAAC,cAAc;YACzC,YAAY,EAAE,SAAS;YACvB,OAAO;YACP,SAAS;SACV,CAAA;IACH,CAAC;CACF;AA5PD,kCA4PC","sourcesContent":["import * as messages from '@cucumber/messages'\n\ntype JsonTimestamp = messages.Timestamp\ntype JsonException = messages.Exception\ntype JsonStepType = messages.PickleStepType\n\ntype JsonResultUnknown = {\n status: 'UNKNOWN'\n}\ntype JsonResultSkipped = {\n status: 'SKIPPED'\n}\ntype JsonResultUndefined = {\n status: 'UNDEFINED'\n}\ntype JsonResultAmbiguous = {\n status: 'AMBIGUOUS'\n}\ntype JsonResultStarted = {\n status: 'STARTED'\n startTimestamp: JsonTimestamp\n}\ntype JsonResultPending = {\n status: 'PENDING'\n startTimestamp: JsonTimestamp\n endTimestamp: JsonTimestamp\n}\ntype JsonResultPassed = {\n status: 'PASSED'\n startTimestamp: JsonTimestamp\n endTimestamp: JsonTimestamp\n}\ntype JsonResultFailed = {\n status: 'FAILED'\n startTimestamp: JsonTimestamp\n endTimestamp: JsonTimestamp\n message?: string\n exception?: JsonException\n}\n\ntype JsonCommandResult = JsonResultPassed | JsonResultFailed\ntype JsonStepResult =\n | JsonResultUnknown\n | JsonResultSkipped\n | JsonResultUndefined\n | JsonResultAmbiguous\n | JsonResultStarted\n | JsonResultPending\n | JsonResultPassed\n | JsonResultFailed\ntype JsonTestResult =\n | JsonResultUnknown\n | JsonResultStarted\n | JsonResultPassed\n | JsonResultFailed\ntype JsonReportResult = JsonTestResult\n\ntype JsonCommand = {\n type: string\n text: string\n screenShotId?: string\n reasoning?: string\n description: string\n value: string\n result: JsonCommandResult\n}\n\ntype JsonStep = {\n type: JsonStepType\n text: string\n commands: JsonCommand[]\n result: JsonStepResult\n}\n\ntype JsonTestProgress = {\n id: string\n featureName: string\n uri: string\n scenarioName: string\n parameters: Record<string, string>\n steps: Record<string, JsonStep>\n result: JsonTestResult\n}\n\ntype JsonReport = {\n testCaseMap: Record<string, JsonTestProgress>\n result: JsonReportResult\n}\n\nexport default class ReportGenerator {\n private report: JsonReport = {\n result: {\n status: 'UNKNOWN',\n },\n testCaseMap: {},\n }\n private gherkinDocumentMap = new Map<string, messages.GherkinDocument>()\n private pickleMap = new Map<string, messages.Pickle>()\n private pickleStepMap = new Map<string, messages.PickleStep>()\n private testCaseMap = new Map<string, messages.TestCase>()\n private testStepMap = new Map<string, messages.TestStep>()\n\n handleMessage(envelope: messages.Envelope) {\n const type = Object.keys(envelope)[0] as keyof messages.Envelope\n switch (type) {\n // case \"meta\": { break}\n // case \"source\": { break}\n case 'parseError': {\n const parseError = envelope[type]\n // console.log(parseError)\n // TODO: handle parseError\n break\n }\n case 'gherkinDocument': {\n const doc = envelope[type]\n this.onGherkinDocument(doc)\n break\n }\n case 'pickle': {\n const pickle = envelope[type]\n this.onPickle(pickle)\n break\n }\n // case \"stepDefinition\": { break}\n // case \"hook\": { break} // Before Hook\n case 'testRunStarted': {\n const testRunStarted = envelope[type]\n this.onTestRunStarted(testRunStarted)\n break\n }\n case 'testCase': {\n const testCase = envelope[type]\n this.onTestCase(testCase)\n break\n }\n case 'testCaseStarted': {\n const testCaseStarted = envelope[type]\n this.onTestCaseStarted(testCaseStarted)\n break\n }\n case 'testStepStarted': {\n const testStepStarted = envelope[type]\n this.onTestStepStarted(testStepStarted)\n break\n }\n case 'attachment': {\n const attachment = envelope[type]\n this.onAttachment(attachment)\n break\n }\n case 'testStepFinished': {\n const testStepFinished = envelope[type]\n this.onTestStepFinished(testStepFinished)\n break\n }\n case 'testCaseFinished': {\n const testCaseFinished = envelope[type]\n this.onTestCaseFinished(testCaseFinished)\n break\n }\n // case \"hook\": { break} // After Hook\n case 'testRunFinished': {\n const testRunFinished = envelope[type]\n this.onTestRunFinished(testRunFinished)\n break\n }\n // case \"parameterType\" : { break}\n // case \"undefinedParameterType\": { break}\n }\n }\n getReport() {\n return this.report\n }\n private onGherkinDocument(doc: messages.GherkinDocument) {\n this.gherkinDocumentMap.set(doc.uri, doc)\n }\n private onPickle(pickle: messages.Pickle) {\n this.pickleMap.set(pickle.id, pickle)\n pickle.steps.forEach((step) => {\n this.pickleStepMap.set(step.id, step)\n })\n }\n private onTestRunStarted(testRunStarted: messages.TestRunStarted) {\n this.report.result = {\n status: 'STARTED',\n startTimestamp: testRunStarted.timestamp,\n }\n }\n private onTestCase(testCase: messages.TestCase) {\n this.testCaseMap.set(testCase.id, testCase)\n testCase.testSteps.forEach((testStep) => {\n this.testStepMap.set(testStep.id, testStep)\n })\n }\n private onTestCaseStarted(testCaseStarted: messages.TestCaseStarted) {\n const { testCaseId, id, timestamp } = testCaseStarted\n const testCase = this.testCaseMap.get(testCaseId)\n if (testCase === undefined)\n throw new Error(`testCase with id ${testCaseId} not found`)\n const pickle = this.pickleMap.get(testCase.pickleId)\n if (pickle === undefined)\n throw new Error(`pickle with id ${testCase.pickleId} not found`)\n\n const doc = this.gherkinDocumentMap.get(pickle.uri)\n if (doc === undefined)\n throw new Error(`gherkinDocument with uri ${pickle.uri} not found`)\n const featureName = doc.feature.name\n\n const scenarioName = pickle.name\n const steps = pickle.steps.reduce((s, step) => {\n s[step.id] = {\n type: step.type,\n text: step.text,\n commands: [],\n result: {\n status: 'UNKNOWN',\n },\n }\n return s\n }, {} as JsonTestProgress['steps'])\n\n this.report.testCaseMap[id] = {\n id,\n uri: pickle.uri,\n featureName,\n scenarioName,\n // TODO: compute parameters\n parameters: {},\n steps,\n result: {\n status: 'STARTED',\n startTimestamp: timestamp,\n },\n }\n }\n private onTestStepStarted(testStepStarted: messages.TestStepStarted) {\n const { testStepId, timestamp, testCaseStartedId } = testStepStarted\n const testStep = this.testStepMap.get(testStepId)\n if (testStep === undefined)\n throw new Error(`testStep with id ${testStepId} not found`)\n if (testStep.pickleStepId === undefined) return\n const pickleStep = this.pickleStepMap.get(testStep.pickleStepId)\n const stepProgess =\n this.report.testCaseMap[testCaseStartedId].steps[pickleStep.id]\n stepProgess.result = {\n status: 'STARTED',\n startTimestamp: timestamp,\n }\n this.report.testCaseMap[testCaseStartedId].steps[pickleStep.id] =\n stepProgess\n }\n private onAttachment(attachment: messages.Attachment) {\n const {\n testCaseStartedId,\n testStepId,\n body,\n mediaType,\n contentEncoding,\n fileName,\n source,\n url,\n } = attachment\n const testStep = this.testStepMap.get(testStepId)\n const pickleStep = this.pickleStepMap.get(testStep.pickleStepId)\n const stepProgess =\n this.report.testCaseMap[testCaseStartedId].steps[pickleStep.id]\n if (mediaType === 'application/json') {\n stepProgess.commands.push(JSON.parse(body) as JsonCommand)\n }\n }\n private onTestStepFinished(testStepFinished: messages.TestStepFinished) {\n const { testStepId, testCaseStartedId, testStepResult, timestamp } =\n testStepFinished\n const testStep = this.testStepMap.get(testStepId)\n if (testStep.pickleStepId === undefined) return\n const pickleStep = this.pickleStepMap.get(testStep.pickleStepId)\n const stepProgess =\n this.report.testCaseMap[testCaseStartedId].steps[pickleStep.id]\n const prevStepResult = stepProgess.result as {\n status: 'STARTED'\n startTimestamp: JsonTimestamp\n }\n stepProgess.result = {\n status: testStepResult.status,\n startTimestamp: prevStepResult.startTimestamp,\n endTimestamp: timestamp,\n message: testStepResult.message,\n exception: testStepResult.exception,\n }\n }\n private getTestCaseResult(steps: JsonStep[]) {\n for (const step of steps) {\n switch (step.result.status) {\n case 'FAILED':\n return {\n status: step.result.status,\n message: step.result.message,\n exception: step.result.exception,\n } as const\n case 'AMBIGUOUS':\n case 'UNDEFINED':\n case 'PENDING':\n return {\n status: 'FAILED',\n message: `step \"${step.text}\" is ${step.result.status}`,\n } as const\n }\n }\n return {\n status: 'PASSED',\n } as const\n }\n private onTestCaseFinished(testCaseFinished: messages.TestCaseFinished) {\n const { testCaseStartedId, timestamp } = testCaseFinished\n const testProgress = this.report.testCaseMap[testCaseStartedId]\n const prevResult = testProgress.result as {\n status: 'STARTED'\n startTimestamp: JsonTimestamp\n }\n const steps = Object.values(testProgress.steps)\n const result = this.getTestCaseResult(steps)\n testProgress.result = {\n ...result,\n startTimestamp: prevResult.startTimestamp,\n endTimestamp: timestamp,\n }\n }\n private onTestRunFinished(testRunFinished: messages.TestRunFinished) {\n const { timestamp, success, exception, message } = testRunFinished\n const prevResult = this.report.result as {\n status: 'STARTED'\n startTimestamp: JsonTimestamp\n }\n this.report.result = {\n status: success ? 'PASSED' : 'FAILED',\n startTimestamp: prevResult.startTimestamp,\n endTimestamp: timestamp,\n message,\n exception,\n }\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- import * as messages from '@cucumber/messages';
2
- export declare function formatStepArgument(arg: messages.PickleStepArgument): string;
1
+ import * as messages from '@cucumber/messages';
2
+ export declare function formatStepArgument(arg: messages.PickleStepArgument): string;
@@ -1,48 +1,48 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formatStepArgument = void 0;
7
- const cli_table3_1 = __importDefault(require("cli-table3"));
8
- const step_arguments_1 = require("../../step_arguments");
9
- function formatDataTable(dataTable) {
10
- const table = new cli_table3_1.default({
11
- chars: {
12
- bottom: '',
13
- 'bottom-left': '',
14
- 'bottom-mid': '',
15
- 'bottom-right': '',
16
- left: '|',
17
- 'left-mid': '',
18
- mid: '',
19
- 'mid-mid': '',
20
- middle: '|',
21
- right: '|',
22
- 'right-mid': '',
23
- top: '',
24
- 'top-left': '',
25
- 'top-mid': '',
26
- 'top-right': '',
27
- },
28
- style: {
29
- border: [],
30
- 'padding-left': 1,
31
- 'padding-right': 1,
32
- },
33
- });
34
- const rows = dataTable.rows.map((row) => row.cells.map((cell) => cell.value.replace(/\\/g, '\\\\').replace(/\n/g, '\\n')));
35
- table.push(...rows);
36
- return table.toString();
37
- }
38
- function formatDocString(docString) {
39
- return `"""\n${docString.content}\n"""`;
40
- }
41
- function formatStepArgument(arg) {
42
- return (0, step_arguments_1.parseStepArgument)(arg, {
43
- dataTable: formatDataTable,
44
- docString: formatDocString,
45
- });
46
- }
47
- exports.formatStepArgument = formatStepArgument;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formatStepArgument = void 0;
7
+ const cli_table3_1 = __importDefault(require("cli-table3"));
8
+ const step_arguments_1 = require("../../step_arguments");
9
+ function formatDataTable(dataTable) {
10
+ const table = new cli_table3_1.default({
11
+ chars: {
12
+ bottom: '',
13
+ 'bottom-left': '',
14
+ 'bottom-mid': '',
15
+ 'bottom-right': '',
16
+ left: '|',
17
+ 'left-mid': '',
18
+ mid: '',
19
+ 'mid-mid': '',
20
+ middle: '|',
21
+ right: '|',
22
+ 'right-mid': '',
23
+ top: '',
24
+ 'top-left': '',
25
+ 'top-mid': '',
26
+ 'top-right': '',
27
+ },
28
+ style: {
29
+ border: [],
30
+ 'padding-left': 1,
31
+ 'padding-right': 1,
32
+ },
33
+ });
34
+ const rows = dataTable.rows.map((row) => row.cells.map((cell) => cell.value.replace(/\\/g, '\\\\').replace(/\n/g, '\\n')));
35
+ table.push(...rows);
36
+ return table.toString();
37
+ }
38
+ function formatDocString(docString) {
39
+ return `"""\n${docString.content}\n"""`;
40
+ }
41
+ function formatStepArgument(arg) {
42
+ return (0, step_arguments_1.parseStepArgument)(arg, {
43
+ dataTable: formatDataTable,
44
+ docString: formatDocString,
45
+ });
46
+ }
47
+ exports.formatStepArgument = formatStepArgument;
48
48
  //# sourceMappingURL=step_argument_formatter.js.map
@@ -1,9 +1,9 @@
1
- import { IColorFns } from '../get_color_fns';
2
- import { ITestCaseAttempt } from './event_data_collector';
3
- import * as messages from '@cucumber/messages';
4
- export interface IFormatSummaryRequest {
5
- colorFns: IColorFns;
6
- testCaseAttempts: ITestCaseAttempt[];
7
- testRunDuration: messages.Duration;
8
- }
9
- export declare function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }: IFormatSummaryRequest): string;
1
+ import { IColorFns } from '../get_color_fns';
2
+ import { ITestCaseAttempt } from './event_data_collector';
3
+ import * as messages from '@cucumber/messages';
4
+ export interface IFormatSummaryRequest {
5
+ colorFns: IColorFns;
6
+ testCaseAttempts: ITestCaseAttempt[];
7
+ testRunDuration: messages.Duration;
8
+ }
9
+ export declare function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }: IFormatSummaryRequest): string;
@@ -1,96 +1,96 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.formatSummary = void 0;
27
- const messages = __importStar(require("@cucumber/messages"));
28
- const value_checker_1 = require("../../value_checker");
29
- const luxon_1 = require("luxon");
30
- const STATUS_REPORT_ORDER = [
31
- messages.TestStepResultStatus.FAILED,
32
- messages.TestStepResultStatus.AMBIGUOUS,
33
- messages.TestStepResultStatus.UNDEFINED,
34
- messages.TestStepResultStatus.PENDING,
35
- messages.TestStepResultStatus.SKIPPED,
36
- messages.TestStepResultStatus.PASSED,
37
- ];
38
- function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
39
- const testCaseResults = [];
40
- const testStepResults = [];
41
- let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0);
42
- testCaseAttempts.forEach(({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {
43
- Object.values(stepResults).forEach((stepResult) => {
44
- totalStepDuration = messages.TimeConversion.addDurations(totalStepDuration, stepResult.duration);
45
- });
46
- if (!willBeRetried) {
47
- testCaseResults.push(worstTestStepResult);
48
- testCase.testSteps.forEach((testStep) => {
49
- if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
50
- testStepResults.push(stepResults[testStep.id]);
51
- }
52
- });
53
- }
54
- });
55
- const scenarioSummary = getCountSummary({
56
- colorFns,
57
- objects: testCaseResults,
58
- type: 'scenario',
59
- });
60
- const stepSummary = getCountSummary({
61
- colorFns,
62
- objects: testStepResults,
63
- type: 'step',
64
- });
65
- const durationSummary = `${getDurationSummary(testRunDuration)} (executing steps: ${getDurationSummary(totalStepDuration)})\n`;
66
- return [scenarioSummary, stepSummary, durationSummary].join('\n');
67
- }
68
- exports.formatSummary = formatSummary;
69
- function getCountSummary({ colorFns, objects, type, }) {
70
- const counts = {};
71
- STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0));
72
- objects.forEach((x) => (counts[x.status] += 1));
73
- const total = Object.values(counts).reduce((acc, x) => acc + x, 0);
74
- let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`;
75
- if (total > 0) {
76
- const details = [];
77
- STATUS_REPORT_ORDER.forEach((status) => {
78
- if (counts[status] > 0) {
79
- details.push(colorFns.forStatus(status)(`${counts[status].toString()} ${status.toLowerCase()}`));
80
- }
81
- });
82
- text += ` (${details.join(', ')})`;
83
- }
84
- return text;
85
- }
86
- function getDurationSummary(durationMsg) {
87
- const start = new Date(0);
88
- const end = new Date(messages.TimeConversion.durationToMilliseconds(durationMsg));
89
- const duration = luxon_1.Interval.fromDateTimes(start, end).toDuration([
90
- 'minutes',
91
- 'seconds',
92
- 'milliseconds',
93
- ]);
94
- return duration.toFormat("m'm'ss.SSS's'");
95
- }
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.formatSummary = void 0;
27
+ const messages = __importStar(require("@cucumber/messages"));
28
+ const value_checker_1 = require("../../value_checker");
29
+ const luxon_1 = require("luxon");
30
+ const STATUS_REPORT_ORDER = [
31
+ messages.TestStepResultStatus.FAILED,
32
+ messages.TestStepResultStatus.AMBIGUOUS,
33
+ messages.TestStepResultStatus.UNDEFINED,
34
+ messages.TestStepResultStatus.PENDING,
35
+ messages.TestStepResultStatus.SKIPPED,
36
+ messages.TestStepResultStatus.PASSED,
37
+ ];
38
+ function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
39
+ const testCaseResults = [];
40
+ const testStepResults = [];
41
+ let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0);
42
+ testCaseAttempts.forEach(({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {
43
+ Object.values(stepResults).forEach((stepResult) => {
44
+ totalStepDuration = messages.TimeConversion.addDurations(totalStepDuration, stepResult.duration);
45
+ });
46
+ if (!willBeRetried) {
47
+ testCaseResults.push(worstTestStepResult);
48
+ testCase.testSteps.forEach((testStep) => {
49
+ if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
50
+ testStepResults.push(stepResults[testStep.id]);
51
+ }
52
+ });
53
+ }
54
+ });
55
+ const scenarioSummary = getCountSummary({
56
+ colorFns,
57
+ objects: testCaseResults,
58
+ type: 'scenario',
59
+ });
60
+ const stepSummary = getCountSummary({
61
+ colorFns,
62
+ objects: testStepResults,
63
+ type: 'step',
64
+ });
65
+ const durationSummary = `${getDurationSummary(testRunDuration)} (executing steps: ${getDurationSummary(totalStepDuration)})\n`;
66
+ return [scenarioSummary, stepSummary, durationSummary].join('\n');
67
+ }
68
+ exports.formatSummary = formatSummary;
69
+ function getCountSummary({ colorFns, objects, type, }) {
70
+ const counts = {};
71
+ STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0));
72
+ objects.forEach((x) => (counts[x.status] += 1));
73
+ const total = Object.values(counts).reduce((acc, x) => acc + x, 0);
74
+ let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`;
75
+ if (total > 0) {
76
+ const details = [];
77
+ STATUS_REPORT_ORDER.forEach((status) => {
78
+ if (counts[status] > 0) {
79
+ details.push(colorFns.forStatus(status)(`${counts[status].toString()} ${status.toLowerCase()}`));
80
+ }
81
+ });
82
+ text += ` (${details.join(', ')})`;
83
+ }
84
+ return text;
85
+ }
86
+ function getDurationSummary(durationMsg) {
87
+ const start = new Date(0);
88
+ const end = new Date(messages.TimeConversion.durationToMilliseconds(durationMsg));
89
+ const duration = luxon_1.Interval.fromDateTimes(start, end).toDuration([
90
+ 'minutes',
91
+ 'seconds',
92
+ 'milliseconds',
93
+ ]);
94
+ return duration.toFormat("m'm'ss.SSS's'");
95
+ }
96
96
  //# sourceMappingURL=summary_helpers.js.map
@@ -1,12 +1,12 @@
1
- import { IColorFns } from '../get_color_fns';
2
- import { ITestCaseAttempt } from './event_data_collector';
3
- import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
4
- import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
5
- export interface IFormatTestCaseAttemptRequest {
6
- colorFns: IColorFns;
7
- testCaseAttempt: ITestCaseAttempt;
8
- snippetBuilder: StepDefinitionSnippetBuilder;
9
- supportCodeLibrary: ISupportCodeLibrary;
10
- printAttachments?: boolean;
11
- }
12
- export declare function formatTestCaseAttempt({ colorFns, snippetBuilder, supportCodeLibrary, testCaseAttempt, printAttachments, }: IFormatTestCaseAttemptRequest): string;
1
+ import { IColorFns } from '../get_color_fns';
2
+ import { ITestCaseAttempt } from './event_data_collector';
3
+ import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
4
+ import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
5
+ export interface IFormatTestCaseAttemptRequest {
6
+ colorFns: IColorFns;
7
+ testCaseAttempt: ITestCaseAttempt;
8
+ snippetBuilder: StepDefinitionSnippetBuilder;
9
+ supportCodeLibrary: ISupportCodeLibrary;
10
+ printAttachments?: boolean;
11
+ }
12
+ export declare function formatTestCaseAttempt({ colorFns, snippetBuilder, supportCodeLibrary, testCaseAttempt, printAttachments, }: IFormatTestCaseAttemptRequest): string;