Skip to content

Allow setting coverage_path independently of root #716

Open
@hsitter

Description

@hsitter

Hey,

bit of an oddball request: could coverage_path become explicitly settable instead of constructed from root+coverage_dir?

We are using simplecov inside a much larger code base where build and testing run through CMake and CTest https://cgit.kde.org/dolphin.git/

One of the primary side effects of using CMake is that the build directory and thus the target directory of the coverage report may be out-of-tree, anywhere in the file system. Unfortunately that seems fairly unsupported with simplecov right now as the coverage_path is constructed from root and coverage_dir, and root in turn appears to need to be a parent of the source files under test or no coverage data is collected.

Example:

  • source root is in /foo/, tests in /foo/tests
  • test PWD is /tmp/build/, coverage is expected to go into /tmp/build/coverage/

With this split between source-dir and coverage-dir one needs to do some relative path trickery to get things working and even that only works because result_merge expands the path:

  SimpleCov.start do
    root '/foo/'
    coverage_dir '../tmp/build
  end

What would be more ideal is being able to set the output coverage_path to any arbitrary path:

  SimpleCov.start do
    root '/foo/'
    coverage_path '/tmp/build/coverage'
  end

As far as I can tell coverage_path is purely used for output generation and should be save to set explicitly.

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