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

excludeFiles/excludedPackages is not working with scala code coverage report #134

Open
shaikhjishan37 opened this issue Jan 28, 2020 · 5 comments

Comments

@shaikhjishan37
Copy link

Hi,

I am trying to exclude some files from my code coverage reports
example for config:
scoverage {
excludedFiles = ['*Controller.scala']
excludedPackages = ['contoller.']
}

but this is not working.
can anyone help me pls.

@eyalroth
Copy link
Contributor

@shaikhjishan37
Copy link
Author

@eyalroth
i have tried many regex combination like
Controller
*Controller.scala
*/Controller.
/Controller.
*/Controller.scala
*/*Controller.scala
etc...

but none of them are excluding files which contains Controller in their name from my scoverage report

@eyalroth
Copy link
Contributor

I believe you need a regex, not a glob:

.*/Controller

Yes, this is quite confusing. I'm not really sure why this is the way it is.

@shaikhjishan37
Copy link
Author

I believe you need a regex, not a glob:

.*/Controller

Yes, this is quite confusing. I'm not really sure why this is the way it is.

Tried this one still i am getting those files in my coverage report :)

@eyalroth
Copy link
Contributor

eyalroth commented Feb 3, 2020

Are you running Gradle from Windows? If so, it seems that you need the regex to match Windows paths:

.*\\\\Controller

Or to make it cross-platform:

import java.util.regex.Pattern
scoverage {
  excludedFiles = ['.*' + Pattern.quote(File.separator) + 'Controller']
}

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