[WebStorm] Jest tests: Test config for a group of files

All my tests in one folder need the jest option `--env=node`. All other test the regular `--env=jsdom`.

Can I create a "Run All Tests" config for this scenario? Or at least two configs: "Run node tests" and "Run all other tests"?

I could only find "All" or "Single File" in the config.


Thank you.



No, there is no way to run all Jest files in a folder

But you can create multiple Jest configuration files (jest.config.js), 1 per each folder, and specify different options (https://jestjs.io/docs/en/configuration#testenvironment-string) in them; see https://jestjs.io/blog/2017/05/06/jest-20-delightful-testing-multi-project-runner.html


Omg. Thank you so much. This is great news!


Please sign in to leave a comment.