Run / Debug is Creating Jest Configuration instead of Mocha

For some reason now when I try to run one test, it's creating a Jest configuration instead of mocha.  I can't tell why that is.  How do I fix this?  I'm definitely running mocha tests.'

WebStorm 2021.1.1
Build #WS-211.7142.46, built on April 30, 2021


The logic used for determining what test runner is available for a given test file is based on dependencies declarations in package.json nearest to the current file.
Do you have mocha listed among project dependencies?

Note that if you have a single package.json, with both jest and mocha included, jest is preferred.

Related ticket:


Please do not tell me Jest is preferred. The community does not all prefer Jest and this is really pathetic for all to hop on some bagwagon to say that we should be using Jest. I know many who are trying to rid Jest in fact.  Mocha runs much faster than jest and a lot of people hate Jest because it's so slow.

To tell us a preferred runner especially from JetBrains saying we should be using one test runner vs another, you know better than to do that.  You're supposed to keep neutral here.


Dave Schinkel were you able to figure this out? I'm having the opposite issue where running tests uses a mocha configurations instead of jest


This is just frustrating, in our monorepo env I have a separate test utility package which requires jest, I just simply require our test-util package and run tests with that from cli. But some legacy tests, which cannot moved away yet, still depends on mocha, so I must list mocha in the application package. The result is webstorm fails to offer jest. This is just braindead. Instead of checking package.json it could simply check if mocha/jest/whatever can be found anywhere up in node_modules(fun fact, mocha and jest hoisted to the top, sit next to each other). Why can't I select the default test runner for a file when I run it first time? Sometimes the IDE tries to be way too smart, and fails. Just let me correct it at least.


Please sign in to leave a comment.