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.
Samuel Cook
10/11/2019, 10:18 PM
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
Alexey Belkov [JB]
10/14/2019, 12:00 PM
Make sure you have NodeJS plugin installed and you delegate build/run actions to Gradle in IDE Gradle settings.
s
Samuel Cook
10/15/2019, 5:17 PM
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.
Samuel Cook
10/15/2019, 5:22 PM
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.
Samuel Cook
10/15/2019, 5:28 PM
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.