-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
Update coverage #1905
Merged
Merged
Update coverage #1905
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`system` returns a boolean value to indicate success/failure, but the use of `failure_message` was in a `rescue` block that never got executed. It appears this has been broken since ea70e4e. Before that commit, we used `Rake::FileUtilsExt#ruby`, which does indicate failure by raising an error (and thus the `rescue` was correct). In ea70e4e, we switched to using `system` and the rescue was left in place but never got hit anymore. The lack of test coverage here is why we never noticed, so I addressed that as well.
`RSpec::CallerFilter.first_non_rspec_line` either returns the line or raises an error, so the branch for when `line` is nil could never be reached.
myronmarston
force-pushed
the
update-coverage
branch
from
March 18, 2015 07:41
7840b90
to
4cbc8c5
Compare
As it turns out, we need to skip simplecov on MRI 2.0 as well. It's just 2.1 and 2.2 that run it. |
LGTM, left a couple of non-blocking comments. |
This is awesome! Well done |
This was referenced Oct 1, 2015
MatheusRich
pushed a commit
to MatheusRich/rspec-core
that referenced
this pull request
Oct 30, 2020
Update coverage
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I recently learned that
# :nocov:
can be used to tag a chunk of code so simplecov doesn't consider it. Before learning that, I never bothered to try to get our coverage up because we have so many places where we do alternate method implementations for certain versions of ruby or for windows or whatever. With# :nocov:
, it's trivial to tag those so that we can actually meaningfully consider coverage.I've written a bit about my test coverage philosophy in the past. Besides all the alternate method implementations, keeping coverage up for RSpec's actually not hard, and I think we get enough value out of it to enforce it. I've seen a couple PRs from contributors where they added tests but because of how it was written it wasn't even executing the implementation it was intended to. Enforcing coverage will cause our travis build to catch such things for us.
In this PR, I've gotten coverage up to 100% and configured simplecov to enforce it on our "main" builds (travis builds for MRI >= 2.0), and I've stopped loading simplecov for other builds. The uncovered code generally fell into 3 categories:
# :nocov:
.Ideally, I'd like to see this same treatment done for expectations/mocks/support. Anyone want to take that on?
/cc @rspec/rspec