mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(test runner): do not print timeout message upon interrupt (#20574)
We should only print "Test was interrupted." Regressed in #18321.
This commit is contained in:
parent
8f229fac9e
commit
5fb430a743
@ -161,10 +161,12 @@ export class TestInfoImpl implements TestInfo {
|
||||
|
||||
async _runWithTimeout(cb: () => Promise<any>): Promise<void> {
|
||||
const timeoutError = await this._timeoutManager.runWithTimeout(cb);
|
||||
// Do not overwrite existing failure upon hook/teardown timeout.
|
||||
if (timeoutError && !this._didTimeout) {
|
||||
// When interrupting, we arrive here with a timeoutError, but we should not
|
||||
// consider it a timeout.
|
||||
if (this.status !== 'interrupted' && timeoutError && !this._didTimeout) {
|
||||
this._didTimeout = true;
|
||||
this.errors.push(timeoutError);
|
||||
// Do not overwrite existing failure upon hook/teardown timeout.
|
||||
if (this.status === 'passed' || this.status === 'skipped')
|
||||
this.status = 'timedOut';
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ test('sigint should stop workers', async ({ runInlineTest }) => {
|
||||
console.log('\\n%%skipped2');
|
||||
});
|
||||
`,
|
||||
}, { 'workers': 2 }, {}, { sendSIGINTAfter: 2 });
|
||||
}, { 'workers': 2, 'reporter': 'line,json' }, {}, { sendSIGINTAfter: 2 });
|
||||
expect(result.exitCode).toBe(130);
|
||||
expect(result.passed).toBe(0);
|
||||
expect(result.failed).toBe(0);
|
||||
@ -122,6 +122,8 @@ test('sigint should stop workers', async ({ runInlineTest }) => {
|
||||
expect(result.output).toContain('%%SEND-SIGINT%%2');
|
||||
expect(result.output).not.toContain('%%skipped1');
|
||||
expect(result.output).not.toContain('%%skipped2');
|
||||
expect(result.output).toContain('Test was interrupted.');
|
||||
expect(result.output).not.toContain('Test timeout of');
|
||||
|
||||
const interrupted2 = result.report.suites[1].specs[0];
|
||||
expect(interrupted2.title).toBe('interrupted2');
|
||||
|
Loading…
x
Reference in New Issue
Block a user