https://kotlinlang.org logo
j

Jurriaan Mous

06/20/2019, 9:06 AM
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.
l

louiscad

06/20/2019, 11:47 AM
@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.
j

Jurriaan Mous

06/20/2019, 11:48 AM
Yes:
Copy code
kotlin.macosX64 {
    binaries {
        test("integration") {
            /* configuration if needed */
        }
    }
}
l

louiscad

06/20/2019, 11:48 AM
In that case, I'd report it on kotl.in/issue
j

Jurriaan Mous

06/20/2019, 12:05 PM
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
👍🏽 1
s

snrostov

06/21/2019, 5:58 AM
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:
Copy code
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
j

Jurriaan Mous

06/21/2019, 6:45 AM
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)
Copy code
macosX64("macos") {
        testTask {
            testLogging {
                events = [TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.STARTED]
            }
        }
    }
s

snrostov

06/21/2019, 7:02 AM
@ilya.matveev please help
@Jurriaan Mous This should work:
Copy code
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)
j

Jurriaan Mous

06/21/2019, 7:49 AM
Ah cool! Thanks! And good to know it can be done by String. Saves an import.
8 Views