JaCoCo & Kotlin: Coverage on Generated Code
JaCoCo works flawlessly with Kotlin. Except when it reports lines not covered on generated code 😡. Fortunately there’s a fix already in place.
Update 08/26: JaCoCo 0.8.2 has now officially been released 👏 No need to use the 0.8.2-SNAPSHOT anymore.
What!? I didn’t even write those functions! There’s no way I’m writing tests for them. I’m pretty sure the compiler knows what it’s doing…
If you are like me, and can’t wait to get this working, you can use the SNAPSHOT version of JaCoCo making this changes on your
1 2 3 4 5 6 7 8
(I’m using Gradle with Kotlin DSL in this example)
Now you can finally take your Kotlin coverage to 100% without having to write tests for