Document Istanbul `check-coverage` cli command (#834)

pull/835/head
cgewecke 10 months ago committed by GitHub
parent abea00b21c
commit 54bfdbd766
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      README.md
  2. 13
      docs/advanced.md

@ -123,6 +123,7 @@ Common problems & questions:
+ [Running out of stack][1002] (Stack too deep)
+ [Running out of memory][5]
+ [Running in parallel (in CI)][1003]
+ [Running coverage threshold checks][1004]
## Example reports
+ [metacoin][9] (Istanbul HTML)
@ -218,4 +219,5 @@ $ yarn
[1001]: https://docs.soliditylang.org/en/v0.8.0/using-the-compiler.html#input-description
[1002]: https://github.com/sc-forks/solidity-coverage/blob/master/docs/faq.md#running-out-of-stack
[1003]: https://github.com/sc-forks/solidity-coverage/blob/master/docs/advanced.md#parallelization-in-ci
[1004]: https://github.com/sc-forks/solidity-coverage/blob/master/docs/advanced.md#coverage-threshold-checks

@ -138,6 +138,19 @@ There's a nice example of this being done in CircleCI [at Synthetix, here][31].
:bulb: **Pro Tip**: Codecov CI will automatically combine coverage reports sent to them as a batch - if you're using that service you don't need to do this yourself.
## Coverage threshold checks
Istanbul has a command line utility which can be used to set thresholds for different coverage categories and throw an error if your coverage drops below them. (Istanbul is a solidity-coverage dependency so you shouldn't need to install it separately.)
```shell
# Usage
$ npx istanbul check-coverage ./coverage.json --statements 99 --branches 94 --functions 99 --lines 99
ERROR: Coverage for statements (60%) does not meet global threshold (99%)
ERROR: Coverage for lines (60%) does not meet global threshold (99%)
ERROR: Coverage for functions (66.67%) does not meet global threshold (99%)
```
[22]: https://github.com/JoranHonig/vertigo#vertigo
[23]: http://spideruci.org/papers/jones05.pdf

Loading…
Cancel
Save