Minimal multiplatform sample (just need to get javascript portion working)


For the project here:

I am trying to demonstrate refactoring duplicate, platform independent code into a common module, leaving regular modules for a very minimal set of platform dependent code. It looks like with the latest IntelliJ idea, this mostly works out of the box, but I notice that the while the JVM tests run fine, the JavaScript tests do not. I have looked at some examples online of getting javascript tests to run, but they all either seem much more complicated than they need to be, or do not run at all with the “gradle test” command.

Can someone point me in the right direction to get this project minimally set up to run JavaScript tests? I think this would be a huge selling point to convince others to use Kotlin, and I don’t want to overwhelm people with any more complexity than absolutely necessary.

I have already read through and didn’t see any steps I missed.


I have an example project where the JavaScript implementation of the common module runs both common and JavaScript-specific tests:

Run ./gradlew :js:test and check the console.


This looks like exactly what I was looking for, thanks for putting this together. Just out of curiosity, what is the rational for splitting the js and js-app modules, and also the jvm and jvm-app modules. Using the terminology at , is it that one is a “platform” module and the other is a “regular” module?


Yes, that is the difference.

But the point of splitting them was to show how a regular module can use a platform module as a library.