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
Getting simplecov to work with minitest's rake task #1032
Comments
Finding this in 2024 and the following seems to be working for me now, not sure what update I did with which gem, but I had 99% test coverage and then it went to 40% without any of my code changes, just gem dependencies. Ended up with this as my task: Minitest::TestTask.create(:coverage) do |t|
t.test_prelude = 'require "simplecov"; SimpleCov.start;'
t.libs << "spec"
t.warning = true
t.test_globs = "{test,spec}/**/{test_*,*_spec}.rb"
end Resulting
|
@copiousfreetime: Agreed... This is what hoe does these days w/ the t.test_prelude = %(require "simplecov"; SimpleCov.start { add_filter %p }) % [cov_filter] where I've given up on the maintainers tending to their issues so I'm closing this to get it off MY radar. |
I've always hated how rake runs tests... it's SO broken. I've been running my own test task via hoe for a very long time and recentlyish ported it over to minitest (see the file here)... it runs in a different manner and as such, the recipe in the simplecov readme doesn't work...
I'm left wondering if this is related to / a variant of #1023 or not...
Here's what I've figured out so far:
with the following recipe at the top of my test:
a manual run works fine:
but what the minitest rake task is doing does not:
Instead, it runs the report BEFORE the tests start.
If I remove the recipe at the top of the file and manually modify the rake task command:
then it works again.
AFAICT... this has something to do with the way you're checking for minitest (the guess methods?) or hooking
at_exit
... having theminitest/autorun
inclusion might be messing it up. We can either try to figure out how to make simplecov happy no matter how tests are run (minitest/autorun before or after), or I can chalk this up to my rake task doing too much too soon and build in support for simplecov to the task itself.What do you think?
The text was updated successfully, but these errors were encountered: