@testomatio/reporter 1.4.7 → 1.4.9

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 (2) hide show
  1. package/lib/client.js +22 -1
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -276,9 +276,12 @@ class Client {
276
276
  */
277
277
  formatLogs({ error, steps, logs }) {
278
278
  error = error?.trim();
279
- steps = typeof steps === 'string' ? steps?.trim() : steps;
280
279
  logs = logs?.trim();
281
280
 
281
+ if (Array.isArray(steps)) {
282
+ steps = steps.map(step => formatStep(step)).flat().join('\n');
283
+ }
284
+
282
285
  let testLogs = '';
283
286
  if (steps) testLogs += `${chalk.bold.blue('################[ Steps ]################')}\n${steps}\n\n`;
284
287
  if (logs) testLogs += `${chalk.bold.gray('################[ Logs ]################')}\n${logs}\n\n`;
@@ -342,6 +345,24 @@ function isNotInternalFrame(frame) {
342
345
  );
343
346
  }
344
347
 
348
+ function formatStep(step, shift = 0) {
349
+ const prefix = ' '.repeat(shift);
350
+
351
+ const lines = [];
352
+
353
+ if (step.error) {
354
+ lines.push(`${prefix}${chalk.red(step.title)} ${chalk.gray(`${step.duration}ms`)}`);
355
+ } else {
356
+ lines.push(`${prefix}${step.title} ${chalk.gray(`${step.duration}ms`)}`);
357
+ }
358
+
359
+ for (const child of step.steps || []) {
360
+ lines.push(...formatStep(child, shift + 2));
361
+ }
362
+
363
+ return lines;
364
+ }
365
+
345
366
  /**
346
367
  *
347
368
  * @param {TestData} testData
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",