Seeing an inconsistent issue with initialising Koin when running iosX64 tests on a multiplatform project.
I see get the following error when I run the entire suite of tests
kotlin.IllegalStateException: KoinApplication has not been started
. When I run the test individual the test passes as expected.
For context each of my test classes extends implements this abstract class:
abstract class KoinTest : KoinComponent {
@BeforeTest
fun beforeTest() {
println("Starting Koin")
startKoin {
printLogger(Level.ERROR)
modules(
module {
single { Log(testing = useMocks) }
},
)
}
}
@AfterTest
fun after() {
stopKoin()
}
}
From my build.gradle
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
classpath("com.android.tools.build:gradle:7.0.4")
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation("io.kotest:kotest-assertions-core:5.0.1")
implementation("io.kotest:kotest-framework-engine:5.0.1")
implementation("app.cash.turbine:turbine:0.7.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt")
implementation("io.insert-koin:koin-core:3.1.5")
}
}
Has anyone come across any similar issues?