Bachmann1234 / diff_cover

Automatically find diff lines that need test coverage.
Apache License 2.0
713 stars 191 forks source link

No lines with coverage information in this diff. #401

Open charismats2 opened 7 months ago

charismats2 commented 7 months ago

I removed some unit tests from the main branch locally and then I generate a coverage report with dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=./maincov.xml after that I ran this command on windows cmd diff-cover maincov.xml --html-report diff-coverage.html but this message appeared No lines with coverage information in this diff.

I checked the XML file generated by dotnet test and it detects not covered classes properly. what is wrong in my process?

Bachmann1234 commented 7 months ago

So I'm not 100% sure but it sounds like you were still on main. Diff cover will compare your current branch with main by default. So when it ran the diff it likely found no diff.

If you take your main branch with the tests then checkout a new branch and remove the tests from that branch.

Then try running diff cover from that new branch and see if they works better.