Configure jvmTest to use the JUnit Platform in kmp-module#724
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the kmp-module convention plugin to ensure JVM tests in Kotlin Multiplatform modules are executed on the JUnit Platform and receive the standard shared test logging configuration, closing a gap where JUnit 5 / Kotest tests could be silently undiscovered.
Changes:
- Configure the
jvmTestGradleTesttask withuseJUnitPlatform(). - Apply shared test logging via
configureLogging()tojvmTest. - Document why
module-testingcan’t be applied and why no engine filter is used (to avoid excluding Kotest’s JUnit Platform engine).
armiol
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Configure the
jvmTesttask in thekmp-moduleconvention plugin to run onthe JUnit Platform (
useJUnitPlatform()) and to apply the shared test-loggingsetup (
configureLogging()).Why
The
kmp-moduleconvention never appliedmodule-testing, and it could not:module-testingbrings thejava-libraryplugin, which conflicts with theKotlin Multiplatform plugin
kmp-moduleis built on. As a result the KMPjvmTesttask was left withoutuseJUnitPlatform().Without it, Gradle falls back to the legacy JUnit-4 test detector, which
discovers none of a module's JUnit 5 / Kotest
*Spec.ktclasses. A testtask that discovers nothing still passes — so, for example, the core logging
module's
jvmTestreported success in ~1 s while running zero of its 13*Spec.ktsuites. This silent gap was being worked around module-locally inconsumer repositories (e.g. an
otel-backenduseJUnitPlatform()block); theproper fix belongs in the shared convention here, which also lets those local
workarounds be deleted.
How
Mirror
module-testing'stest-task configuration onto KMP'sjvmTesttask:Unlike
module-testing, noincludeEngines("junit-jupiter")filter isimposed: KMP test dependencies include
Kotest.runnerJUnit5Jvm, a JUnitPlatform engine of its own, and filtering to Jupiter alone would silently drop
Kotest-native tests — re-creating the bug in a subtler form. This rationale is
captured in the task block's KDoc.
Verification
./gradlew -p buildSrc build— PASS (compile,validatePlugins, andbuildSrctests all green under JDK 17).spine-code-review,kotlin-engineer,review-docs) — allAPPROVE, no Must-fix / Should-fix.
🤖 Generated with Claude Code