mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(deps): --repeat-each should not apply to dependencies (#22858)
Fixes #21778.
This commit is contained in:
parent
efad19b332
commit
03616e976e
@ -164,7 +164,9 @@ export class FullProjectInternal {
|
||||
grep: takeFirst(projectConfig.grep, config.grep, defaultGrep),
|
||||
grepInvert: takeFirst(projectConfig.grepInvert, config.grepInvert, null),
|
||||
outputDir: takeFirst(configCLIOverrides.outputDir, pathResolve(configDir, projectConfig.outputDir), pathResolve(configDir, config.outputDir), path.join(throwawayArtifactsPath, 'test-results')),
|
||||
repeatEach: takeFirst(configCLIOverrides.repeatEach, projectConfig.repeatEach, config.repeatEach, 1),
|
||||
// Note: we either apply the cli override for repeatEach or not, depending on whether the
|
||||
// project is top-level vs dependency. See collectProjectsAndTestFiles in loadUtils.
|
||||
repeatEach: takeFirst(projectConfig.repeatEach, config.repeatEach, 1),
|
||||
retries: takeFirst(configCLIOverrides.retries, projectConfig.retries, config.retries, 0),
|
||||
metadata: takeFirst(projectConfig.metadata, config.metadata, undefined),
|
||||
name: takeFirst(projectConfig.name, config.name, ''),
|
||||
|
||||
@ -73,6 +73,12 @@ export async function collectProjectsAndTestFiles(testRun: TestRun, additionalFi
|
||||
}
|
||||
}
|
||||
|
||||
// Apply overrides that are only applicable to top-level projects.
|
||||
for (const [project, type] of projectClosure) {
|
||||
if (type === 'top-level')
|
||||
project.project.repeatEach = project.fullConfig.configCLIOverrides.repeatEach ?? project.project.repeatEach;
|
||||
}
|
||||
|
||||
testRun.projects = [...filesToRunByProject.keys()];
|
||||
testRun.projectFiles = filesToRunByProject;
|
||||
testRun.projectType = projectClosure;
|
||||
|
||||
@ -559,3 +559,25 @@ test('should complain about teardown used multiple times', async ({ runInlineTes
|
||||
expect(result.exitCode).toBe(1);
|
||||
expect(result.output).toContain(`Project C can not be designated as teardown to multiple projects (A and B)`);
|
||||
});
|
||||
|
||||
test('should only apply --repeat-each to top-level', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'playwright.config.ts': `
|
||||
module.exports = {
|
||||
projects: [
|
||||
{ name: 'A' },
|
||||
{ name: 'B', dependencies: ['A'] },
|
||||
{ name: 'C', dependencies: ['A'] },
|
||||
],
|
||||
};`,
|
||||
'test.spec.ts': `
|
||||
import { test, expect } from '@playwright/test';
|
||||
test('test', async ({}, testInfo) => {
|
||||
console.log('\\n%%' + testInfo.project.name);
|
||||
});
|
||||
`,
|
||||
}, { 'workers': 1, 'repeat-each': 2 });
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.passed).toBe(5);
|
||||
expect(result.outputLines).toEqual(['A', 'B', 'B', 'C', 'C']);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user