I'm trying to run my Kotest `commonTest` on iOS, h...
# multiplatform
k
I'm trying to run my Kotest
commonTest
on iOS, however it doesn't look like any tests are run from the binary (
text.kexe
). Looking at the output from
$ ./gradlew iosX64Test --info
and running
xcrun
myself I get
Copy code
$ /usr/bin/xcrun simctl spawn --standalone A92077C5-F953-4646-8FEE-C0F0A0C84C8F /Users/kieran/my-library/build/bin/iosX64/debugTest/test.kexe
[==========] Running 0 tests from 0 test cases.
[----------] Global test environment set-up.
[----------] Global test environment tear-down
[==========] 0 tests from 0 test cases ran. (0 ms total)
[  PASSED  ] 0 tests.
It works find for the JVM. My Gradle looks like:
Copy code
kotlin {
    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
        }
        withJava()
        testRuns["test"].executionTask.configure {
            useJUnitPlatform()
        }
    }

    ios {
        binaries {
            framework {
                baseName = "MyLibrary"
            }
        }
    }

    sourceSets {
        commonMain {
            dependencies {
                api "io.arrow-kt:arrow-core:${rootProject.ext.arrowVersion}"
                api "io.arrow-kt:arrow-fx-coroutines:${rootProject.ext.arrowVersion}"
            }
        }

        commonTest {
            dependencies {
                implementation "io.kotest:kotest-framework-engine:${rootProject.ext.kotestVersion}"
                implementation "io.kotest:kotest-assertions-core:${rootProject.ext.kotestVersion}"
                implementation "io.kotest:kotest-property:${rootProject.ext.kotestVersion}"
                implementation "io.kotest.extensions:kotest-assertions-arrow:1.1.0.98-SNAPSHOT"
            }
        }

        iosMain {
            dependsOn(commonMain)
            iosX64Main.dependsOn(it)
            iosArm64Main.dependsOn(it)
        }

        iosTest {
            dependsOn(commonTest)
            iosX64Test.dependsOn(it)
            iosArm64Test.dependsOn(it)
        }

        jvmTest {
            dependencies {
                implementation "io.kotest:kotest-runner-junit5:${rootProject.ext.kotestVersion}"
            }
        }
    }
}
Am I missing something?
e
did you apply https://plugins.gradle.org/plugin/io.kotest.multiplatform? by default the Kotlin compiler performs its own test discovery in native and JS, which doesn't understand kotest. the plugin generates code to run the kotest runner instead of the compiler's generated runner
k
That was it. I read those instructions multiple times and I still missed it 🤦‍♂️
Thanks @ephemient 🙏