Kotlin / kotlinx-kover

Apache License 2.0
1.25k stars 46 forks source link

Ignore module or task from kover #593

Closed igorromcy closed 1 month ago

igorromcy commented 1 month ago

Hi team!

I'm trying to ignore this whole module or this particular task from the kover execution but seems that I'm not doing that right.

error: 1 task failure the :testlab:kaptDebugKotlin task failed

my config:

kover {
    merge {
        allProjects()
        createVariant("coverage") {
            it.addWithDependencies(["fastDebug", "debug"] as String[], true)
        }
        instrumentation {
            excludedClasses.addAll(
                    "com.package.testlab"
            )
        }
    }
}

I also tried with

disabledForTestTasks.addAll(
    "kaptDebugKotlin"
)

and

disabledForTestTasks.addAll(
    ":testlab:kaptDebugKotlin"
)

but it didn't work, any ideas?

I'm using the 0.8.0-Beta version

shanshin commented 1 month ago

Hi, the kaptDebugKotlin task does not look like a Gradle test task. May you trace which task depends on it? Perhaps this is the task of compiling the source code for the debug Android build variant

igorromcy commented 1 month ago

That's right, but since I need to exclude this test lab module anyway, I did that by:

def ignoredModules = [ ":testlab", ":other:module" ]

kover { merge { allProjects { !ignoredModules.contains(it.path) } }

do you think there is another way to do that by using the excluded block?

shanshin commented 1 month ago

Filter in allProjects is the preferred way if you don't want classes from :testlab to be included in the report.