我正在尝试在KMM项目的shared
模块中编写测试。在共享模块的 build.gradle.kts 文件中,我有以下内容:
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
//TODO: Hamcrest
//implementation("junit:junit:4.12")
//implementation("org.hamcrest:hamcrest-library:1.3")
//TODO: Mockk
//implementation("io.mockk:mockk:1.10.4")
}
}
//...
}
我也试过:
implementation(kotlin("[library]"))
结果相同:IDE 不再识别测试,我无法运行它们。