How to run Jest tests sequentially?

前端 未结 5 903
抹茶落季
抹茶落季 2020-12-12 15:42

I\'m running Jest tests via npm test. Jest runs tests in parallel by default. Is there any way to make the tests run sequentially?

I have some tests cal

5条回答
  •  离开以前
    2020-12-12 16:21

    Use the serial test runner:

    npm install jest-serial-runner --save-dev
    

    Set up jest to use it, e.g. in jest.config.js:

    module.exports = {
       ...,
       runner: 'jest-serial-runner'
    };
    

    You could use the project feature to apply it only to a subset of tests. See https://jestjs.io/docs/en/configuration#projects-arraystring--projectconfig

提交回复
热议问题