Switch to platform-agnostic kotlin-test coordinates - #39
Conversation
hfhbd
commented
Feb 8, 2023
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/ |
JakeWharton
commented
Feb 9, 2023
The default is JUnit 4. I've never had to specify. Also... I have no memory of this PR... |
hfhbd
commented
Feb 9, 2023
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. |
JakeWharton
commented
Feb 21, 2023
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. |
hfhbd
commented
Feb 21, 2023
Oh, you are right, the module file should resolve it based on the Gradle attributes for the variant I think, I found the reason, it is not only one single multiplatform target but the combination with 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
} |
Did this from the web UI. Will it work?