Skip to content
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

Support for non-percentage coverage threshold #25

Closed
ariya opened this issue Dec 15, 2012 · 3 comments
Closed

Support for non-percentage coverage threshold #25

ariya opened this issue Dec 15, 2012 · 3 comments

Comments

@ariya
Copy link
Contributor

ariya commented Dec 15, 2012

It could be "minimum uncovered unit". For example, in the case of statement coverage, enforcing 4 out 5 statements can be in the form of:

istanbul check-coverage --statement -1

because only 1 statement should be left uncovered. If someone adds a new line which won't be covered, this triggers the warning.

For some projects, including Esprima itself, this is much more convenient than a percentage-based threshold.

@gotwarlost
Copy link
Owner

Interesting idea, I agree that there are some use cases for which percents do not make sense

@gotwarlost
Copy link
Owner

Added in v0.1.26

$ istanbul help check-coverage

Usage: istanbul check-coverage <options> [<include-pattern>]

Options are:

      --statements <threshold>
              statement coverage threshold

      --functions <threshold>
              function coverage threshold

      --branches <threshold>
              branch coverage threshold

      --lines <threshold>
              line coverage threshold

Thresholds, when specified as a positive number are taken to be the minimum percentage required.
When a threshold is specified as a negative number it represents the maximum number of uncovered entities allowed.

For example, --statements 90 implies minimum statement coverage is 90%.
             --statements -10 implies that no more than 10 uncovered statements are allowed

<include-pattern> is a fileset pattern that can be used to select one or more coverage files for merge. This defaults to "**/coverage*.json"

@ariya
Copy link
Contributor Author

ariya commented Jan 4, 2013

+1 Thank you!

bmeck pushed a commit to bmeck/esprima that referenced this issue Nov 22, 2013
Taking advantage of new Istanbul feature, we can guard against coverage
regression by specifying maximum uncovered entities, instead of
percentage-based thresholds.

See gotwarlost/istanbul#25 for details.

http://code.google.com/p/esprima/issues/detail?id=388
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants