diff --git a/packages/playwright-test/src/runner/dispatcher.ts b/packages/playwright-test/src/runner/dispatcher.ts index f11e45ada7..f8076c8b76 100644 --- a/packages/playwright-test/src/runner/dispatcher.ts +++ b/packages/playwright-test/src/runner/dispatcher.ts @@ -76,6 +76,9 @@ export class Dispatcher { } this._queue.shift(); } + + // If all remaining tests were skipped, resolve finished state. + this._checkFinished(); } private async _scheduleJob() { diff --git a/tests/playwright-test/shard.spec.ts b/tests/playwright-test/shard.spec.ts index 3fad2be4ed..d0b7d076f3 100644 --- a/tests/playwright-test/shard.spec.ts +++ b/tests/playwright-test/shard.spec.ts @@ -96,3 +96,26 @@ test('should respect shard=1/2 in config', async ({ runInlineTest }) => { expect(result.output).toContain('test2-done'); expect(result.output).toContain('test3-done'); }); + +test('should work with workers=1 and --fully-parallel', async ({ runInlineTest }) => { + test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21226' }); + const tests = { + 'a1.spec.ts': ` + import { test } from '@playwright/test'; + test('should pass', async ({ }) => { + }); + test.skip('should skip', async ({ }) => { + }); + `, + 'a2.spec.ts': ` + import { test } from '@playwright/test'; + test('shoul pass', async ({ }) => { + }); + `, + }; + + const result = await runInlineTest(tests, { shard: '1/2', ['fully-parallel']: true, workers: 1 }); + expect(result.exitCode).toBe(0); + expect(result.passed).toBe(1); + expect(result.skipped).toBe(1); +});