@testomatio/reporter 2.9.1-beta.3-allure-steps → 2.9.1-beta.4-allure-step-status

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.
@@ -94,6 +94,21 @@ declare class AllureReader {
94
94
  */
95
95
  normalizeTestId(value: string | number | null | undefined): string | null;
96
96
  convertSteps(steps: any, depth?: number): any;
97
+ /**
98
+ * Build the `error` payload for a failed step from its Allure `statusDetails`.
99
+ *
100
+ * Allure stores the failure message and stack trace (which includes the failing
101
+ * source line) in `statusDetails` on the step itself. We only surface it for
102
+ * failed/broken steps — passing or skipped steps carry no error. Returns null
103
+ * when there is no usable failure information so the field is omitted entirely.
104
+ *
105
+ * @param {object} step - Allure step
106
+ * @returns {{message: string, stack: string}|null}
107
+ */
108
+ extractStepError(step: object): {
109
+ message: string;
110
+ stack: string;
111
+ } | null;
97
112
  calculateRunTime(item: any): number;
98
113
  convertParameters(parameters: any): {};
99
114
  combineRetryAttempts(attempts: any): any;
@@ -386,6 +386,14 @@ class AllureReader {
386
386
  duration: this.calculateRunTime(step),
387
387
  steps: this.convertSteps(step.steps || [], depth + 1),
388
388
  };
389
+ // Attach the failure description (error message + trace with the failing
390
+ // code line) straight onto the failed step. Testomat.io renders a step's
391
+ // `error` inline in the step tree, so the failure shows up on the exact
392
+ // step that broke instead of only at the test level.
393
+ const error = this.extractStepError(step);
394
+ if (error) {
395
+ convertedStep.error = error;
396
+ }
389
397
  if (convertedStep.steps && convertedStep.steps.length === 0) {
390
398
  delete convertedStep.steps;
391
399
  }
@@ -396,6 +404,27 @@ class AllureReader {
396
404
  })
397
405
  .filter(Boolean);
398
406
  }
407
+ /**
408
+ * Build the `error` payload for a failed step from its Allure `statusDetails`.
409
+ *
410
+ * Allure stores the failure message and stack trace (which includes the failing
411
+ * source line) in `statusDetails` on the step itself. We only surface it for
412
+ * failed/broken steps — passing or skipped steps carry no error. Returns null
413
+ * when there is no usable failure information so the field is omitted entirely.
414
+ *
415
+ * @param {object} step - Allure step
416
+ * @returns {{message: string, stack: string}|null}
417
+ */
418
+ extractStepError(step) {
419
+ if (this.mapStepStatus(step.status) !== 'failed')
420
+ return null;
421
+ const details = step.statusDetails || {};
422
+ const message = details.message || '';
423
+ const stack = details.trace || '';
424
+ if (!message && !stack)
425
+ return null;
426
+ return { message, stack };
427
+ }
399
428
  calculateRunTime(item) {
400
429
  if (item.start && item.stop) {
401
430
  const durationMs = item.stop - item.start;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "2.9.1-beta.3-allure-steps",
3
+ "version": "2.9.1-beta.4-allure-step-status",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -441,6 +441,15 @@ class AllureReader {
441
441
  steps: this.convertSteps(step.steps || [], depth + 1),
442
442
  };
443
443
 
444
+ // Attach the failure description (error message + trace with the failing
445
+ // code line) straight onto the failed step. Testomat.io renders a step's
446
+ // `error` inline in the step tree, so the failure shows up on the exact
447
+ // step that broke instead of only at the test level.
448
+ const error = this.extractStepError(step);
449
+ if (error) {
450
+ convertedStep.error = error;
451
+ }
452
+
444
453
  if (convertedStep.steps && convertedStep.steps.length === 0) {
445
454
  delete convertedStep.steps;
446
455
  }
@@ -454,6 +463,29 @@ class AllureReader {
454
463
  .filter(Boolean);
455
464
  }
456
465
 
466
+ /**
467
+ * Build the `error` payload for a failed step from its Allure `statusDetails`.
468
+ *
469
+ * Allure stores the failure message and stack trace (which includes the failing
470
+ * source line) in `statusDetails` on the step itself. We only surface it for
471
+ * failed/broken steps — passing or skipped steps carry no error. Returns null
472
+ * when there is no usable failure information so the field is omitted entirely.
473
+ *
474
+ * @param {object} step - Allure step
475
+ * @returns {{message: string, stack: string}|null}
476
+ */
477
+ extractStepError(step) {
478
+ if (this.mapStepStatus(step.status) !== 'failed') return null;
479
+
480
+ const details = step.statusDetails || {};
481
+ const message = details.message || '';
482
+ const stack = details.trace || '';
483
+
484
+ if (!message && !stack) return null;
485
+
486
+ return { message, stack };
487
+ }
488
+
457
489
  calculateRunTime(item) {
458
490
  if (item.start && item.stop) {
459
491
  const durationMs = item.stop - item.start;