Kotlin / kotlinx-kover

Apache License 2.0
1.37k stars 53 forks source link

Ability to instrument only permitted classes #673

Closed LlamaLad7 closed 2 months ago

LlamaLad7 commented 3 months ago

What is your use-case and why do you need this feature? In the Kotlin compiler, there are a lot of tests which consider all the fields of a generated class, e.g. here, and because they use classfile version 52 (Java 8), the coverage agent adds a field to the class which breaks the test:

Fail: lambda should only capture 's': [final java.lang.String A$f$1.$s, private static transient boolean[] A$f$1.__$hits$__]

Describe the solution you'd like Ideally I would be able to whitelist the specific compiler classes I am interested in instead of having to blacklist the offending test classes. Something like:

kover {
    currentProject {
        instrumentation {
            includedClasses.add("org.jetbrains.kotlin.fir.*")
        }
    }
}

to match the existing excludedClasses option.

LlamaLad7 commented 3 months ago

Alternative for my particular use case: https://github.com/JetBrains/intellij-coverage/pull/64

shanshin commented 2 months ago

Resolved in 0.9.0-RC