Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(merge): update error.cause location (#33583)
Dmitry Gozman9f59dbdc57ea
diff --git a/packages/playwright/src/reporters/merge.ts b/packages/playwright/src/reporters/merge.tsindex 5eedcac136..102335cceb 100644--- a/packages/playwright/src/reporters/merge.ts+++ b/packages/playwright/src/reporters/merge.ts@@ -18,7 +18,7 @@ import fs from 'fs';import path from 'path';import type { ReporterDescription } from '../../types/test';import type { FullConfigInternal } from '../common/config';-import type { JsonConfig, JsonEvent, JsonFullResult, JsonLocation, JsonProject, JsonSuite, JsonTestCase, JsonTestResultEnd, JsonTestStepStart } from '../isomorphic/teleReceiver';+import type { JsonConfig, JsonEvent, JsonFullResult, JsonLocation, JsonProject, JsonSuite, JsonTestCase, JsonTestResultEnd, JsonTestStepStart, JsonTestStepEnd } from '../isomorphic/teleReceiver';import { TeleReporterReceiver } from '../isomorphic/teleReceiver';import { JsonStringInternalizer, StringInternPool } from '../isomorphic/stringInternPool';import { createReporters } from '../runner/reporters';@@ -471,7 +471,7 @@ class PathSeparatorPatcher {}if (jsonEvent.method === 'onTestEnd') {const testResult = jsonEvent.params.result as JsonTestResultEnd;- testResult.errors.forEach(error => this._updateLocation(error.location));+ testResult.errors.forEach(error => this._updateErrorLocations(error));testResult.attachments.forEach(attachment => {if (attachment.path)attachment.path = this._updatePath(attachment.path);@@ -483,6 +483,11 @@ class PathSeparatorPatcher {this._updateLocation(step.location);return;}+ if (jsonEvent.method === 'onStepEnd') {+ const step = jsonEvent.params.step as JsonTestStepEnd;+ this._updateErrorLocations(step.error);+ return;+ }}private _updateProject(project: JsonProject) {@@ -504,6 +509,13 @@ class PathSeparatorPatcher {}}+ private _updateErrorLocations(error: TestError | undefined) {+ while (error) {+ this._updateLocation(error.location);+ error = error.cause;+ }+ }+private _updateLocation(location?: JsonLocation) {if (location)location.file = this._updatePath(location.file);