Option --threshold doesn't work, coverage.json is empty
See original GitHub issueHi 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! 😃
Issue Analytics
- State:
- Created 2 years ago
- Comments:12
Top Results From Across the Web
Jest finds tests but doesn't collect coverage
I found that when upgrading jest (from 23 to 26) that i had this issue, and the resolution was to run with the...
Read more >How do I increase my code coverage, or why can't I cover ...
Code coverage is a measurement of how many unique lines of your code are executed while the automated tests are running.
Read more >Full code-coverage with Jest - tsmx
When running Jest with the --coverage option (like in our npm run test-coverage ), it generates a report under coverage/lcov-report/index.html .
Read more >Use code coverage for unit testing - .NET
Code coverage is a measurement of the amount of code that is run by unit tests - either lines, branches, or methods. As...
Read more >Configuring Jest
Jest will run .mjs and .js files with nearest package.json 's type field set to module as ECMAScript Modules.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 😃
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.