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

Fail if coverage under threshold #96

Closed
jpatokal opened this issue Nov 30, 2011 · 8 comments
Closed

Fail if coverage under threshold #96

jpatokal opened this issue Nov 30, 2011 · 8 comments
Labels

Comments

@jpatokal
Copy link

In rcov, you can pass in an argument like "--failure-threshold 100" to fail your build if coverage is less than 100%. Am I missing something obvious, or is there no way to easily do this with SimpleCov? Writing a custom at_exit handler sounds a bit painful.

@colszowka
Copy link
Collaborator

This is currently not possible, although this is somewhat related to #90. It would be great to have this, scheduled it for 1.0 milestone as it should be fairly easy to implement.

@dnagir
Copy link

dnagir commented Jan 28, 2012

+1 for this. It would be really great to have it.

@dnagir
Copy link

dnagir commented Jan 28, 2012

BTW, here's what I currently do to workaround it.
Dirty, but it works :)

@infertux
Copy link
Contributor

+1, it would be nice.

SimpleCov.at_exit do
  SimpleCov.result.format!
  exit(1) if SimpleCov.result.covered_percent < 90
end

This does the trick but it's not especially neat.

@colszowka
Copy link
Collaborator

Thanks to @infertux this has arrived in master as the minimum_coverage configuration option and should be out in gem form within the next days.

@levent
Copy link

levent commented Sep 7, 2012

This is awesome! Any update on release date?

jperkin pushed a commit to TritonDataCenter/pkgsrc-legacy that referenced this issue Dec 9, 2013
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](simplecov-ruby/simplecov@v0.7.0...v0.7.1))
-------------------

  * [BUGFIX] The gem packages of 0.7.0 (both simplecov and simplecov-html) pushed to Rubygems had some file
    permission issues, leading to problems when installing SimpleCov in a root/system Rubygems install and then
    trying to use it as a normal user (see simplecov-ruby/simplecov#171, thanks @envygeeks
    for bringing it up). The gem build process has been changed to always enforce proper permissions before packaging
    to avoid this issue in the future.


v0.7.0, 2012-10-10 ([changes](simplecov-ruby/simplecov@v0.6.4...v0.7.0))
-------------------

  * [FEATURE] The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the
    coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows
    any coverage drops between test runs.
    See simplecov-ruby/simplecov#151, simplecov-ruby/simplecov#11,
    simplecov-ruby/simplecov#90, and simplecov-ruby/simplecov#96 (thanks to @infertux)
  * [FEATURE] SimpleCov now ships with a built-in MultiFormatter which allows the easy usage of multiple result formatters at
    the same time without the need to write custom wrapper code.
    See simplecov-ruby/simplecov#158 (thanks to @nikitug)
  * [BUGFIX] The usage of digits, hyphens and underscores in group names could lead to broken tab navigation
    in the default simplecov-html reports. See simplecov-ruby/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See simplecov-ruby/simplecov#106 and
    simplecov-ruby/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](simplecov-ruby/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Mar 12, 2014
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](simplecov-ruby/simplecov@v0.7.0...v0.7.1))
-------------------

  * [BUGFIX] The gem packages of 0.7.0 (both simplecov and simplecov-html) pushed to Rubygems had some file
    permission issues, leading to problems when installing SimpleCov in a root/system Rubygems install and then
    trying to use it as a normal user (see simplecov-ruby/simplecov#171, thanks @envygeeks
    for bringing it up). The gem build process has been changed to always enforce proper permissions before packaging
    to avoid this issue in the future.


v0.7.0, 2012-10-10 ([changes](simplecov-ruby/simplecov@v0.6.4...v0.7.0))
-------------------

  * [FEATURE] The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the
    coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows
    any coverage drops between test runs.
    See simplecov-ruby/simplecov#151, simplecov-ruby/simplecov#11,
    simplecov-ruby/simplecov#90, and simplecov-ruby/simplecov#96 (thanks to @infertux)
  * [FEATURE] SimpleCov now ships with a built-in MultiFormatter which allows the easy usage of multiple result formatters at
    the same time without the need to write custom wrapper code.
    See simplecov-ruby/simplecov#158 (thanks to @nikitug)
  * [BUGFIX] The usage of digits, hyphens and underscores in group names could lead to broken tab navigation
    in the default simplecov-html reports. See simplecov-ruby/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See simplecov-ruby/simplecov#106 and
    simplecov-ruby/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](simplecov-ruby/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 11, 2014
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](simplecov-ruby/simplecov@v0.7.0...v0.7.1))
-------------------

  * [BUGFIX] The gem packages of 0.7.0 (both simplecov and simplecov-html) pushed to Rubygems had some file
    permission issues, leading to problems when installing SimpleCov in a root/system Rubygems install and then
    trying to use it as a normal user (see simplecov-ruby/simplecov#171, thanks @envygeeks
    for bringing it up). The gem build process has been changed to always enforce proper permissions before packaging
    to avoid this issue in the future.


v0.7.0, 2012-10-10 ([changes](simplecov-ruby/simplecov@v0.6.4...v0.7.0))
-------------------

  * [FEATURE] The new `maximum_coverage_drop` and `minimum_coverage` now allow you to fail your build when the
    coverage dropped by more than what you allowed or is below a minimum value required. Also, `refuse_coverage_drop` disallows
    any coverage drops between test runs.
    See simplecov-ruby/simplecov#151, simplecov-ruby/simplecov#11,
    simplecov-ruby/simplecov#90, and simplecov-ruby/simplecov#96 (thanks to @infertux)
  * [FEATURE] SimpleCov now ships with a built-in MultiFormatter which allows the easy usage of multiple result formatters at
    the same time without the need to write custom wrapper code.
    See simplecov-ruby/simplecov#158 (thanks to @nikitug)
  * [BUGFIX] The usage of digits, hyphens and underscores in group names could lead to broken tab navigation
    in the default simplecov-html reports. See simplecov-ruby/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See simplecov-ruby/simplecov#106 and
    simplecov-ruby/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](simplecov-ruby/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
@tcd
Copy link

tcd commented Sep 18, 2019

Did this get some sort of resolution?

@PragTob
Copy link
Collaborator

PragTob commented Sep 19, 2019

@tcd yes as Christoph pointed out it was released more than 7 years ago: https://github.com/colszowka/simplecov#minimum-coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants