Skip to content
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

Coverage for inline functions producing flow is not working #734

Open
driessamyn opened this issue Feb 25, 2025 · 2 comments
Open

Coverage for inline functions producing flow is not working #734

driessamyn opened this issue Feb 25, 2025 · 2 comments
Assignees
Labels
Bug Bug issue type S: untriaged Status: issue reported but unprocessed

Comments

@driessamyn
Copy link

Describe the bug

Consider the following function:

inline fun flowTest(): Flow<Int> {
    return flow {
        for (i in range(1, 10)) {
            emit(i)
        }
    }
}

and the following test:

@Test
fun `flow test`() {
    runBlocking {
        flowTest().collect(::println)
    }
}

Full coverage is expected, confirmed by the println output from the test. However, Kover reports coverage as missing for this.

Errors

Image

Kover reports missing coverage

Expected behavior

Full coverage to be reported.

Reproducer

See code snippits above.
This is a reproduction of an issue in this code: https://sonarcloud.io/component_measures?metric=new_coverage&selected=driessamyn_kapper%3Acoroutines%2Fsrc%2Fmain%2Fkotlin%2Fnet%2Fsamyn%2Fkapper%2Fcoroutines%2FKapperKotlinFlowQueryFun.kt&view=list&pullRequest=85&id=driessamyn_kapper

Environment

  • Kover Gradle Plugin version: 0.9.1
  • Gradle version: Gradle 8.12
  • Kotlin project type: Kotlin/JVM
  • Coverage Toolset Kover
@driessamyn driessamyn added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Feb 25, 2025
@driessamyn
Copy link
Author

Confirmed that using the Jacoco coverage library also misses this coverage

Image

@shanshin
Copy link
Collaborator

Confirmed that using the Jacoco coverage library also misses this coverage

Recent versions of JaCoCo do not support inline functions.
A future release contains the necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: untriaged Status: issue reported but unprocessed
Projects
None yet
Development

No branches or pull requests

2 participants