-
Notifications
You must be signed in to change notification settings - Fork 386
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
Option --threshold doesn't work, coverage.json is empty #1205
Comments
I managed to solve problem by using next command: So now I'm still wondoring why coverage.json file is empty ? :) |
I guess your ouput looks somewhat like this?
Your solution doesn't seem to have any module or the module can't be detected by coverlet. Thus coverlet can't instrument any module and isn't able to calculate any coverage. If the coverage result is empty then also the coverage report is empty. The command in your first comment should return a non zero exit code even when no assemblies can be instrumented. This is a bug, thanks for reporting 👍. It seems that I missed this while working on #1083. |
Thank you for your answer, it really helped me! I am looking forward for next release :) And just one additional question, is there any part of documentation that explaines what does procent coverge of branch and method means ? Thank you! |
|
Hi @milica-nikolic, if you want to try the fix and let us know if it works as expected you can consume the nightly build https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md |
Hi again! Sorry for my late response. I still have some issues. Running this command:
gives this output
In that package I have few tests but i still get zeros in report regadless of those test. Am I doing something wrong here ? Additional info I am using this in GitLab CI pipeline as .NET global tool. |
Like I said before, your solution doesn't seem to have any module that is referenced by your tests or the module can't be detected by coverlet. Usually detection issues are edge cases. Can you provide a repro, so we could analyze this in more detail? |
Hi, thank you for opening this one again. If by solution you mean .sln file I have all modules included there. I am not able to share my repo unfortunately because it is under company domain. We have classic arhitecture approach with ui, domain, application, infrastructure and tests. |
OK now I have another idea. In the documentation the argument is defined as In your example above it says
If you have multiple test assemblies you have to use |
Hi Dave, Ohh thank you so much for pointing that out, I didn't saw that. After I added path to assembly everything works fine localy, I've got results for coverage. :) Now I am facing another issue and that is no modules and zero coverage when running in GitLab's pipeline. I have localy .NET 5 installed and coverlet is on version 3.1.0.0 and as I sad everything works great. In my pipeline at first I had this image mcr.microsoft.com/dotnet/nightly/sdk:3.1 and because I could't install coverage I replaced it for mcr.microsoft.com/dotnet/sdk:5.0 and now I have that issue. I have went trough documentation and I found that I need to replace images like that but now I am not sure why I can't see coverage results. Is that one of listed known issues in documentation? Thank you for provided guidence! |
OK so your pipeline builds your application inside a docker container? Currently you are using Personally I think it would be much easier to just use |
Hi Dave, Thank you for your help and instructions. I managed to get it working using coverlet.msbuild in GitLab CI pipeline, everything works properly now. Here is snippet of code, maybe it will be helpful for other developers :)
|
Hi there!
I am trying to implement Coverlet in my pre-commit script, unit tests are still to be written. I am using this option:
coverlet CBPm.Validations.Test --target "dotnet" --targetargs "test . --no-build" --threshold 80
This snippet sholud retrun non zero value if code coverage is less than 80%.
In my case code coverge is 0% and I still get zero exit code instead of non zero exit code.
In addition to this coverage.json file is generated but it is empty.
Any help would be appreciated.
Kind regards! :)
The text was updated successfully, but these errors were encountered: