Skip to content

Kover does not correctly report coverage for inline functions #753

@driessamyn

Description

@driessamyn

Describe the bug

Following from #729, I tried to move my project to use the JaCoCo runner and see that coverage is not correctly reported for inline functions.

I reproduced this in a stand-alone example: https://github.com/driessamyn/kotlin-coverage-bugs/tree/kover

I tried this as an extension function and a "regular" function as I thought the issue may be related to it being an extension function, but both report 0% coverage.

I reported this to the JaCoCo project, but the suggestion from the team is that this should be handled by the kover plugin:

as of today Gradle plugin does not analyze test classes and so does not analyze call sites in test files.
We plan to improve this in Maven plugin - see jacoco/jacoco#1689
And something similar has to be done in third-party integrations not developed by us such as Gradle plugin.
As well as in any other third-party integrations such as Kover.

Errors

Code in example/src/main/kotlin/InlineFun.kt should be reported as covered by the tests in example/src/test/kotlin/InlineExtensionFunTest.kt and example/src/test/kotlin/InlineFunTest.kt however the report shows 0% coverage.

Expected behavior

Expected coverage to be reported.

Reproducer

Reports

Image

Environment

  • Kover Gradle Plugin version: 0.9.1
  • Gradle version: 8.12
  • Kotlin project type: Kotlin/JVM
  • Coverage Toolset (if customized in build script): JaCoCo("0.8.13")
  • Other context important for this bug: MacOS

Please let me know if I can help resolve this.

Metadata

Metadata

Assignees

Labels

BugBug issue typeS: in progressStatus: implementing or design in process

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions