coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

[BUG] coverlet does not support multiple report formats using CoverletOutput parameter

Open Bertk opened this issue 1 year ago • 5 comments

Describe the bug coverlet.msbuild.tasks overrides code coverage result file using file name of given CoverletOutput parameter.

To Reproduce

execute command: dotnet test test\coverlet.core.tests\coverlet.core.tests.csproj --configuration debug /p:CollectCoverage=true /p:CoverletOutputFormat="json%2copencover" /p:CoverletOutput="C:\GitHub\coverlet\artifacts\Reports\coverlet.core\coverage.json" /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.xunit.extensions]*%2c[coverlet.tests.projectsample]*%2c[testgen_]*" --results-directory:"C:\GitHub\coverlet\artifacts\Reports\coverlet.core" --diag:"C:\GitHub\coverlet\artifacts\log\debug\coverlet.core.test.diag.log;tracelevel=diag"

Expected behavior 2 code coverage result files are available (formats: json, opencover)

Actual behavior Only one code coverage result file is available. image

Configuration (please complete the following information): Please provide more information on your .NET configuration: * Which coverlet package and version was used? 6.0.1-preview.39.g9321d2e2cc * Which version of .NET is the code running on? net8.0 * What OS and version, and what distro if applicable? windows 11 * What is the architecture (x64, x86, ARM, ARM64)? x64

Additional context none

Bertk avatar Feb 07 '24 09:02 Bertk

fix CoverletOutput folder location #1601

Bertk avatar Feb 07 '24 12:02 Bertk

Filename for multiple report formats is currently not supported. CoverletOutput parameter without file shall be used instead e.g. /p:CoverletOutput="C:/GitHub/coverlet/artifacts/Reports/coverlet.core/"

image

Bertk avatar Feb 07 '24 12:02 Bertk

I've seen that we have the same issue for coverlet.console. The idea to just use the output directory in those cases sounds good to me. We can also create a new issue for this.

grafik

daveMueller avatar Feb 11 '24 22:02 daveMueller

Update of GlobalTool.md should be sufficient e.g.

whenever more than one coverage format is used in combination with output parameter only a folder shall be used

current paragraph

The above command will write the results to the supplied path, if no file extension is specified it'll use the standard extension of the selected output format. To specify a directory instead, simply append a / to the end of the value.

coverlet <ASSEMBLY> --target <TARGET> --targetargs <TARGETARGS> --output "/custom/directory/" -f json -f lcov

Bertk avatar Feb 12 '24 05:02 Bertk

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] avatar May 19 '24 01:05 github-actions[bot]