Skip to content

Commit 39c0318

Browse files
committed
Tweak Kover: improve coverage, disable deprecations, add missing test in slf4j
Addresses #3156
1 parent 3e7466a commit 39c0318

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

buildSrc/src/main/kotlin/kover-conventions.gradle.kts

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ val expectedCoverage = mutableMapOf(
1616

1717
// TODO figure it out, these probably should be fixed
1818
"kotlinx-coroutines-debug" to 84,
19-
"kotlinx-coroutines-reactive" to 65,
19+
// Re-evaluate this along with Kover update where deprecated with error+ functions are not considered as uncovered: IDEA-287459
2020
"kotlinx-coroutines-reactor" to 65,
21-
"kotlinx-coroutines-rx2" to 78,
22-
"kotlinx-coroutines-slf4j" to 81
21+
"kotlinx-coroutines-rx2" to 78
2322
)
2423

2524
extensions.configure<KoverExtension> {
@@ -51,4 +50,8 @@ subprojects {
5150
}
5251
}
5352
}
53+
54+
tasks.withType<KoverHtmlReportTask> {
55+
htmlReportDir.set(file(rootProject.buildDir.toString() + "/kover/" + project.name + "/html"))
56+
}
5457
}

integration/kotlinx-coroutines-slf4j/test/MDCContextTest.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ class MDCContextTest : TestBase() {
102102
val mainDispatcher = kotlin.coroutines.coroutineContext[ContinuationInterceptor]!!
103103
withContext(Dispatchers.Default + MDCContext()) {
104104
assertEquals("myValue", MDC.get("myKey"))
105+
assertEquals("myValue", coroutineContext[MDCContext]?.contextMap?.get("myKey"))
105106
withContext(mainDispatcher) {
106107
assertEquals("myValue", MDC.get("myKey"))
107108
}
108109
}
109110
}
110-
}
111+
}

reactive/kotlinx-coroutines-reactive/build.gradle.kts

+14
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,17 @@ tasks.check {
3434
externalDocumentationLink(
3535
url = "https://www.reactive-streams.org/reactive-streams-$reactiveStreamsVersion-javadoc/"
3636
)
37+
38+
val commonKoverExcludes = listOf(
39+
"kotlinx.coroutines.reactive.FlowKt", // Deprecated
40+
"kotlinx.coroutines.reactive.FlowKt__MigrationKt", // Deprecated
41+
"kotlinx.coroutines.reactive.ConvertKt" // Deprecated
42+
)
43+
44+
tasks.koverHtmlReport {
45+
excludes = commonKoverExcludes
46+
}
47+
48+
tasks.koverVerify {
49+
excludes = commonKoverExcludes
50+
}

reactive/kotlinx-coroutines-reactor/build.gradle.kts

+12
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,15 @@ tasks {
2727
externalDocumentationLink(
2828
url = "https://projectreactor.io/docs/core/$reactorVersion/api/"
2929
)
30+
31+
val commonKoverExcludes = listOf(
32+
"kotlinx.coroutines.reactor.FlowKt" // Deprecated
33+
)
34+
35+
tasks.koverHtmlReport {
36+
excludes = commonKoverExcludes
37+
}
38+
39+
tasks.koverVerify {
40+
excludes = commonKoverExcludes
41+
}

0 commit comments

Comments
 (0)