Skip to content

Commit

Permalink
Fix test related Gradle deprecation warnings (#936)
Browse files Browse the repository at this point in the history
The following deprecation warnings have been fixed:

> Task :common:jvmTest
The automatic loading of test framework implementation dependencies has
been deprecated. This is scheduled to be removed in Gradle 9.0. Declare
the desired test framework directly on the test suite or explicitly
declare the test framework implementation dependencies on the test's
runtime classpath. Consult the upgrading guide for further information:
https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#test_framework_implementation_dependencies

-> fixed by adding an explicit runtimeOnly dependency on
   org.junit.platform:junit-platform-launcher

> Task :core:live-tests:jvmTest
No test executed. This behavior has been deprecated. This will fail with
an error in Gradle 9.0. There are test sources present but no test was
executed. Please check your test configuration. Consult the upgrading
guide for further information:
https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#test_task_fail_on_no_test_executed

-> fixed by configuring Test tasks with useJUnitPlatform() in
   kord-internal-multiplatform-module (used by :core:live-tests)

org.gradle.warning.mode was set to all to verify that these deprecation
warnings are indeed fixed on CI.
  • Loading branch information
lukellmann authored Apr 13, 2024
1 parent 5989da6 commit 1d8d5e0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ kotlin {
}
}
}

tasks {
withType<Test>().configureEach {
useJUnitPlatform()
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ nextPlannedVersion=0.14.0
#dokka will run out of memory with the default meta space
org.gradle.jvmargs=-XX:MaxMetaspaceSize=1024m
org.gradle.parallel=true
org.gradle.warning.mode=all
org.gradle.kotlin.dsl.allWarningsAsErrors=true
kotlin.code.style=official

Expand Down
10 changes: 7 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ ksp = "1.9.22-1.0.17" # https://github.com/google/ksp
kotlinpoet = "1.16.0" # https://github.com/square/kotlinpoet

# tests
junit5 = "5.10.2" # https://github.com/junit-team/junit5
junit-jupiter = "5.10.2" # https://github.com/junit-team/junit5
junit-platform = "1.10.2"
mockk = "1.13.10" # https://github.com/mockk/mockk

# plugins
Expand Down Expand Up @@ -75,7 +76,9 @@ kotlin-test-annotations-common = { module = "org.jetbrains.kotlin:kotlin-test-an
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test-common", version.ref = "kotlin" }
kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref = "kotlin" }
kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit-jupiter" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit-jupiter" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version = "junit-platform" }
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }

Expand All @@ -95,7 +98,8 @@ ktor-client-serialization = ["ktor-client-content-negotiation", "ktor-serializat

test-common = ["kotlin-test-annotations-common", "kotlin-test", "kotlinx-coroutines-test"]
test-js = ["kotlin-test-js", "kotlin-node"]
test-jvm = ["kotlin-test-junit5", "junit-jupiter-engine", "slf4j-simple"]
test-jvm = ["kotlin-test-junit5", "junit-jupiter-api"]
test-jvm-runtime = ["junit-jupiter-engine", "junit-platform-launcher", "slf4j-simple"]

pluginsForBuildSrc = [
"kotlin-jvm-plugin",
Expand Down
1 change: 1 addition & 0 deletions test-kit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ kotlin {
jvmMain {
dependencies {
api(libs.bundles.test.jvm)
runtimeOnly(libs.bundles.test.jvm.runtime)
}
}
}
Expand Down

0 comments on commit 1d8d5e0

Please sign in to comment.