-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin test coverage not reported for Java production code with JaCoCo #530
Comments
Hi,
|
Is this a multi-module project? |
The component in question has just one module, the app module. The convention plugin is applied on the app module level. |
Could you please provide a reproducer project? |
Here it is: https://github.com/realdadfish/kover-issue-530/tree/main It seems to be triggered by Robolectric on the test classpath. If I have two regular Java/Kotlin unit tests, both execute fine and the coverage shows that both methods are covered. If I let each test run with the Robolectric runner, neither test shows coverage on the class with JaCoCo, but both tests show coverage with the built-in coverage tool |
… reports It seems that after Robolectric instrumentation, source locations are lost and JaCoCo does not instrument such classes by default. There is a need to change the flag to disable this behavior. After changing this flag, errors occur in the instrumentation of JVM classes (because they were previously excluded due to the lack of sources). The package with these classes was determined empirically. Fixes #530
… reports It seems that after Robolectric instrumentation, source locations are lost and JaCoCo does not instrument such classes by default. There is a need to change the flag to disable this behavior. After changing this flag, errors occur in the instrumentation of JVM classes (because they were previously excluded due to the lack of sources). The package with these classes was determined empirically. Fixes #530 PR #541
Many thanks! |
Fixed in |
This is my configuration:
Now I have separate Kotlin and Java source sets for my mixed-language module configured, i.e.
src/{main,test}/{kotlin,java}
and I have a Kotlin test that tests various Java source files. With the above configuration the coverage for these Java source files is reported as 0, even if I move the test fromsrc/test/kotlin
tosrc/test/java
, however, if I comment outuseJacoco
above and let the IJ coverage processor do it's thing, the coverage of the classes in question is properly reported.Environment
The text was updated successfully, but these errors were encountered: