fix(runner): do not restart worker after skipping tests (#7511)
This commit is contained in:
parent
e4698b5f6a
commit
b2742976a8
|
|
@ -338,7 +338,7 @@ export class WorkerRunner extends EventEmitter {
|
||||||
if (!preserveOutput)
|
if (!preserveOutput)
|
||||||
await removeFolderAsync(testInfo.outputDir).catch(e => {});
|
await removeFolderAsync(testInfo.outputDir).catch(e => {});
|
||||||
|
|
||||||
if (testInfo.status !== 'passed') {
|
if (testInfo.status !== 'passed' && testInfo.status !== 'skipped') {
|
||||||
this._failedTestId = testId;
|
this._failedTestId = testId;
|
||||||
this._reportDoneAndStop();
|
this._reportDoneAndStop();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,52 @@ test('should reuse worker for multiple tests', async ({ runInlineTest }) => {
|
||||||
expect(result.exitCode).toBe(0);
|
expect(result.exitCode).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should reuse worker after test.fixme()', async ({ runInlineTest }) => {
|
||||||
|
const result = await runInlineTest({
|
||||||
|
'a.test.js': `
|
||||||
|
const { test } = pwt;
|
||||||
|
test('succeeds 1', async ({}, testInfo) => {
|
||||||
|
expect(testInfo.workerIndex).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('fixme 1', async ({}, testInfo) => {
|
||||||
|
test.fixme();
|
||||||
|
expect(testInfo.workerIndex).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('succeeds 2', async ({}, testInfo) => {
|
||||||
|
expect(testInfo.workerIndex).toBe(0);
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
expect(result.passed).toBe(2);
|
||||||
|
expect(result.skipped).toBe(1);
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should reuse worker after test.skip()', async ({ runInlineTest }) => {
|
||||||
|
const result = await runInlineTest({
|
||||||
|
'a.test.js': `
|
||||||
|
const { test } = pwt;
|
||||||
|
test('succeeds 1', async ({}, testInfo) => {
|
||||||
|
expect(testInfo.workerIndex).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('skip 1', async ({}, testInfo) => {
|
||||||
|
test.skip();
|
||||||
|
expect(testInfo.workerIndex).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('succeeds 2', async ({}, testInfo) => {
|
||||||
|
expect(testInfo.workerIndex).toBe(0);
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
expect(result.passed).toBe(2);
|
||||||
|
expect(result.skipped).toBe(1);
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
test('should not reuse worker for different suites', async ({ runInlineTest }) => {
|
test('should not reuse worker for different suites', async ({ runInlineTest }) => {
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'playwright.config.ts': `
|
'playwright.config.ts': `
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue