fix(merge): update error.cause location (#33583)
This commit is contained in:
parent
dc93c8a05b
commit
9f59dbdc57
|
|
@ -18,7 +18,7 @@ import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import type { ReporterDescription } from '../../types/test';
|
import type { ReporterDescription } from '../../types/test';
|
||||||
import type { FullConfigInternal } from '../common/config';
|
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 { TeleReporterReceiver } from '../isomorphic/teleReceiver';
|
||||||
import { JsonStringInternalizer, StringInternPool } from '../isomorphic/stringInternPool';
|
import { JsonStringInternalizer, StringInternPool } from '../isomorphic/stringInternPool';
|
||||||
import { createReporters } from '../runner/reporters';
|
import { createReporters } from '../runner/reporters';
|
||||||
|
|
@ -471,7 +471,7 @@ class PathSeparatorPatcher {
|
||||||
}
|
}
|
||||||
if (jsonEvent.method === 'onTestEnd') {
|
if (jsonEvent.method === 'onTestEnd') {
|
||||||
const testResult = jsonEvent.params.result as JsonTestResultEnd;
|
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 => {
|
testResult.attachments.forEach(attachment => {
|
||||||
if (attachment.path)
|
if (attachment.path)
|
||||||
attachment.path = this._updatePath(attachment.path);
|
attachment.path = this._updatePath(attachment.path);
|
||||||
|
|
@ -483,6 +483,11 @@ class PathSeparatorPatcher {
|
||||||
this._updateLocation(step.location);
|
this._updateLocation(step.location);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (jsonEvent.method === 'onStepEnd') {
|
||||||
|
const step = jsonEvent.params.step as JsonTestStepEnd;
|
||||||
|
this._updateErrorLocations(step.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateProject(project: JsonProject) {
|
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) {
|
private _updateLocation(location?: JsonLocation) {
|
||||||
if (location)
|
if (location)
|
||||||
location.file = this._updatePath(location.file);
|
location.file = this._updatePath(location.file);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue