You can prevent specific code from being instrumented or included in reports using regular expressions.
Supported Scala Versions: These options work for Scala 2, Scala 3.3.4+, and Scala 3.4.2+.
Exclude Packages/Classes
Use coverageExcludedPackages with a semicolon-separated list of regexes. Regexes are matched against the fully qualified class name and must match the entire string.
Exclude Files
Use coverageExcludedFiles with a semicolon-separated list of regexes. Note: Omit the .scala extension from filenames.
You can wrap code blocks in comments to exclude them from instrumentation:
// $COVERAGE-OFF$
... code to exclude ...
// $COVERAGE-ON$
// Exclude packages/classes
coverageExcludedPackages := "<empty>;Reverse.*;.*AuthService.*;models\\.data\\..*"
// Exclude files
coverageExcludedFiles := ".*\\/two\\/GoodCoverage;.*\\/three\\/.*"