如何忽略 gradle scoverage 覆盖率报告中的某些 class 路径?

How to ignore some class path from gradle scoverage coverage reports?

如何在 Gradle Scoverage 中配置 testScoverage 任务以从测试覆盖范围中排除一些 class。在 sbt scoverage 中可以通过添加设置来实现 coverageExcludedPackages := ";Reverse.*;.AuthService.;models\.data\..* 如何在 gradle scoverage

中实现同样的效果

本插件中没有描述documentation, but this plugin exposes a Gradle extension named scoverage of type ScoverageExtension that you can use to configure the plugin, see available properties in the extension source code

您可以如下配置排除包,例如:

scoverage{
    excludedPackages = ["Reverse.*",".AuthService." , "models.data"]
      // TODO : configure patterns correctly, this is only a dummy example
}

注意:我没有亲自测试这个插件,但是查看源代码,它应该是这样工作的。