Home > database >  Configure intelliJ to use `npm run test` instead of `jest` as default run configuration?
Configure intelliJ to use `npm run test` instead of `jest` as default run configuration?

Time:09-21

I'm using intelliJ for React development, and want to be able to use the built in test running functionality that allows me to run individual tests from within the IDE. Currently, when I attempt to do this, the command it's running is jest <file name>. However, we don't have jest configured to run that way, instead we are running our tests using npm run test <file name>. I can build a run configuration that runs npm run test, and it will execute ALL of my tests successfully, but I want to be able to use the Run button to run individual tests etc.

CodePudding user response:

In my case, this was because of the particular way our VDI interface is configured, and the tools we use within that space. The shell we use points to an alternative drive letter than C:, and IntelliJ wanted to look for running jest from the C: drive. And the alternative drive is like a mounted replica of a portion of the C: drive, so I was able to just launch the project from the C: drive instead of the other drive letter, and voila this works now for me. Because the npm run test:coverage command is still, in the background, just running jest from the CLI.

  • Related