How to Find the Jest Cache Folder?

You can locate the Jest cache folder by using the --showConfig CLI option, for example, like so:

jest --showConfig

This will output your Jest config; the cache directory should be under the cacheDirectory key. You can use the following shortcut to only display the cache directory:

jest --showConfig | grep cacheDir

If Jest is not installed as a global dependency, then you can do the following:

./node_modules/.bin/jest --showConfig | grep cacheDir

If you're using yarn, then you can run the following command:

yarn jest --showConfig | grep cacheDir

Similarly, if you're using npx, you can use the following command:

npx jest --showConfig | grep cacheDir

This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.