fix(shards): zero-sized shard should not include all tests (#19148)
Fixes #19073.
This commit is contained in:
parent
b7a49fb371
commit
b1b21bdac5
|
|
@ -431,7 +431,15 @@ export class Runner {
|
|||
projectSetupGroups.length = 0;
|
||||
projectSetupGroups.push(...shardSetupGroups);
|
||||
|
||||
filterSuiteWithOnlySemantics(rootSuite, () => false, test => shardTests.has(test));
|
||||
if (!shardTests.size) {
|
||||
// Filtering with "only semantics" does not work when we have zero tests - it leaves all the tests.
|
||||
// We need an empty suite in this case.
|
||||
rootSuite._entries = [];
|
||||
rootSuite.suites = [];
|
||||
rootSuite.tests = [];
|
||||
} else {
|
||||
filterSuiteWithOnlySemantics(rootSuite, () => false, test => shardTests.has(test));
|
||||
}
|
||||
}
|
||||
|
||||
private async _run(options: RunOptions): Promise<FullResult> {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,15 @@ test('should respect shard=2/2', async ({ runInlineTest }) => {
|
|||
expect(result.output).toContain('test5-done');
|
||||
});
|
||||
|
||||
test('should not produce skipped tests for zero-sized shards', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest(tests, { shard: '10/10' });
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(0);
|
||||
expect(result.failed).toBe(0);
|
||||
expect(result.skipped).toBe(0);
|
||||
expect(result.output).not.toContain('-done');
|
||||
});
|
||||
|
||||
test('should respect shard=1/2 in config', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
...tests,
|
||||
|
|
|
|||
Loading…
Reference in a new issue