Skip to content

simplecov inaccurate number of relevant lines when using parallel_tests #542

@mattcsl

Description

@mattcsl

I am still getting very inaccurate rspec coverage when using parallel_tests vs single process rspec.
89% coverage with parallel_tests vs 67% with single process rspec.

Looking at the simplecov-html output many lines are dismissed as irrelevant and skipped.

For example with single process rspec a file has 150 lines 130 being relevant and 50 being missed whereas with parallel_tests the file has only 8 lines being relevant and 0 being missed for 100% coverage which is wrong.

Is there some trick to getting the results merged properly? I am using

config.before(:each) do
    SimpleCov.command_name "RSpec:#{Process.pid.to_s}#{ENV['TEST_ENV_NUMBER']}"
end

in my spec/spec_helper.rb

Here's the gems and version info

using parallel_tests (2.11.0)
rspec-core (3.5.4)
      rspec-support (~> 3.5.0)
    rspec-expectations (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-mocks (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-rails (3.5.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
      rspec-support (~> 3.5.0)
    rspec-support (3.5.0)

Generated by simplecov v0.12.0 and simplecov-html v0.10.0
using RSpec:23611, RSpec:236144, RSpec:236163, RSpec:236202

Thanks,
Matt

edit: edited for code readability! @PragTob

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions