Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fail if coverage under threshold #96

Closed
jpatokal opened this Issue · 6 comments

5 participants

@jpatokal

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
Owner

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

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

@dnagir

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

@infertux

+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.

@infertux infertux referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@infertux infertux referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@colszowka colszowka closed this in 6ce1097
@colszowka
Owner

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

This is awesome! Any update on release date?

@jperkin jperkin referenced this issue from a commit in joyent/pkgsrc
taca Update ruby-simplecov.
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](colszowka/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 colszowka/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](colszowka/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 colszowka/simplecov#151, colszowka/simplecov#11,
    colszowka/simplecov#90, and colszowka/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 colszowka/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 colszowka/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See colszowka/simplecov#106 and
    colszowka/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](colszowka/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
9027cf8
@jsonn jsonn referenced this issue from a commit in jsonn/pkgsrc
taca Update ruby-simplecov.
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](colszowka/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 colszowka/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](colszowka/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 colszowka/simplecov#151, colszowka/simplecov#11,
    colszowka/simplecov#90, and colszowka/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 colszowka/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 colszowka/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See colszowka/simplecov#106 and
    colszowka/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](colszowka/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
4ceab0f
@jsonn jsonn referenced this issue from a commit in jsonn/pkgsrc
taca Update ruby-simplecov.
Make this package to Ruby 1.9.3 only.

v0.7.1, 2012-10-12 ([changes](colszowka/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 colszowka/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](colszowka/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 colszowka/simplecov#151, colszowka/simplecov#11,
    colszowka/simplecov#90, and colszowka/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 colszowka/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 colszowka/simplecov-html#14 (thanks to @ebelgarts)
  * [REFACTORING] A few more ruby warnings removed. See colszowka/simplecov#106 and
    colszowka/simplecov#139. (thanks to @lukejahnke)
  * A [Pledgie button](colszowka/simplecov@63cfa99) for those that
    feel generous :)
  * The usual bunch of README fixes and documentation tweaks. Thanks to everyone who contributed those!
8758c51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.