fix(test runner): mention fixture in worker teardown timeout error message (#15499)

This commit is contained in:
Dmitry Gozman 2022-07-08 11:44:37 -07:00 committed by GitHub
parent d5ba296147
commit 894ead5198
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -107,10 +107,11 @@ export class TimeoutManager {
let message = '';
const timeout = this._currentSlot().timeout;
switch (this._runnable.type) {
case 'test':
case 'test': {
const fixtureSuffix = this._fixture ? ` while ${this._fixture.title}` : '';
message = `Test timeout of ${timeout}ms exceeded${fixtureSuffix}.`;
break;
}
case 'afterEach':
case 'beforeEach':
message = `Test timeout of ${timeout}ms exceeded while running "${this._runnable.type}" hook.`;
@ -119,9 +120,11 @@ export class TimeoutManager {
case 'afterAll':
message = `"${this._runnable.type}" hook timeout of ${timeout}ms exceeded.`;
break;
case 'teardown':
message = `Worker teardown timeout of ${timeout}ms exceeded.`;
case 'teardown': {
const fixtureSuffix = this._fixture ? ` while ${this._fixture.title}` : '';
message = `Worker teardown timeout of ${timeout}ms exceeded${fixtureSuffix}.`;
break;
}
case 'skip':
case 'slow':
case 'fixme':

View file

@ -55,7 +55,7 @@ test('should handle worker fixture timeout', async ({ runInlineTest }) => {
`
}, { timeout: 500 });
expect(result.exitCode).toBe(1);
expect(result.output).toContain('Worker teardown timeout of 500ms exceeded.');
expect(result.output).toContain('Worker teardown timeout of 500ms exceeded while tearing down "timeout".');
});
test('should handle worker fixture error', async ({ runInlineTest }) => {
@ -529,7 +529,7 @@ test('should report worker fixture teardown with debug info', async ({ runInline
'a.spec.ts:12:9 good18',
'a.spec.ts:12:9 good19',
'',
'Worker teardown timeout of 1000ms exceeded.',
'Worker teardown timeout of 1000ms exceeded while tearing down "fixture".',
].join('\n'));
});