-
Notifications
You must be signed in to change notification settings - Fork 552
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
bin/rake and rake have different results #363
Comments
Do you have spring running? Try Closing as is not a simplecov issue. See #340 |
@bf4 Thanks for getting back so quickly. I am using spring and it was running. However, restarting spring doesn't resolve the problem. I also tried adding a .simplecov file with the following configuration:
Just to confirm, this has nothing to do with simplecov and I should file an issue with Spring instead? |
Did you try |
Hey @bf4, I've read #340 a few times. Both now and when you first posted it. I don't want to waste your time and I'm sorry if it seems that I don't get it. I'm very grateful for both your help and contributions to simplecov. I know the After rereading this issue, I think it might be possible that I wasn't explicitly clear enough.
Is there anything else I can do to load the
|
@whatasunnyday Is it possble that your bundled rake version is different from the latest one installed on your machine/used via bin/rake? My idea is that your engine tests run in a separate process for the bin/rake method and hence get overwritten. Maybe try to add a |
@colszowka It appears they're all same.
However, your suggestion of adding |
Please paste contents of bin/rake Also try env DISABLE_SPRING=1 bin/rake What I'm trying to say is that your bin/rake is either loading or Spring causes so many surprising failures |
Here's bin/rake:
Using |
So, we're good? |
@bf4 I might be misunderstanding but no, right? I believe
I can understand if Spring is out of your domain expertise and try to follow up with some maintainers there. Is that the next logical step? |
@whatasunnyday I no longer understand what the issue is. The reason you are getting different coverage is because spring affects when your code has loaded relative to when SimpleCov started running. We've established this, no? We've proven it by setting the env var, by looking at the file, by running The |
@bf4 I want |
Thanks for your report and following up. Not everyone does that, so it's appreciated. And I think we both understand the library and its quirks a little better now, no? As a general rule, if I'm using a code reloader, my goal is more about re-running tests a lot for feedback. When I'm done, then I'll run my tests and care about the coverage. The way I do that is: # .simplecov
@minimum_coverage = ENV.fetch("COVERAGE_MINIMUM") { 100.0 }.to_f.round(2)
SimpleCov.start "some_profile" # the profile I defined
if ENV["COVERAGE"] =~ /\Atrue\z/i
puts "[COVERAGE] Running with SimpleCov HTML Formatter"
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter]
else
SimpleCov.formatters = []
end
SimpleCov.at_exit do
SimpleCov.result.format!
percent = Float(SimpleCov.result.covered_percent)
if percent < @minimum_coverage
abort "Spec coverage was not high enough: #{percent.round(2)} is > #{@minimum_coverage}%"
else
puts "Nice job! Spec coverage (#{percent.round(2)})is still above #{@minimum_coverage}%"
end
end So, I get feedback while the tests are running that may or may not be useful, but it only generates a report when I set COVERAGE=true |
Very much so. And thank you for your persistence in helping. I really do appreciate that. Your tip is helpful. Thanks for that. |
@whatasunnyday So if this is an issue with spring, maybe you also could consider trying out spin. It's a very lightweight preloader with which I have had very little trouble in the past playing nice with simplecov! |
@colszowka Thanks for the tip. I'll definitely investigate. I'm going to follow up with the people at Spring too. |
Not sure if anyone is still interested but I required simplecov inside of config/spring.rb and that's added a lot of the missing files into simplecov. However, the coverage % being reported now is much lower. It seems that bundle exec rake is really the only way to get correct coverage results as of now. |
Hi! I noticed that
rake test
andbin/rake test
have different coverage results. Its a rails project with grape mounted. The files being skipped are theapp/api_engine
folder (grape app). Any ideas on how I can get them to equal?The text was updated successfully, but these errors were encountered: