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

Running SimpleCov produces 2 different coverage values (terminal/html) #354

Closed
onebree opened this issue Dec 9, 2014 · 2 comments
Closed

Comments

@onebree
Copy link
Contributor

onebree commented Dec 9, 2014

While negligible, both types of generated coverage reports have different % values. After a closer look, LOC reported also differ.

From ./coverage/index.html
screenshot from 2014-12-09 14 16 11

After running bundle exec rspec in terminal:
Coverage report generated for RSpec to ./coverage. 8023 / 14085 LOC (56.96%) covered.

The following Gist holds spec_helper.rb, .simplecov, and my environment
https://gist.github.com/onebree/99a048461f41713b9999

@onebree onebree changed the title 2 different reported coverage %s 2 different coverage values Dec 9, 2014
@onebree onebree changed the title 2 different coverage values Running SimpleCov produces 2 different coverage values (terminal/html) Dec 11, 2014
@bf4
Copy link
Collaborator

bf4 commented Dec 31, 2014

I'm not sure I understand the two ways you're running tests. One is bundle exec rspec and the other is?

In any case, in looking at your gist, I see you're requiring and starting SimpleCov multiple ways. That could account for the different results. You may want to look at and compare the json it generates in the coverage directory.

In your gist you have

# .simplecov
SimpleCov.start do
  load_profile 'rails' # load_adapter < 0.8
# spec/spec_helper.rb
require 'simplecov'

Spork.prefork do
  unless ENV['DRB']
    require 'simplecov'
    SimpleCov.start 'rails' do

Spork.each_run do
  if ENV['DRB']
    require 'simplecov'
    SimpleCov.start 'rails'

I see you've already looked at #340 Have you since resolved your issue?

@onebree
Copy link
Contributor Author

onebree commented Dec 31, 2014

Thank you for replying to my comment in #340. I will work on a SimpleCov profile next year (hahaha). I think this may solve my issue in #354.

What I meant was 2 tests was this:

  1. Running bundle exec rspec in terminal produces a mini report/result after all specs are ran.
  2. When I open the HTML report in my coverage directory, the numbers listed there are different than those from the terminal report.

I also decided along the way to not mix Spork and SimpleCov, but that's not totally relevant to this issue... Just wanted to update you.

@onebree onebree closed this as completed Dec 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants