Sometimes, we want to exclude files from Jest watch with JavaScript.
In this article, we’ll look at how to exclude files from Jest watch with JavaScript.
How to exclude files from Jest watch with JavaScript?
To exclude files from Jest watch with JavaScript, we can add the modulePathIgnorePatterns
property into our Jest config.
For instance, in our Jest config, we add
{
//...
"modulePathIgnorePatterns": ["directoryNameToIgnore"]
//...
}
to set the modulePathIgnorePatterns
property in our Jest config to an array that has strings of the directories to ignore when running Jest tests.
Conclusion
To exclude files from Jest watch with JavaScript, we can add the modulePathIgnorePatterns
property into our Jest config.