byteunits
byteunits copied to clipboard
Switch to platform-agnostic kotlin-test coordinates
Did this from the web UI. Will it work?
Nope, there is no jvm only Test annotation, you need to choose a jvm test framework: https://kotlinlang.org/api/latest/kotlin.test/kotlin.test/-test/
The default is JUnit 4. I've never had to specify. Also... I have no memory of this PR...
Yeah, the default test framework used by Gradle is JUnit 4. Gradle needs to start the test framework as well as parsing the results, so you have to specify the framework (or use the default). But the chosen test framework is not passed to the dependency management. So you have to choose a dependency for the jvm.
I've never had to do that except like five years ago before they merged all the multiplatform stuff into single modules. I suspect it's due to being multiplatform with only a single target.
Oh, you are right, the module file should resolve it based on the Gradle attributes for the variantjunitRuntimeVariant
.
I think, I found the reason, it is not only one single multiplatform target but the combination with withJava
. By default, there is no "testImplementation" using multiplatform only, there is a commonTestImplementation
. But with withJava
this configuration is created, but it is a java configuration only (the kotlin jvm) configuration would be jvmTestImplementation
.
But now a kotlin mpp artifact is added to a jvm configuration only and the automatic resolvment of kotlin-test-junit does not work.
plugins {
java
}
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
}
tasks.test {
useJUnit() // has no effect
}