https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

Brandon Saunders

11/07/2019, 7:45 PM
hi everyone, small, what feels like a newbie question. I'm looking into using kotlin multiplatform to build some libraries for android/ios and javascript. I'm getting stuck on the gradle JS setup for our unit tests though. It seems most docs online use kotlin2js for doing things like installing mocha and populating nodemodules, but adding the kotlin2JS module with the multiplatform module returns the following error
Cannot add extension with name 'kotlin', as there is an extension already registered with that name.
This link, https://youtrack.jetbrains.com/issue/KT-32137?_ga=2.97965660.2132659469.1572979841-1716587075.1572304917, seems to suggest that support docs for multiplatform JS gradle is getting updated. Does anyone know if this is still accessible (I can't seem to connect to it via slack) or has an example gradle file that uses multiplatform to trigger a mocha run? Thank you!
j

Jurriaan Mous

11/07/2019, 7:54 PM
Since Kotlin 1.3.40 this nodemodules populating and test setup is built in. Read more about it in the release blog. https://blog.jetbrains.com/kotlin/2019/06/kotlin-1-3-40-released/
Good to know: currently the IDE does not show the test results like the JVM. They are in the build/reports dir as HTML. To make test failures more apparant in Gradle you can use
Copy code
nodejs {
            testTask {
                testLogging {
                    events = ["FAILED", "SKIPPED"]
                }
            }
        }
This in IDE results is in progress and looks now to be scheduled for 1.3.70 https://youtrack.jetbrains.com/issue/KT-21625
b

Brandon Saunders

11/07/2019, 8:37 PM
ah awesome, thank you! This seems exactly what I needed.
2 Views