我一直在尝试在kotlin多平台项目中设置kotest。在kotest入门指南上,它说要将此依赖项添加到commonTest
implementation 'io.kotest:kotest-framework-engine:$version'不幸的是,这不能解决
Could not resolve io.kotest:kotest-framework-engine:4.4.1.
Required by:
project :**strong text**如果仅将此依赖项添加到jvmTest它会解决的。我找不到任何指南来为多平台设置kotest。
发布于 2021-02-25 23:15:55
看起来kotest还不支持Kotlin编译器针对JS的IR后端。这是kotest issue 2037..。如果您为您的JS多平台设置配置了传统编译器后端,它应该可以工作。
Kotest's快速Start](https://kotest.io/docs/quickstart) 当您在每个部分中选择最右侧的选项卡(“多平台”)时,文档实际上涵盖了多平台配置。
这些是来自build.gradle.kts将kotest与JVM上的IR后端以及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 {
useJUnitPlatform()
}
}https://stackoverflow.com/questions/66352525
复制相似问题