我正在尝试改进我的项目中的代码覆盖率,并希望排除任何View
类(因为它们未经测试/可测试)但包含任何ViewModel
类......但我似乎无法让通配符过滤器合作,这就是全部或者什么都没有!
def excludedPatterns = [
//... other stuff
'**/*Fragment*.*',
'**/*Activity*.*',
'**/*Adapter*.*',
'**/*View*.*', // <-- this line is excluding classes ending w/ ViewModel
'**/*ViewState*.*',
'**/*ViewHolder*.*',
]
task codeCoverageReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
html.enabled true
}
def debugTree = fileTree(
dir: "$project.buildDir/tmp/kotlin-classes/debug",
excludes: excludedPatterns
)
classDirectories.from = files([debugTree])
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories.from = files([mainSrc])
executionData.from = fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec',
'outputs/code-coverage/connected/*coverage.ec'
])
}
我已经尝试了几种变体**/*View*.*'
,包括**/*View.*'
和其他...有什么我忽略的吗?