Is it possible to run those javascript unit tests ...
# javascript
j
Is it possible to run those javascript unit tests from the gutter run icons? For me they keep saying “Nothing here” while they run all together with Jest in gradle.
b
In general yes, but many some things depends on JS framework that you are using
What version of IDEA and Kotlin plugin are you using?
j
Thanks for the reply! Good to know it should be supported with the right setup. All the JS code is Kotlin and I chose Jest because I had some experience with that. I used the Jest example in the mentioned thread: https://github.com/JetBrains/kotlin-examples/tree/master/gradle/js-tests/jest. The tests run in Jest and Gradle but the gutter does not pick them up. I tried both in a Kotlin JS only project and a multiplatform JS module. Versions: IntelliJ IDEA 2017.3 (Ultimate Edition) Build #IU-173.3727.127, built on November 27, 2017 Kotlin plugin: Version: 1.2.0-release-IJ2017.3-1
b
cc @anton.bannykh @alexey.sedunov
a
Here is what I found. It seems that the testing framework is detected based on package.json contents in the root folder. I was able to run the tests using the gutter icon with mocha by creating an appropriate dummy package.json. Unfortunately this trick just wouldn't work with jest for some reason. 😞 Unless I am missing something it seems that for the time being running tests with jest from the gutter icons is not possible =(
The package.json:
Copy code
{
  "name": "mocha-sample",
  "devDependencies": {
    "mocha": "^3.5.3"
  },
  "scripts": {
    "test": "mocha"
  }
}
a
Currently Kotlin plugin doesn't support automatic creation of run configurations for Jest
Supported frameworks are Mocha (which requires NodeJS IDEA plugin and appropriate package.json as shown above) and Protractor (doesn't need package.json, but can run entire module only, not individual test classes/methods)
a
j
Then I will use mocha for now. Thanks! 😄