Skip to content

Relevant lines differs for files with no coverage vs. with coverage #654

Open
@elliottmason

Description

@elliottmason

Running specs and cucumber features separately yield different statistics in terms of relevant lines. What I am noticing is that both suites load all of the same files. However, what registers as a "relevant line" seems to change based upon whether or not that file has any test coverage.

At a glance, it seems that for files with coverage, single statements that span multiple lines are counted as a single line. If the file has no coverage, each individual line of code is counted.

e.g. this:

def show
  @product = base_scope
             .includes(colors_products: :color)
             .find(params[:id])
end 

Seems to count as 3 lines when the file has any amount of coverage, but 5 lines when the file has no coverage. The same file in the former example has a total number of relevant lines of 56 where as in the latter scenario (no coverage) the number of relevant lines is 106. The total number of lines (133) is picked up accurately in either scenario.

I'm using SimpleCov 0.15.1 on ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin17] and Rails 5.0.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions