fix(reporter): expose setup/teardown projects to preprocessSuite#41731
fix(reporter): expose setup/teardown projects to preprocessSuite#41731Skn0tt wants to merge 6 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
Dropped the reverse() so setup/teardown projects keep the same order in the root suite as before, avoiding a spurious UI mode filter reorder.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| _fullProject: FullProjectInternal | undefined; | ||
| _fileId: string | undefined; | ||
| _preprocessing = false; | ||
| _isDependency = false; |
There was a problem hiding this comment.
Can we unify _isDependency and _preprocessing into a single enum? I'd like Suite to be as independent as possible from the environment around it.
| // Create test groups for top-level projects. | ||
| const testGroups: TestGroup[] = []; | ||
| for (const projectSuite of rootSuite.suites) { | ||
| if (projectSuite._isDependency) |
There was a problem hiding this comment.
Instead of relying on the flag we set on suites, let's make decisions based on the local variables in this method, e.g. projectClosure.get(project) === 'dependency'
|
|
||
| // Update project suites, removing empty ones. | ||
| suiteUtils.filterTestsRemoveEmptySuites(rootSuite, test => testsInThisShard.has(test)); | ||
| suiteUtils.filterTestsRemoveEmptySuites(rootSuite, test => test.parent._isInDependencyProject() || testsInThisShard.has(test)); |
There was a problem hiding this comment.
Same here, let's not rely on _isInDependencyProject().
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: af814592-e5ae-4edb-a8ef-dc73c2882097
Test results for "tests 1"8 flaky49541 passed, 1168 skipped Merge workflow run. |
Test results for "MCP"2 failed 7758 passed, 1249 skipped Merge workflow run. |
| if (type !== 'dependency') | ||
| continue; | ||
| const dependencySuite = buildProjectSuite(project, projectSuites.get(project)!); | ||
| dependencySuite._preprocessMode = 'readonly'; |
There was a problem hiding this comment.
- Make sure to reset this to
undefined. - I'd also mark top-level ones as
editablehere, and remove it fromInternalReporter.preprocessSuite. I think that makes for a better separation of concerns.
| const topLevelProjects = rootSuite.suites.filter(suite => !dependencyProjectIds.has(suite._fullProject!.id)).map(suite => suite._fullProject!); | ||
| const neededClosure = buildProjectsClosure(topLevelProjects); | ||
| for (const projectSuite of [...rootSuite.suites]) { | ||
| if (dependencyProjectIds.has(projectSuite._fullProject!.id) && !neededClosure.has(projectSuite._fullProject!)) |
There was a problem hiding this comment.
This seems technically incorrect. Imagine I run npx playwright test setup.spec main.spec and then tests from main.spec are filtered out. This code will remove the setup.spec as well, while the intent was to include it. I guess we should only drop the projects that were added to projectClosure, but were missing in filteredProjectSuites.
Copilot-Session: af814592-e5ae-4edb-a8ef-dc73c2882097
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: af814592-e5ae-4edb-a8ef-dc73c2882097
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: af814592-e5ae-4edb-a8ef-dc73c2882097
preprocessSuite()only exposed the top-level project suites, so a shard-balancing reporter couldn't measure the tests inside setup/teardown projects and weigh them.This moves the dependency projects into the root suite before
preprocessSuiteruns, so reporters can see them. They're read-only -skip()/fixme()/fail()/exclude()throw on a dependency test or suite, since these always run in full. Identify them viatestProject.dependenciesandtestProject.teardown.Sharding is unchanged: still splits only the top-level projects, keeps every dependency test.
Closes #41708