chore: apply only filtration to deps (#24268)
This commit is contained in:
parent
f6540f89ea
commit
5ff1fadd7b
|
|
@ -144,6 +144,18 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
|
|||
}
|
||||
}
|
||||
|
||||
if (shouldFilterOnly) {
|
||||
// Create a fake root to execute the exclusive semantics across the projects.
|
||||
const filteredRoot = new Suite('', 'root');
|
||||
for (const filteredProjectSuite of filteredProjectSuites.values())
|
||||
filteredRoot._addSuite(filteredProjectSuite);
|
||||
filterOnly(filteredRoot);
|
||||
for (const [project, filteredProjectSuite] of filteredProjectSuites) {
|
||||
if (!filteredRoot.suites.includes(filteredProjectSuite))
|
||||
filteredProjectSuites.delete(project);
|
||||
}
|
||||
}
|
||||
|
||||
// Add post-filtered top-level projects to the root suite for sharding and 'only' processing.
|
||||
const projectClosure = buildProjectsClosure([...filteredProjectSuites.keys()], project => filteredProjectSuites.get(project)!._hasTests());
|
||||
for (const [project, type] of projectClosure) {
|
||||
|
|
@ -162,10 +174,6 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
|
|||
}
|
||||
}
|
||||
|
||||
// Filter only for top-level projects.
|
||||
if (shouldFilterOnly)
|
||||
filterOnly(rootSuite);
|
||||
|
||||
// Shard only the top-level projects.
|
||||
if (config.config.shard) {
|
||||
// Create test groups for top-level projects.
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ test('should not filter dependency by file name', async ({ runInlineTest }) => {
|
|||
expect(result.output).toContain('1) [A] › one.spec.ts:3:11 › fails');
|
||||
});
|
||||
|
||||
test('should not filter dependency by only', async ({ runInlineTest }) => {
|
||||
test('should filter dependency by only', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'playwright.config.ts': `
|
||||
module.exports = { projects: [
|
||||
|
|
@ -235,7 +235,7 @@ test('should not filter dependency by only', async ({ runInlineTest }) => {
|
|||
`,
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.outputLines).toEqual(['setup in setup', 'setup 2 in setup', 'test in browser']);
|
||||
expect(result.outputLines).toEqual(['setup 2 in setup']);
|
||||
});
|
||||
|
||||
test('should filter dependency by only when running explicitly', async ({ runInlineTest }) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue