Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support monorepo/root in subfolder #26

Open
filmhubhq opened this issue Jan 19, 2021 · 0 comments
Open

Support monorepo/root in subfolder #26

filmhubhq opened this issue Jan 19, 2021 · 0 comments

Comments

@filmhubhq
Copy link

Say you have a monorepo with

/ (repo root)
├── rails
└── web

This breaks coverage reports (for example for CodeBuild) because of missing rails/ and web/ prefixes in all paths.

We have found a workaround with

# rails/test/support/coverage.rb, required in test_helper.rb:
SimpleCov.start 'rails' do
  # test file paths need to include `rails/...` for coverage report
  root File.expand_path('../../..', __dir__)
  # .. but move the coverage reports back into `rails/test/coverage`
  coverage_dir 'rails/coverage'
end

but that's rather cumbersome.

The issue is that this is not configurable:

filename = file.filename.gsub("#{SimpleCov.root}/", './')

Would you be open for a PR? If so, any preferred config API? Maybe simply like this?

SimpleCov::Formatter::LcovFormatter.config.project_root = `rails/`

Or should this be a SimpleCov PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants