mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-01 08:34:02 +03:00
fix(runner): do not run beforeEach hooks upon skip modifier (#31426)
Fixes https://github.com/microsoft/playwright/issues/31425
This commit is contained in:
parent
f11ab2f145
commit
da441347e2
@ -570,6 +570,9 @@ export class WorkerMain extends ProcessRunner {
|
||||
if (error instanceof TimeoutManagerError)
|
||||
throw error;
|
||||
firstError = firstError ?? error;
|
||||
// Skip in modifier prevents others from running.
|
||||
if (error instanceof SkipError)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (firstError)
|
||||
|
@ -715,3 +715,25 @@ test('should contain only one slow modifier', async ({ runInlineTest }) => {
|
||||
expect(result.report.suites[1].specs[0].tests[0].annotations).toEqual([{ type: 'skip' }, { type: 'issue', description: 'my-value' }]);
|
||||
expect(result.report.suites[2].specs[0].tests[0].annotations).toEqual([{ type: 'slow' }, { type: 'issue', description: 'my-value' }]);
|
||||
});
|
||||
|
||||
test('should skip beforeEach hooks upon modifiers', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'a.test.ts': `
|
||||
import { test } from '@playwright/test';
|
||||
test('top', () => {});
|
||||
|
||||
test.describe(() => {
|
||||
test.skip(({ viewport }) => true);
|
||||
test.beforeEach(() => { throw new Error(); });
|
||||
|
||||
test.describe(() => {
|
||||
test.beforeEach(() => { throw new Error(); });
|
||||
test('test', () => {});
|
||||
});
|
||||
});
|
||||
`,
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(1);
|
||||
expect(result.skipped).toBe(1);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user