Skip to content

Resolve relative CodeCoverage.ReportRoot to an absolute path - #2921

Merged
nohwnd merged 1 commit into
mainfrom
fix-2920-coverage-relative-paths
Jul 24, 2026
Merged

Resolve relative CodeCoverage.ReportRoot to an absolute path#2921
nohwnd merged 1 commit into
mainfrom
fix-2920-coverage-relative-paths

Conversation

@nohwnd

@nohwnd nohwnd commented Jul 23, 2026

Copy link
Copy Markdown
Member

Get-RelativePath makes the coverage report paths relative by stripping the report root prefix off the (absolute) file paths. When CodeCoverage.ReportRoot, or its Run.RepoRoot fallback, is a relative path the prefix never matches, so the report keeps the absolute paths.

Get-ReportRoot now resolves the path to absolute before it is used.

Added tests in Coverage.Tests.ps1, they fail without the fix.

Fix #2920

🤖

Get-RelativePath makes the coverage report paths relative by stripping the
report root prefix off the (absolute) file paths. When ReportRoot, or its
Run.RepoRoot fallback, is a relative path the prefix never matches, so the
report keeps the absolute paths.

Get-ReportRoot now resolves the path to absolute before it is used.

Fix #2920

🤖
@nohwnd nohwnd added this to the 6.1.0 milestone Jul 23, 2026
@nohwnd
nohwnd merged commit 6603552 into main Jul 24, 2026
13 checks passed
@nohwnd
nohwnd deleted the fix-2920-coverage-relative-paths branch July 24, 2026 07:00
@fflaten

fflaten commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks. But we need to resolve and validate these earlier as part of configuration validation. ReportRoot in Resolve-CodeCoverageConfiguration and RepoRoot somewhere similar (before Start plugin steps).

Current solution will break on location change during the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paths in Coverage report is not relative when relative path is provided

2 participants