@stanterprise/playwright-reporter 0.0.16 → 0.0.17
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.
|
@@ -12,6 +12,24 @@ function handleOnStepEndEvent(test, result, step, runId, client, options) {
|
|
|
12
12
|
// Build metadata from step annotations
|
|
13
13
|
const metadata = (0, utils_1.buildStepMetadata)(step);
|
|
14
14
|
const stepId = (0, utils_2.generateStepId)(step, test);
|
|
15
|
+
// Extract comprehensive error details if present
|
|
16
|
+
const errorMessage = step.error?.message || "";
|
|
17
|
+
const errorStack = step.error?.stack || "";
|
|
18
|
+
const errorValue = step.error?.value || "";
|
|
19
|
+
const errorSnippet = step.error?.snippet || "";
|
|
20
|
+
const errorLocation = step.error?.location
|
|
21
|
+
? `${step.error.location.file}:${step.error.location.line}:${step.error.location.column}`
|
|
22
|
+
: "";
|
|
23
|
+
// Combine all error information into metadata for comprehensive error tracking
|
|
24
|
+
const errorMetadata = {};
|
|
25
|
+
if (errorStack)
|
|
26
|
+
errorMetadata.error_stack = (0, utils_1.truncateValue)(errorStack);
|
|
27
|
+
if (errorValue)
|
|
28
|
+
errorMetadata.error_value = (0, utils_1.truncateValue)(errorValue);
|
|
29
|
+
if (errorSnippet)
|
|
30
|
+
errorMetadata.error_snippet = (0, utils_1.truncateValue)(errorSnippet);
|
|
31
|
+
if (errorLocation)
|
|
32
|
+
errorMetadata.error_location = (0, utils_1.truncateValue)(errorLocation);
|
|
15
33
|
// Build and send the StepEnd event
|
|
16
34
|
const request = new events_1.StepEndEventRequest({
|
|
17
35
|
step: new entities_1.StepRun({
|
|
@@ -23,12 +41,12 @@ function handleOnStepEndEvent(test, result, step, runId, client, options) {
|
|
|
23
41
|
start_time: (0, utils_1.createTimestamp)(step.startTime),
|
|
24
42
|
duration: (0, utils_1.createDuration)(step.duration),
|
|
25
43
|
status: stepStatus,
|
|
26
|
-
error:
|
|
27
|
-
errors:
|
|
44
|
+
error: errorMessage,
|
|
45
|
+
errors: errorMessage ? [errorMessage] : [],
|
|
28
46
|
location: step.location
|
|
29
47
|
? `${step.location.file}:${step.location.line}:${step.location.column}`
|
|
30
48
|
: "",
|
|
31
|
-
metadata: (0, utils_1.toMetadataMap)(metadata),
|
|
49
|
+
metadata: (0, utils_1.toMetadataMap)({ ...metadata, ...errorMetadata }),
|
|
32
50
|
parent_step_id: step.parent
|
|
33
51
|
? (0, utils_2.generateStepId)(step.parent, test)
|
|
34
52
|
: undefined,
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
* Utility functions for building metadata objects
|
|
3
3
|
*/
|
|
4
4
|
import type { TestCase, TestResult, TestStep } from "@playwright/test/reporter";
|
|
5
|
+
/**
|
|
6
|
+
* Truncate a string to a maximum length with ellipsis indicator
|
|
7
|
+
* @param value String value to truncate
|
|
8
|
+
* @param maxLength Maximum length (default 100KB)
|
|
9
|
+
* @returns Truncated string with warning suffix if truncated
|
|
10
|
+
*/
|
|
11
|
+
export declare function truncateValue(value: string, maxLength?: number): string;
|
|
5
12
|
/**
|
|
6
13
|
* Build metadata from annotations array
|
|
7
14
|
* @param annotations Array of annotations with type and optional description
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truncateValue = truncateValue;
|
|
3
4
|
exports.buildAnnotationsMetadata = buildAnnotationsMetadata;
|
|
4
5
|
exports.buildTestMetadata = buildTestMetadata;
|
|
5
6
|
exports.buildStepMetadata = buildStepMetadata;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stanterprise/playwright-reporter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Custom Playwright test reporter that sends test results to Stanterprise via gRPC",
|
|
5
5
|
"homepage": "https://github.com/stanterprise/stanterprise-playwright-reporter#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@playwright/test": "^1.52.0",
|
|
46
46
|
"@types/jest": "^29.5.14",
|
|
47
|
-
"@types/node": "^22.
|
|
47
|
+
"@types/node": "^22.19.7",
|
|
48
48
|
"jest": "^29.7.0",
|
|
49
49
|
"ts-jest": "^29.4.5",
|
|
50
50
|
"typescript": "^5.9.3"
|