Does not respect excludeFiles/excludePackages
iansan5653 opened this issue · 3 comments
I'm using scoverage.maven.plugin
1.4.0-M5
, Scala 2.11.12
.
I'd like to exclude my service declaration files from coverage reports because they don't contain testable logic. This seems simple, but I can't get the scoverage plugin to ignore the files or classes.
All of the service classes are named like HomeService
, NotificationService
, etc. And they are all in a package under com.intermediate_packages.service
.
I'm generating the coverage report by running mvn clean scoverage:report
. I've also tried deleting the target
folder in case some leftover file is still being read. No luck there either.
My pom for the plugin looks like:
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage.maven.plugin</artifactId>
<configuration>
<!-- CONFIGURATION -->
</configuration>
</plugin>
Where I've tried all of the following for CONFIGURATION
:
<excludedFiles>.*Service.*</excludedFiles>
<excludedPackages>.*service.*</excludedPackages>
<excludedFiles>.*Service\.scala</excludedFiles>
<excludedPackages>.*Service</excludedPackages>
And even just as a sanity check I tried this, which also had absolutely no effect:
<excludedFiles>.*</excludedFiles>
<excludedPackages>.*</excludedPackages>
No matter what, it always says I have 26.05% statement coverage and lists the service files in the report index.html
.
I also tried running mvn clean scoverage:check
with configuration:
<minimumCoverage>80</minimumCoverage>
<failOnMinimumCoverage>true</failOnMinimumCoverage>
And it did fail, so I know that the plugin configuration is at least being read.
Hey @iansan5653 could you please create a simple project to reproduce the issue if it's still relevant?
Just for the record, I myself do use exclusion using 1.4.11 and 2.0.0 and it works
@iansan5653
I've added integration tests for different ways to exclude code from coverage check/report in #180
All tests pass for Scala 2.13 (i believe they pass for 2.12 as well). Scala 3 doesn't support it yet though.
Please reopen with more details or better create a post in Discussions if you still need help.