Run test gutter icons when jest is not an immediate dependancy

I'm trying to configure my Run configurations to use an external jest dependency. The setup is done from a fork of create-react-app.

If I create an app from `create-react-app` and open the default app test, I can see the run gutter icons. After running that test, I get a run config. Editing that config I can see that it's jest package is pointing to `node_modules/react-scripts`. All good.

However, for our forked version of `create-react-app` if I point to the same directory, I still don't get the gutter icons. Obviously there is a config change to our version that has moved something and webstorm is no longer able to detect the jest config. Also the path is now: `node_modules/@scope/our-company-scripts`

I can see in the jest config docs (https://www.jetbrains.com/help/webstorm/running-unit-tests-on-jest.html#ws_jest_running_tests), that it makes particular mention of: jest, react-scripts, react-script-ts, react-super-scripts, or react-awesome-scripts.

So my questions are:
Are the listed configs the only ones allowed?
Has anybody done something similar to get this working?
What is webstorm looking for - the jest.config.js or some other path?

1 comment
Comment actions Permalink

The logic used by JavaScript support plugin for detecting what test runner is available for a given test file is based on dependencies declarations in package.json nearest to this file: it looks for known test runners listed there and tries to run the most suitable one. If no _known_ test runners are listed among dependencies, there will be no icons in gutter; indirect dependencies are not analyzed.

The known test runners are mentioned in docs: jest, react-scripts, react-script-ts, react-super-scripts, or react-awesome-scripts 

0

Please sign in to leave a comment.