Allow setting coverage_path independently of root
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.
@apachelogger thanks a lot for your issue report and sorry for the long wait!
Yes that definitely makes sense, gotta think about how to best do this but should definitely make its way in! :)
Any update on this feature?