-
Notifications
You must be signed in to change notification settings - Fork 553
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
No report generated using RSpec Rails / SimpleCov 0.18.3 #873
Comments
Forgot to mention I'm happy to contribute a PR to fix this, but would appreciate confirmation of the issue & any guidance on any preferred direction of the solution. My initial thoughts for a fix would be to define a |
I can confirm, just started a new rails 6 project with rspec and |
👋 Hi @odlp and thank you so much for your bug report and your in depth investigation tracking it down, already providing a sample repo! 💚 This is truly great! 🚀 The bugs will never stop coming with this release will they 😢 Anyhow. I also don't know how to best fix this. Our command guesser seems to first check for RSpec and then Minitest probably for that very reason. We might also on initial start check the command name that is being run (although that gets muddy/murky with parallel tests I believe). So... I'm saying this seems like a hard problem :/ Querying Other implementation notes, damn myself for not already introducing the full rails projects. We have a You PRing it would be mightily welcome, this is big enough of a bug though that I might try to clear some time in the coming days so a fix can be published ASAP. If you get there first, of course much welcome. I'll put a comment in this issue when I start working on it. also cc: @adam12 as he seemed to know lots of things about minitest so might be of help :) Thanks again for the great & nice report, it's greatly appreciated! 💚 |
Instead of using the call to |
I'll work on a PR for this. |
@odlp @nathanvda Would you mind trying my branch which uses a different guard method? https://github.com/adam12/simplecov/tree/alternative-at-exit-guard I might be wrong and we might need to add the RSpec hook similar to what was mentioned above, but this seemed inline with the changes we've already made. |
@adam12 I can confirm that branch restores the expected behaviour in the Rails+RSpec codebase I've been testing with 👍 |
@adam12 yes, actually multiple. One with rspec, one with minitest etc... to make sure it all works in what's probably our must common use case. If you PR the changes I'm super happy adding the test projects myself 👌 |
@adam12 if you're interested though, I imagine it like https://github.com/colszowka/simplecov/tree/master/test_projects/parallel_tests and the accompanying https://github.com/colszowka/simplecov/blob/master/features/parallel_tests.feature (minus the wips due to the other issue 😅 ) Long term vision is to have these for lots of common setups. Like Rails 5.2, Rails 6, some amount of different test frameworks. Rails + parallel tests. All the fun to avoid these regressions in the future and also to have a framework to more easily reproduce bugs and write features/specs against it. |
Also: @adam12 thank you 💚 |
Update ruby-simplecov to 0.18.5. 0.18.5 (2020-02-25) =================== Can you guess? Another bugfix release! ## Bugfixes * minitest won't crash if SimpleCov isn't loaded - aka don't execute SimpleCov code in the minitest plugin if SimpleCov isn't loaded. Thanks to [@edariedl](https://github.com/edariedl) for the report of the peculiar problem in [#877](simplecov-ruby/simplecov#877). 0.18.4 (2020-02-24) =================== Another small bugfix release 🙈 Fixes SimpleCov running with rspec-rails, which was broken due to our fixed minitest integration. ## Bugfixes * SimpleCov will run again correctly when used with rspec-rails. The excellent bug report [#873](simplecov-ruby/simplecov#873) by [@odlp](https://github.com/odlp) perfectly details what went wrong. Thanks to [@adam12](https://github.com/adam12) for the fix [#874](simplecov-ruby/simplecov#874). 0.18.3 (2020-02-23) =========== Small bugfix release. It's especially recommended to upgrade simplecov-html as well because of bugs in the 0.12.0 release. ## Bugfixes * Fix a regression related to file encodings as special characters were missing. Furthermore we now respect the magic `# encoding: ...` comment and read files in the right encoding. Thanks ([@Tietew](https://github.com/Tietew)) - see [#866](simplecov-ruby/simplecov#866) * Use `Minitest.after_run` hook to trigger post-run hooks if `Minitest` is present. See [#756](simplecov-ruby/simplecov#756) and [#855](simplecov-ruby/simplecov#855) thanks ([@adam12](https://github.com/adam12)) 0.18.2 (2020-02-12) =================== Small release just to allow you to use the new simplecov-html. ## Enhancements * Relax simplecov-html requirement so that you're able to use [0.12.0](https://github.com/colszowka/simplecov-html/blob/master/CHANGELOG.md#0120-2020-02-12)
Hello,
First of all thank-you to everyone for all the hard work making the
0.18
release!I think I've encountered a bug where no report is generated at the end of the test suite. This is in a Rails application tested using RSpec (using the
rspec-rails
gem), with SimpleCov0.18.3
.Reproduction
I've made a minimal reproduction of the issue here:
https://github.com/odlp/simplecov-at-exit-bug
Tracing the cause
When
ActiveSupport::TestCase
is required, by RSpec Rails for example:https://github.com/rspec/rspec-rails/blob/e23efbb2cd6b40aaa8c6f33a36fe7ed4e724e2c7/spec/rspec/rails/matchers/redirect_to_spec.rb#L2
This ends up requiring
minitest
:https://github.com/rails/rails/blob/c70112e74f4d2ef517f4036fe6e2888cc30fc952/activesupport/lib/active_support/test_case.rb#L4
Unfortunately Minitest is a dependency of ActiveSupport:
https://github.com/rails/rails/blob/c70112e74f4d2ef517f4036fe6e2888cc30fc952/activesupport/activesupport.gemspec#L38
By having defined
Minitest
, this means the SimpleCovat_exit
hook will skipthe 'at exit behaviour' hook:
https://github.com/colszowka/simplecov/blob/a179ec6dc419c43bce472c2426f30f24cc49b42f/lib/simplecov/defaults.rb#L24-L29
I've verified this by placing a breakpoint in the
at_exit
hook and stepping over the execution.PRs which introduced this behaviour:
Temporary Workaround
Or use versions '<= 0.18.2'
The text was updated successfully, but these errors were encountered: