Skip to content
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 data is generated #82

Closed
pupeno opened this issue Sep 21, 2011 · 22 comments
Closed

No data is generated #82

pupeno opened this issue Sep 21, 2011 · 22 comments
Labels

Comments

@pupeno
Copy link

pupeno commented Sep 21, 2011

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]

@pupeno
Copy link
Author

pupeno commented Sep 21, 2011

A screenshot: http://i.imgur.com/t3lyv.png

@pupeno
Copy link
Author

pupeno commented Sep 22, 2011

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

@pupeno
Copy link
Author

pupeno commented Sep 24, 2011

If I start simplecov like this:

SimpleCov.start

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

screenshot

@jrmehle
Copy link

jrmehle commented Oct 4, 2011

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.

@macedo
Copy link

macedo commented Oct 12, 2011

I got the same issue too.

@aribeiro
Copy link

Hi guys, same issue here too.

@lucasallan
Copy link

I have the same issue too

@colszowka
Copy link
Collaborator

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?

@macedo
Copy link

macedo commented Nov 4, 2011

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

@lucasallan
Copy link

Didn't work for me either.

@lucasallan
Copy link

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.

@yalab
Copy link

yalab commented Nov 15, 2011

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.

@jrmehle
Copy link

jrmehle commented Nov 15, 2011

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. :(

@pupeno
Copy link
Author

pupeno commented Dec 7, 2011

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.

@jrmehle
Copy link

jrmehle commented Dec 7, 2011

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.

@kippr
Copy link

kippr commented Jan 20, 2012

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

@colszowka
Copy link
Collaborator

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...

@kippr
Copy link

kippr commented Jan 27, 2012

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! :)

@karishmamalkan
Copy link

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?

@jmervine
Copy link

jmervine commented Apr 1, 2013

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

@ghost
Copy link

ghost commented Sep 28, 2015

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

@harold-s
Copy link

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,

@ghost ghost deleted a comment Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests