-
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 items in the coverage report #2
Comments
Hi! Is the setup of simplecov at the very first line of your spec helper? It MUST be required bevore your environment is loaded since it will only track coverage for files required after itself. Also, Github user haobole ran into a similar issue, and told me yesterday the following: Please let me know if the problem persists or what exactly you had to do to fix the problem so I can update the readme! |
it works when i setup simplecov at the head of spec_helper. thx! |
Hello! I explain
I reflect on this and spiked on top of a spec_helper then Do you think of a less obstrusive integration ? |
Are you sure this fails on 1.8? Actually, there is a mechanism right at the head of the SimpleCov.start method that should just skip on coverage on Ruby 1.8. Also, for this reason the require 'coverage' happens after this check inside the start method: http://github.com/colszowka/simplecov/blob/master/lib/simplecov.rb#L31 If this doesn't work for you, please let me know, since this would indeed be a bug as the intendend behaviour on 1.8 does not work as expected. Yes, the coverage analysis will always happen. The question to be asked here is: Why shouldn't it? Obviously, with RCov you wouldn't want this always since it slows tests down quite a bit because of the Ruby trickery it has to do to gather data. With 1.9's built-in coverage library on the other hand, coverage analysis is very fast - in my comparisons it slowed tests down less than 5%, which I think is absolutely acceptable and the benefit of always having up-to-date coverage analysis by far outweighs the performance "hit" - if you have to do additional weight-lifting to perform coverage analysis, in my experience you won't use it as much as you would when it's "just there". Also, I think making coverage optional via an environment variable like you described it is so easy that everyone who prefers the opt-in way can achieve this without much effort without a need for a built-in mechanism in simplecov that accomplishes this. I will add this to the project Readme so people can find out how to do it easily. Let me know what you think :) |
After config simplecov in my Gemfile and spec_helper.rb, i ran my specs with rake spec. i got the coverage report in my project, but there is no items in it.
Env: rails3 + ruby 1.9.2-p0
The text was updated successfully, but these errors were encountered: