Is it possible to use `kotest` in a Kotlin Multipl...
# kotest
j
Is it possible to use
kotest
in a Kotlin Multiplatform Mobile project? I have included the following dependencies in the shared project:
Copy code
val kotestVersion = "4.4.0"
kotlin {
    sourceSets {
        val commonTest by getting {
            dependencies {
                implementation("io.kotest:kotest-runner-junit5:$kotestVersion")
                implementation("io.kotest:kotest-assertions-core:$kotestVersion")
                implementation("io.kotest:kotest-property:$kotestVersion")
            }
        }
    }
}
but this fails when trying to build the project because there is no
ios_x64
variant of
kotest-runner-junit5
. Android Studio fails while reloading the project trying to find
kotest-runner-junit5-4.4.0-samplessources.jar
and
./gradlew build
explicitly fails due to the missing
ios_x64
variant not found.
t
junit is jvm only I think. other than that, I did not try kotest in multiplatform so cannot help more
j
yes, I've been googling about this and you are right,
kotest-runner-junit5
is jvm only 😞
m
This requires native support to make framework work. You can use assertions and property testing though. https://github.com/kotest/kotest/issues/1743
j
Ok, but then I guess you lose the possibility of writing tests using the styles provided by
kotest
and you must stick to Kotlin Test style using
@Test
annotation, am I right? https://kotlinlang.org/docs/mpp-run-tests.html#test-shared-code
m
Yes, that’s what kotest framework provides. Specification style testing.
j
ok, thank you very much!
s
Kotest framework works on javascript too.