Skip to content

Request for Feedback: Getting SimpleCov to work with Spring #750

Open
@ndbroadbent

Description

@ndbroadbent

Hello!

I think I've figured out a good way to get SimpleCov working with Spring. For my Rails application, preloading the app would require some classes in my ./app directory, and this would cause some inaccurate coverage to be reported (any lines that were required during preloading were missing in the coverage.) I figured out how to fix this issue by starting SimpleCov in config/spring.rb, storing the preloaded coverage before forking the process, and then merging the coverage together in SimpleCov.result. Here's the code I'm using. (And here's a longer write-up about how I investigated this issue.)

I was wondering what you think about these changes, and if it might be possible to add some of these changes to SimpleCov?

I'm also not sure if this is just a bug in the Coverage library for my version of Ruby (2.5.5), where the coverage is being reset after the Ruby process is forked.

Thanks for your time!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions