Skip to content

Multiple engines requiring each other only show their own files in the reports #885

@mrcasals

Description

@mrcasals

Hi!

First of all, thank you all for your work! Simplecov is an awesome gem <3

Now for the downsides, I'm having some trouble configuring it in our Project. I'm working in Decidim (https://github.com/decidim/decidim), a platform to empower participatory democracy. It's actually a gem made of multiple gems (just like the rails gem does, it installs a bunch of gems). We're using a mono-repo approach to organize the code, each folder is a different gem. I've seen @deivid-rodriguez around, he's worked on the project too in the past 😄

In our case, we have a set of gems that build upon a central one (decidim-core). This means each gem uses code from decidim-core. Each gem has its own spec_helper.rb, although they all look almost the same. We configure SimpleCov through the .simplecov file in our root folder. We run the test suites individually through Github Actions. Our current setup runs each gem test suite independently in different workflows (and thus in different file systems), so only one test suite is run at a time. This is effectively the same (for testing purposes) as running a single test run in your machine. We're not mergint the test suite manually. Instead, this merging is done by Codecov.

Now, whenever I run the tests for one of the gems I'd expect the report to include files from the module and from decidim-core. For example, running the tests from decidim-proposals should include decidim-core files, but it doesn't. I'm playing around SimpleCov configurations in decidim/decidim#5934, but so far the reports only show files form the given module, no extra ones (even though I've set SimpleCov.root correctly). I've also tried the snippet in the README file to load files from engines, but without any luck.

Since we're exporting the coverage reports to Codecov, I'm using the simplecov-cobertura formatter, which is the one recommended in the Codecov docs. I've checked the internals of that gem and it doesn't seem to filter files, so I think the problem comes from a misconfiguration in our part.

If you'd like to check the test suite locally, these are the required steps:

  1. Clone the repo and cd into it
  2. bundle install
  3. bin/rake test_app
  4. CI=1 SIMPLECOV=true bin/rspec ./decidim-proposals/spec/system/proposals_spec.rb:50
  5. Check the coverage/coverage.xml file

This step I'm using is a system spec that checks a #show page for a resource. This page uses code from decidim-proposals and decidim-core, but if you check the coverage file you'll see how it only shows code from decidim-proposals.

Technical details:

  • Ruby 2.5.3p105
  • SimpleCov 0.18.5 (latest)
  • simplecov-cobertura 1.3.1 (latest)

PD: Feel free to change the issue title if you can come up with a better explanation! Also, ping me if something's not clear enough!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions