fix(jest): scope coverage output per-project in multi-project workspaces (fixes #1009)#2212
Open
just-jeb wants to merge 2 commits into
Open
fix(jest): scope coverage output per-project in multi-project workspaces (fixes #1009)#2212just-jeb wants to merge 2 commits into
just-jeb wants to merge 2 commits into
Conversation
ad58dab to
58300b9
Compare
…isions (#1009) When running ng test in a multi-project Angular workspace, each project's coverage output was written to the same directory (e.g. root ./coverage/), causing each successive run to overwrite the previous project's coverage report. Fix: set coverageDirectory in DefaultConfigResolver.resolveForProject() to <projectRoot>/coverage so each Angular project's coverage lands in its own isolated output directory. This is a project-level default that can still be overridden per-project via the jest.config.js customization mechanism. Also removes erroneous debug console.log statements from jest-configuration-builder.ts and fixes the scopeOutputDirectoriesForProjects approach, which incorrectly mutated the Jest 'projects' array (breaking --find-related-tests and project path resolution). Adds: unit test for coverageDirectory scoping, integration test validate-coverage.js
5c22c9b to
e560a92
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1009 — Coverage output files were being overwritten in multi-project workspaces because all projects wrote to the same coverage directory.
Root Cause
The Jest builder was not scoping the
coverageDirectoryper project. When multiple projects ran in sequence, each project would write coverage to the same directory, causing overwriting.Solution
When
config.projectsexists and is an array (multi-project workspace), the builder now:coverageDirectoryto${originalCoverageDir}/${projectName}This generalizes to all project-scoped Jest output (not just coverage), as intended.
Testing