Skip to content

Commit 001d90a

Browse files
committed
Configure test coverage with Kover.
1 parent fbad7e3 commit 001d90a

File tree

2 files changed

+43
-12
lines changed

2 files changed

+43
-12
lines changed

gradle/build-logic/src/main/kotlin/conventions.kotest.gradle.kts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,34 @@ import org.gradle.kotlin.dsl.withType
44

55
plugins {
66
kotlin("jvm")
7+
id("org.jetbrains.kotlinx.kover")
78
}
89

9-
tasks.withType<Test>().configureEach {
10-
useJUnitPlatform()
10+
dependencies {
11+
testImplementation(libs.kotest.runner)
12+
testImplementation(libs.kotest.property)
13+
testImplementation(libs.kotest.assertions)
1114
}
1215

13-
dependencies {
14-
testImplementation(libs.bundles.kotest)
16+
kover {
17+
currentProject {
18+
sources {
19+
includedSourceSets = setOf("main")
20+
}
21+
}
22+
reports {
23+
total {
24+
html {
25+
onCheck = true
26+
charset = "UTF-8"
27+
}
28+
binary {
29+
onCheck = true
30+
}
31+
}
32+
}
33+
}
34+
35+
tasks.withType<Test>().configureEach {
36+
useJUnitPlatform()
1537
}

gradle/libs.versions.toml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
kotlin = "2.2.20" # https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib
33
kotest = "6.0.3" # https://mvnrepository.com/artifact/io.kotest/kotest-framework-engine
44

5+
bcv = "0.18.1" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx.binary-compatibility-validator/org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin
56
detekt = "1.23.8" # https://mvnrepository.com/artifact/io.gitlab.arturbosch.detekt/detekt-gradle-plugin
67
dokka = "2.1.0-Beta" # https://mvnrepository.com/artifact/org.jetbrains.dokka/dokka-gradle-plugin
7-
bcv = "0.18.1" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx.binary-compatibility-validator/org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin
8+
kover = "0.9.1" # https://mvnrepository.com/artifact/org.jetbrains.kotlinx.kover/org.jetbrains.kotlinx.kover.gradle.plugin
89
publishing = "0.34.0" # https://mvnrepository.com/artifact/com.vanniktech/gradle-maven-publish-plugin
910

1011
[libraries]
@@ -16,12 +17,20 @@ kotest-runner = { module = "io.kotest:kotest-runner-junit5", version.ref = "kote
1617
kotest-assertions = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest" }
1718
kotest-property = { module = "io.kotest:kotest-property", version.ref = "kotest" }
1819

19-
kotlin-plugin-jvm = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
20-
kotlin-plugin-bcv = { module = "org.jetbrains.kotlinx.binary-compatibility-validator:org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin", version.ref = "bcv" }
21-
detekt-plugin = { module = "io.gitlab.arturbosch.detekt:io.gitlab.arturbosch.detekt.gradle.plugin", version.ref = "detekt" }
22-
dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
23-
publishing-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "publishing" }
20+
gradlePluginDep-bcv = { module = "org.jetbrains.kotlinx.binary-compatibility-validator:org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin", version.ref = "bcv" }
21+
gradlePluginDep-detekt = { module = "io.gitlab.arturbosch.detekt:io.gitlab.arturbosch.detekt.gradle.plugin", version.ref = "detekt" }
22+
gradlePluginDep-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
23+
gradlePluginDep-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
24+
gradlePluginDep-kover = { module = "org.jetbrains.kotlinx:kover-gradle-plugin", version.ref = "kover" }
25+
gradlePluginDep-publishing = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "publishing" }
2426

2527
[bundles]
26-
kotest = [ "kotest-runner", "kotest-assertions", "kotest-property" ]
27-
gradlePlugins = [ "kotlin-plugin-jvm", "kotlin-plugin-bcv", "detekt-plugin", "dokka-plugin", "publishing-plugin" ]
28+
# Bundles all plugins needed in `buildLogic` so they can be imported in bulk.
29+
gradlePlugins = [
30+
"gradlePluginDep-bcv",
31+
"gradlePluginDep-detekt",
32+
"gradlePluginDep-dokka",
33+
"gradlePluginDep-kotlin",
34+
"gradlePluginDep-kover",
35+
"gradlePluginDep-publishing",
36+
]

0 commit comments

Comments
 (0)