Skip to content

Avoiding coverage shadowing between modules #419

Open
@vlfig

Description

@vlfig

Hi,

In a multi-module build we can have a situation where one module's tests exercise code paths of another module it depends on. If we're not careful, this could shadow uncovered code in the depended module, depending on the relative order of their tests in CI.

Let's say,

  1. a depends on b;
  2. we test a then b;
  3. testing a exercises a code path in b which b does not exercise by itself;
  4. coverage report for b will indicate that code path as covered.

If we're strict about the modules' interfaces, we'd want their coverage to be guaranteed by their own tests, not their dependents'.

Running rm b/target/scala-2.13/scoverage-data/scoverage.measurements* between test invocations seems to do the job, but I wondered if an Sbt Task wouldn't be more appropriate or even if there was a way to avoid writing those measurements to dependencies' $coverageDataDir in the first place.

Thank you

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