Wrong javascript test runner detected

It runs my tests using Jest framework when I click on the green arrows on the left gutter even though Jest is not a dependency in listed in package.json. The project has Karma and Mocha as dependencies listed in package.json and neither are being suggested as test runners.

Previously(don't know what happened), it was at least showing mocha as an option when clicking on the green arrow on the left gutter, but now it is not allowing me to pick the right runner.

I would expect it to show me Karma and Mocha as possible test runners but no Jest.

Is there any configuration that I can set to indicate which test runner should be used for each directory e.g. unit/e2e?

IntelliJ IDEA 2018.3.4 (Ultimate Edition)
Build #IU-183.5429.30, built on January 29, 2019
JRE: 1.8.0_152-release-1343-b26 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.20.11-arch2-1-ARCH

Comment actions Permalink

Please can you provide your package.json?

Comment actions Permalink
Hi Elena, thanks for your response.

The relevant section of package.json is below:

"dependencies": {
"animate.css": "^3.7.0",
"autonumeric": "^4.5.4",
"axios": "^0.18.0",
"jquery": "^3.3.1",
"lodash-es": "^4.17.11",
"moment": "^2.24.0",
"pdfjs-dist": "^1.10.100",
"pubsub-js": "^1.7.0",
"quasar-framework": "^0.17.19",
"register-service-worker": "^1.5.2",
"vue": "^2.5.22",
"vue-class-component": "^6.3.2",
"vue-property-decorator": "^7.3.0",
"vue-router": "^3.0.2"
"devDependencies": {
"@mdi/svg": "^3.4.93",
"@types/lodash": "^4.14.120",
"@types/mocha": "^5.2.4",
"@types/node-fetch": "^2.1.4",
"@types/power-assert": "^1.5.0",
"@types/pubsub-js": "^1.5.18",
"@types/selenium-webdriver": "^3.0.14",
"@vue/cli-plugin-babel": "^3.3.0",
"@vue/cli-plugin-pwa": "^3.3.0",
"@vue/cli-plugin-typescript": "^3.3.0",
"@vue/cli-service": "^3.3.0",
"@vue/test-utils": "^1.0.0-beta.28",
"babel-plugin-transform-imports": "^1.5.1",
"chromedriver": "^2.46.0",
"connect-history-api-fallback": "^1.6.0",
"cross-env": "^5.2.0",
"espower-typescript": "^9.0.1",
"grunt": "^1.0.3",
"grunt-webfont": "^1.7.2",
"install-local": "^0.6.2",
"istanbul-instrumenter-loader": "^3.0.1",
"karma": "^3.1.4",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.4",
"karma-junit-reporter": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-parallel": "^0.2.9",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.0-rc.5",
"lint-staged": "^6.0.0",
"mocha": "^5.2.0",
"mocha-loader": "^2.0.0",
"mocha-parallel-tests": "^2.0.6-alpha.3",
"mocha-typescript": "^1.1.17",
"mockttp": "^0.11.0",
"node-fetch": "^2.3.0",
"node-sass": "^4.11.0",
"pem": "^1.14.1",
"power-assert": "^1.6.1",
"sass-loader": "^7.1.0",
"script-loader": "^0.7.2",
"selenium-webdriver": "^3.6.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"ts-node": "^7.0.0",
"tsconfig-paths": "^3.8.0",
"typescript": "^3.3.1",
"uglifyjs-webpack-plugin": "^2.1.1",
"vue-cli-plugin-quasar": "^0.17.1",
"vue-template-compiler": "^2.5.22",
"vue-template-loader": "^1.0.0",
"webapp-webpack-plugin": "^2.5.0",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14",
"webpack-espower-loader": "^2.0.0"

I switched back to master and the option to run as Mocha appears again. I then reset my branch where the problem is happening to be the same as master and the problem still happens. I tried switching back to master again and when it shown the message "Workspace associated with branch 'master´ has been restored",  I've pressed Rollback and the problem is happening when master branch is checkout. It suggests it is something configured in my workspace?


Comment actions Permalink

It seems to try to use Jest because of the @vue/cli-service dependency. We are not using the Vue cli unit testing plugins. I also tried to add cli-plugin-unit-mocha as a dependency in package.json and it still tries to run it as a Jest test. It seems to be incorrectly inferring the test runner based on the @vue/cli-service instead of the actual unit test plugins dependencies: @vue/cli-plugin-unit-mocha and @vue/cli-plugin-unit-jest.

Given that I have mocha(e2e tests), karma(unit tests) and @vue/cli-service(Jest) as dependencies, I should be able to pick which one to use, which seems to happen sometimes but it's not clear what I need to do in order to be able to pick the one that should be used when clicking on the green arrow. Ideally I would like to specify which runner to use based on the folder. Is this possible?

Comment actions Permalink

yes, @vue/cli-service is the culprit... Related ticket: https://youtrack.jetbrains.com/issue/WEB-34938


>Ideally I would like to specify which runner to use based on the folder. Is this possible?


No, not currently possible:( Please vote for https://youtrack.jetbrains.com/issue/WEB-28397 to be notified on any progress with this feature

Comment actions Permalink

Thank you for the pointers - very helpful.


Please sign in to leave a comment.