Thread
#multiplatform
    Jurriaan Mous

    Jurriaan Mous

    3 years ago
    Is there a working example with in IDE running tests for macOS and JS? When I upgrade my multiplatform project to 1.3.40 the tests suddenly don't run except in the JVM. Also in a default IDE kotlin multiplatform project they don't run. I have Intellij IDEA Ultimate 2019.1.3
    I see for macOS a test.kexe which runs on its own but I don't see any output in the output or IDE.
    louiscad

    louiscad

    3 years ago
    @Jurriaan Mous Are you using the new API for Kotlin/Native tests in the Gradle plugin for updated in 1.3.40? It's mentioned in the blogpost.
    Jurriaan Mous

    Jurriaan Mous

    3 years ago
    Yes:
    kotlin.macosX64 {
        binaries {
            test("integration") {
                /* configuration if needed */
            }
        }
    }
    louiscad

    louiscad

    3 years ago
    In that case, I'd report it on kotl.in/issue
    Jurriaan Mous

    Jurriaan Mous

    3 years ago
    I have reported two issues: https://youtrack.jetbrains.com/issue/KT-32110 https://youtrack.jetbrains.com/issue/KT-32111 I still hope there is a working example somewhere
    snrostov

    snrostov

    3 years ago
    Test reporting in IDE is not supported yet. I guess in your case it is just not reported in IDE by still executes. You can check
    build/reports/tests
    for test results, or add this lines to check that tests are actually running:
    import org.gradle.api.tasks.testing.logging.*
    
    ...
    
    js {
            nodejs {
                testTask {
                    testLogging {
                       events = [TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STARTED]
                    }
                }
            }
        }
    And same for all other test js and native test tasks. https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.logging.TestLogging.html
    Jurriaan Mous

    Jurriaan Mous

    3 years ago
    Ah thanks! I was heavily reliant on the feedback by the gradle tasks in the console for non JVM builds. Somehow reading the blog post I expected now the same feedback as JVM in the IDE. Or at least some feedback in console like before. One thing is still unclear: How do you add it to the native build? I have tried some variants of the definition below: (The target gradle structure is still not entirely clear for me since I for now worked mostly with examples)
    macosX64("macos") {
            testTask {
                testLogging {
                    events = [TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STARTED]
                }
            }
        }
    snrostov

    snrostov

    3 years ago
    @ilya.matveev please help
    @Jurriaan Mous This should work:
    macosX64 {
            tasks.getByName(targetName + "Test").testLogging {
                events "FAILED", "PASSED", "SKIPPED", "STARTED"
            }
        }
    (and just turns out that
    events "FAILED", "PASSED", "SKIPPED", "STARTED"
    should work for js too)
    Jurriaan Mous

    Jurriaan Mous

    3 years ago
    Ah cool! Thanks! And good to know it can be done by String. Saves an import.