How to exclude files from Jest.js watch with JavaScript?

Estimated read time 1 min read

Jest supports a --watchPathIgnorePatterns option that allows you to specify file patterns to be ignored in the watch mode. To use it, you can pass an array of file globs to the option in your Jest configuration file or on the command line:

// jest.config.js
module.exports = {
  watchPathIgnorePatterns: [
$ jest --watch --watchPathIgnorePatterns="<rootDir>/node_modules/"

This will exclude files matching the specified patterns from being watched by Jest, making the watch mode faster and more efficient.

You May Also Like

More From Author

+ There are no comments

Add yours

Leave a Reply