How can I exclude files from Jest watch?

前端 未结 7 1678
眼角桃花
眼角桃花 2021-02-01 12:17

I\'m doing some slightly bizarre stuff using Jest for testing where I\'m writing some stuff to disk. If I use the watch flag in Jest however then I\'m finding (quit

7条回答
  •  渐次进展
    2021-02-01 13:12

    To exclude an entire folder, add the following in the "jest" property of the package.json file:

    "modulePathIgnorePatterns": [
      "/src/services"
    ],
    

    To exclude an individual file:

    "collectCoverageFrom": [
      "!src/index.js"
    ],
    

提交回复
热议问题