-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Using MSBuild, the coverage report is not being generated if the file does not exist previously #1587
Comments
I see you added the |
Please use the latest preview from coverlet nightly build and check whether this is still an issue. |
Could you please execute the test again and use The documentation uses forward slash which definitely works e.g.
I use the command line and the tried some variations:
Issue cannot be reproduced with latest preview version. |
I can't seem to use the version you mention. I see that you're using the CLI commands, and they seem to work. Could you test including the <PropertyGroup>
<CollectCoverage>true</CollectCoverage>
<CoverletOutput>$(MSBuildProjectDirectory)\coverage\</CoverletOutput>
<CoverletOutputFormat>cobertura</CoverletOutputFormat>
</PropertyGroup> and check if it works too? :) |
@mikibakaiki I tested CoverletOutput property in C# project file already.
|
coverlet V6.0.1 is released. |
Describe the bug
I was trying to use the
coverlet.msbuild
to make the commanddotnet test
always run asdotnet test /p:CollectCoverage=true
to make life easier for my work colleagues - and myself!However, this was not working properly. After hours of trying different things, and also running the command
dotnet test /p:CollectCoverage=true
without any success, i tried creating an empty file calledcoverage.cobertura.xml
and there it was, the report was generated, and it had overwritten the empty file.The first report with
ReportGenerator
was empty, because it read the empty file, but in the subsequent runs, it was reading the correct data - I'm currently unsure if it is reading the "freshest" data or just the n-1 run attempt.To Reproduce
Here's my
test.csproj
setup:I'm running the command
dotnet test
from inside the test folder and on the solution folder, and both weren't working until i created the empty file.Expected behavior
I expected to have the
coverage.cobertura.xml
report being created if the file doesn't exist, and if it does, its content is replaced.Also expected that, after my setup in the
test.csproj
,running the commanddotnet test
would work as an equivalent todotnet test /p:CollectCoverage=true
.I also tried to run the command
dotnet test /p:CollectCoverage=true
and the report was not being generated.Actual behavior
I was getting an error:
Both paths were correct and were equal. The problem was that the report file was not found.
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? 3.2.0 and 6.0.0
* Which version of .NET is the code running on? NETCoreApp,Version=v7.0
* What OS and version, and what distro if applicable? Windows 11 Pro 23H2
* What is the architecture (x64, x86, ARM, ARM64)? x64
* Do you know whether it is specific to that configuration? Nope
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: