Argument clearCache in jest not work with other commands
Currently I have the following command which clears the cache and starts testing the application:
however when I apply the same arguments in webstorm it ends up crashing in the part of clearing the cache... Does anyone know what it could be? The arguments I apply in webstorm are just below
The command output when I use npm run test is
however when I use the webstorm script, the script is finished along with the clear cache
How would I run the clear cache command and then run the tests?
Please sign in to leave a comment.
With your script, you run 2 jest processes sequentially with
&&
: the second process (jest --passWithNoTests --silent --noStackTrace --runInBand
) waits for the first one (jest --clearCahce
) to finish, so your tests are run after clearing the caches. In your run configuration, you pass all these options to a single jest process, and it deletes the Jest cache directory and then exits without running tests as it normally does when the--clearCache
option is passed (https://jestjs.io/docs/cli#--clearcache)Elena Pogorelova, how to execute && commands with webstorm?
you can create a run configuration (npm script, or Jest run configuration) that runs
jest --clearCahce
and add this configuration to the Before launch section of your main configuration (the one that runs jest with--passWithNoTests --silent --noStackTrace --runInBand
options)