Skip to content

Commit

Permalink
cherry-pick(#21238): fix(runner): finish dispatching if remaining tes… (
Browse files Browse the repository at this point in the history
#21239)

…ts were skipped

Fixes #21226
  • Loading branch information
yury-s authored Feb 28, 2023
1 parent 4b3932d commit db82ae0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/playwright-test/src/runner/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export class Dispatcher {
}
this._queue.shift();
}

// If all remaining tests were skipped, resolve finished state.
this._checkFinished();
}

private async _scheduleJob() {
Expand Down
23 changes: 23 additions & 0 deletions tests/playwright-test/shard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

0 comments on commit db82ae0

Please sign in to comment.