feat: add logic for capturing and abandoning trace when using on-first-failure mode
This commit is contained in:
parent
d9bf7e4cdf
commit
b5ebdfc04b
|
|
@ -54,6 +54,7 @@ export class TestTracing {
|
|||
if (this._options?.mode === 'retain-on-failure') capture = true;
|
||||
if (this._options?.mode === 'on-first-retry' && this._testInfo.retry === 1) capture = true;
|
||||
if (this._options?.mode === 'on-all-retries' && this._testInfo.retry > 0) capture = true;
|
||||
if (this._options?.mode === 'on-first-failure' && this._testInfo.retry === 0) capture = true;
|
||||
|
||||
return capture && !process.env.PW_TEST_DISABLE_TRACING;
|
||||
}
|
||||
|
|
@ -119,7 +120,8 @@ export class TestTracing {
|
|||
return;
|
||||
|
||||
const testFailed = this._testInfo.status !== this._testInfo.expectedStatus;
|
||||
const shouldAbandonTrace = !testFailed && this._options.mode === 'retain-on-failure';
|
||||
const shouldAbandonTrace = !testFailed && (this._options.mode === 'retain-on-failure' || this._options.mode === 'on-first-failure');
|
||||
|
||||
if (shouldAbandonTrace) {
|
||||
for (const file of this._temporaryTraceFiles)
|
||||
await fs.promises.unlink(file).catch(() => {});
|
||||
|
|
|
|||
Loading…
Reference in a new issue