Simplecov: No data is generated

Created on 21 Sep 2011  路  22Comments  路  Source: simplecov-ruby/simplecov

Hello,

I'm not sure when simplecov stopped generating data for my project, the html is generated but no file is mentioned. I'm configuring it this way:

# Setup simplecov.
require "simplecov"
SimpleCov.start "rails"
SimpleCov.command_name # Needed to separate test suits, due to issue https://github.com/colszowka/simplecov/issues/45

and I have this gems installed:

  • actionmailer (3.1.0)
  • actionpack (3.1.0)
  • activemodel (3.1.0)
  • activerecord (3.1.0)
  • activeresource (3.1.0)
  • activesupport (3.1.0)
  • addressable (2.2.6)
  • airbrake (3.0.4)
  • arel (2.2.1)
  • assert_difference (0.3.1)
  • bcrypt-ruby (3.0.1)
  • builder (3.0.0)
  • bundler (1.0.18)
  • cancan (1.6.5)
  • capybara (1.1.1)
  • childprocess (0.2.2)
  • coffee-rails (3.1.1)
  • coffee-script (2.2.0)
  • coffee-script-source (1.1.2)
  • daemons (1.1.4)
  • delayed_job (2.1.4)
  • devise (1.4.6)
  • erubis (2.7.0)
  • eventmachine (0.12.10)
  • execjs (1.2.8)
  • factory_girl (2.1.0)
  • factory_girl_rails (1.2.0)
  • ffi (1.0.9)
  • growl_notify (0.0.1)
  • guard (0.7.0)
  • guard-test (0.3.1)
  • haml (3.1.3)
  • haml-rails (0.3.4)
  • heroku (2.8.0)
  • hike (1.2.1)
  • i18n (0.6.0)
  • jquery-rails (1.0.14)
  • json_pure (1.6.1)
  • launchy (2.0.5)
  • mail (2.3.0)
  • mail_safe (0.3.1)
  • mime-types (1.16)
  • multi_json (1.0.3)
  • multitenant (0.4.0)
  • newrelic_rpm (3.1.2)
  • nokogiri (1.5.0)
  • orm_adapter (0.0.5)
  • pg (0.11.0)
  • polyglot (0.3.2)
  • rack (1.3.3)
  • rack-cache (1.0.3)
  • rack-mount (0.8.3)
  • rack-ssl (1.3.2)
  • rack-test (0.6.1)
  • rails (3.1.0)
  • rails-footnotes (3.7.5.rc4)
  • rails_admin (0.0.1 8a24737)
  • railties (3.1.0)
  • rake (0.9.2)
  • rb-appscript (0.6.1)
  • rb-fsevent (0.4.3.1)
  • rdiscount (1.6.8)
  • rdoc (3.9.4)
  • rest-client (1.6.7)
  • rubyzip (0.9.4)
  • sass (3.1.7)
  • sass-rails (3.1.2)
  • selenium-webdriver (2.6.0)
  • sequel (3.20.0)
  • shoulda (2.11.3)
  • simple_form (1.5.1)
  • simplecov (0.5.3)
  • simplecov-html (0.5.3)
  • sinatra (1.0)
  • sprockets (2.0.0)
  • sqlite3 (1.3.4)
  • sqlite3-ruby (1.3.3)
  • stringex (1.3.0)
  • taps (0.3.23)
  • term-ansicolor (1.0.6)
  • test-unit (2.3.2)
  • thin (1.2.11)
  • thor (0.14.6)
  • tilt (1.3.3)
  • treetop (1.4.10)
  • tzinfo (0.3.29)
  • uglifier (1.0.3)
  • verbose_factory_girl (0.1.0)
  • warden (1.0.5)
  • xpath (0.1.4)

while running ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]

Support

Most helpful comment

I get this issue as well. I am using SimpleCov with RubyMine IDE.

image

and this what the coverage report looks like:

image

Really need some help

All 22 comments

Setting config.cache_classes to false made it generate some data.

If I start simplecov like this:

SimpleCov.start

without specifying "rails" I get code coverate but only for files in the test directory.

screenshot

I am seeing the same issue, but with Rspec. Ruby 1.9.2 p290, Rails 3.1.

If I use SimpleCov.start in spec_helper.rb, it only shows my spec files in the coverage report (of course they are all 100%) and if I use SimpleCov.start 'rails', then it doesn't show any data at all.

I got the same issue too.

Hi guys, same issue here too.

I have the same issue too

Hey guys. For some reason I'm not getting mails from github on new issues, sorry for being late :)

Actually SimpleCov.command_name will need an argument, like "Unit Tests". Could you please try to go with SimpleCov.command_name 'Unit Tests' and report back if that fixes the problem?

SimpleCov.command_name 'RSpec' not works for me =/

Didn't work for me either.

Hey guys

I changed the gem's declaration in my Gemfile and it works.
Before I have something like that:

gem 'simplecov', :require => false

Then I removed the 'require => false'

Now it works fine.

Hey guys.

I write setting first line on test/test_helper.rb
like this

require 'simplecov'
SimpleCov.start 'rails' do
  add_filter "/gems/"
end

ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)

It work fine.

I did some more investigation and I still can't get simplecov to generate any report data other than on my spec files (which all report 100%).

I tried several permutations of requiring the gem in the Gemfile or in the spec_helper, Simplecov.start with and without 'rails', and also including or not including the command_line calls.

Still no luck. :(

I was requiring simplecov after doing require File.expand_path('../../config/environment', FILE), now I put the require and start for simplecov on top, as instructed by the documentation (doh!) and it worked.

Ahh ha! Pupeno nailed the problem. You must place the require and start calls before File.expand_path... to get it to work. This could definitely be made more clear in the README as several of us have run into this gotcha.

Fix confirmed - same for me: moved the Simplecov.start above file expand and it alls works. Fab stuff!

Guys, I'm glad you managed to figure this one out yourselves. I already went through various permutations of the README to make it superclear that the require should be happening before loading anything else, so obviously I didn't even consider mentioning this here as a possible source for the problem. Great that you've got it to work anyway :)

If you have suggestions on how to improve the README so that your past selfs would have realized this earlier please let me know :)

Also, if someone in here bumps into partially "vanishing" coverage (particularily using rspec) please check out #60. That one is a nasty motherfucker I'm telling you...

LOL - yeah, so that's pretty obvious. I read about simplecov elsewhere, and google brought me to this page, not the readme. At least it'll help future selfs figure out the problem quick, plus give them a chance to laugh at us doofuses! :)

im facing the same issue :( Does the test gemfile and application gemfile need to be the same.. my application has a separate gemfile so where do i start simplecov?

I had this issue, not with rails, but with a gem I was developing and removing gemspec from my Gemfile fixed it.

I get this issue as well. I am using SimpleCov with RubyMine IDE.

image

and this what the coverage report looks like:

image

Really need some help

If someone is not finding a solution. My problem in a Rails project was not having a .rspec file with inside
--color --require spec_helper
Guessed spec_helper was not called right a the beginning and so simplecov registered too late,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elliottmason picture elliottmason  路  4Comments

pandermatt picture pandermatt  路  5Comments

juanbrein picture juanbrein  路  4Comments

andyhite picture andyhite  路  8Comments

DannyBen picture DannyBen  路  4Comments