Skip to content

Does not respect excludeFiles/excludePackages #96

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

Closed
iansan5653 opened this issue Aug 5, 2021 · 3 comments
Closed

Does not respect excludeFiles/excludePackages #96

iansan5653 opened this issue Aug 5, 2021 · 3 comments

Comments

@iansan5653
Copy link

iansan5653 commented Aug 5, 2021

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.

@iansan5653
Copy link
Author

iansan5653 commented Aug 5, 2021

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.

@jozic
Copy link
Collaborator

jozic commented Dec 23, 2023

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

@jozic
Copy link
Collaborator

jozic commented Dec 28, 2023

@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.

@jozic jozic closed this as completed Dec 28, 2023
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

2 participants