fix(test runner): show fixture name when worker times out (#15724)
This commit is contained in:
parent
582b5e08b2
commit
a56d801352
|
|
@ -128,11 +128,25 @@ class Fixture {
|
||||||
}
|
}
|
||||||
|
|
||||||
async teardown(timeoutManager: TimeoutManager) {
|
async teardown(timeoutManager: TimeoutManager) {
|
||||||
if (!this._teardownWithDepsComplete)
|
if (this._teardownWithDepsComplete) {
|
||||||
|
// When we are waiting for the teardown for the second time,
|
||||||
|
// most likely after the first time did timeout, annotate current fixture
|
||||||
|
// for better error messages.
|
||||||
|
this._setTeardownDescription(timeoutManager);
|
||||||
|
await this._teardownWithDepsComplete;
|
||||||
|
timeoutManager.setCurrentFixture(undefined);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this._teardownWithDepsComplete = this._teardownInternal(timeoutManager);
|
this._teardownWithDepsComplete = this._teardownInternal(timeoutManager);
|
||||||
await this._teardownWithDepsComplete;
|
await this._teardownWithDepsComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _setTeardownDescription(timeoutManager: TimeoutManager) {
|
||||||
|
const title = this.registration.customTitle || this.registration.name;
|
||||||
|
this._runnableDescription.title = this.registration.timeout !== undefined ? `Fixture "${title}"` : `tearing down "${title}"`;
|
||||||
|
timeoutManager.setCurrentFixture(this._runnableDescription);
|
||||||
|
}
|
||||||
|
|
||||||
private async _teardownInternal(timeoutManager: TimeoutManager) {
|
private async _teardownInternal(timeoutManager: TimeoutManager) {
|
||||||
if (typeof this.registration.fn !== 'function')
|
if (typeof this.registration.fn !== 'function')
|
||||||
return;
|
return;
|
||||||
|
|
@ -146,9 +160,7 @@ class Fixture {
|
||||||
}
|
}
|
||||||
if (this._useFuncFinished) {
|
if (this._useFuncFinished) {
|
||||||
debugTest(`teardown ${this.registration.name}`);
|
debugTest(`teardown ${this.registration.name}`);
|
||||||
const title = this.registration.customTitle || this.registration.name;
|
this._setTeardownDescription(timeoutManager);
|
||||||
this._runnableDescription.title = this.registration.timeout !== undefined ? `Fixture "${title}"` : `tearing down "${title}"`;
|
|
||||||
timeoutManager.setCurrentFixture(this._runnableDescription);
|
|
||||||
this._useFuncFinished.resolve();
|
this._useFuncFinished.resolve();
|
||||||
await this._selfTeardownComplete;
|
await this._selfTeardownComplete;
|
||||||
timeoutManager.setCurrentFixture(undefined);
|
timeoutManager.setCurrentFixture(undefined);
|
||||||
|
|
|
||||||
|
|
@ -474,7 +474,7 @@ test('should not report fixture teardown timeout twice', async ({ runInlineTest
|
||||||
expect(result.output).toContain('Test timeout of 1000ms exceeded while tearing down "fixture".');
|
expect(result.output).toContain('Test timeout of 1000ms exceeded while tearing down "fixture".');
|
||||||
expect(stripAnsi(result.output)).not.toContain('pwt.test.extend'); // Should not point to the location.
|
expect(stripAnsi(result.output)).not.toContain('pwt.test.extend'); // Should not point to the location.
|
||||||
// TODO: this should be "not.toContain" actually.
|
// TODO: this should be "not.toContain" actually.
|
||||||
expect(result.output).toContain('Worker teardown timeout of 1000ms exceeded.');
|
expect(result.output).toContain('Worker teardown timeout of 1000ms exceeded while tearing down "fixture".');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should handle fixture teardown error after test timeout and continue', async ({ runInlineTest }) => {
|
test('should handle fixture teardown error after test timeout and continue', async ({ runInlineTest }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue