How can I exclude files from Jest watch?

前端 未结 7 1620
眼角桃花
眼角桃花 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-01 13:12

    I use the following pattern and it works for me:

    collectCoverageFrom: [
        'src/**/*.js',
        '!src/api/graphql/**/*.js',
        '!src/action/**/*.js',
        '!src/utils/dev/*.js',
        '!src/**/*.e2e.js',
    ],
    

    ! means we exclude the folder or file.

提交回复
热议问题