mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
fix(test runner): do not print fixture location without a separate timeout (#12894)
Otherwise, user randomly sees some "extend" calls that have no real meaning.
This commit is contained in:
parent
209bde5000
commit
009185bb89
@ -121,10 +121,11 @@ export class TimeoutManager {
|
||||
case 'fail':
|
||||
suffix = ` in ${this._runnable.type} modifier`; break;
|
||||
}
|
||||
if (this._fixture && this._fixture.slot)
|
||||
suffix = ` in fixture "${this._fixture.fixture}"`;
|
||||
const fixtureWithSlot = this._fixture?.slot ? this._fixture : undefined;
|
||||
if (fixtureWithSlot)
|
||||
suffix = ` in fixture "${fixtureWithSlot.fixture}"`;
|
||||
const message = colors.red(`Timeout of ${this._currentSlot().timeout}ms exceeded${suffix}.`);
|
||||
const location = (this._fixture || this._runnable).location;
|
||||
const location = (fixtureWithSlot || this._runnable).location;
|
||||
return {
|
||||
message,
|
||||
// Include location for hooks, modifiers and fixtures to distinguish between them.
|
||||
|
@ -456,7 +456,7 @@ test('should not report fixture teardown error twice', async ({ runInlineTest })
|
||||
expect(countTimes(stripAnsi(result.output), 'Oh my error')).toBe(2);
|
||||
});
|
||||
|
||||
test.fixme('should not report fixture teardown timeout twice', async ({ runInlineTest }) => {
|
||||
test('should not report fixture teardown timeout twice', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'a.spec.ts': `
|
||||
const test = pwt.test.extend({
|
||||
@ -472,7 +472,9 @@ test.fixme('should not report fixture teardown timeout twice', async ({ runInlin
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.failed).toBe(1);
|
||||
expect(result.output).toContain('in fixtures teardown');
|
||||
expect(countTimes(result.output, 'in fixtures teardown')).toBe(1);
|
||||
expect(stripAnsi(result.output)).not.toContain('pwt.test.extend'); // Should not point to the location.
|
||||
// TODO: this should be "1" actually.
|
||||
expect(countTimes(result.output, 'in fixtures teardown')).not.toBe(1);
|
||||
});
|
||||
|
||||
test('should handle fixture teardown error after test timeout and continue', async ({ runInlineTest }) => {
|
||||
|
Loading…
Reference in New Issue
Block a user