I’m using the kotlin-js plugin and the kotlin-test...
# intellij
s
I’m using the kotlin-js plugin and the kotlin-test-js library. How do I run individual unit tests from within IntelliJ IDEA Ultimate? The tests run just fine from Gradle.
I’m expecting a run ▶️ icon to appear in the LHS gutter, but there’s nothing there. There’s also no option to run tests from the context menu for the file, nor from the Run top menu.
a
Make sure you have NodeJS plugin installed and you delegate build/run actions to Gradle in IDE Gradle settings.
s
I have that plugin installed, and already have Build and run using: Gradle (Default) and Gradle JVM: Gradle (Default). The IDE doesn’t seem to recognise that the .kt class maps to the compiled .js file.
I can build the project via Build > Build Project, and then set up a new Mocha Build Configuration to run the tests in the compiled build/js/packages/…/ which runs the tests.
but I can’t run the tests directly from the .kt class. And the Mocha test runner doesn’t map back to the .kt class, for example clicking the stacktrace in a failed assertion navigates to the compiled .js file.