It appears that kotest does not yet support the Kotlin compiler's IR backend for JS. This is kotest issue 2037. If you configure the LEGACY compiler backend for your JS multiplatform settings, it should work.
Kotest's Quick Start documentation does actually cover multiplatform configuration when you select the rightmost tab ("Multiplatform") in each section.
These are the relevant sections from a build.gradle.kts
script which uses kotest with the IR backend on JVM along with the LEGACY backend on JS:
val kotestVersion = "4.4.1"
kotlin {
jvm("backend") {
compilations.all {
kotlinOptions.useIR = true
}
withJava()
}
js("frontend", LEGACY) {
browser {
binaries.executable()
testTask {
useKarma {
useChromeHeadless()
webpackConfig.cssSupport.enabled = true
}
}
}
}
sourceSets {
val commonTest by getting {
dependencies {
implementation("io.kotest:kotest-framework-engine:$kotestVersion")
implementation("io.kotest:kotest-assertions-core:$kotestVersion")
implementation("io.kotest:kotest-property:$kotestVersion")
}
}
val backendTest by getting {
dependencies {
implementation("io.kotest:kotest-runner-junit5:$kotestVersion")
}
}
}
}
tasks {
// Tests
withType<Test> {
useJUnitPlatform()
}
}