How to run Jest tests sequentially?

前端 未结 5 904
抹茶落季
抹茶落季 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:40

    As copied from https://github.com/facebook/jest/issues/6194#issuecomment-419837314

    test.spec.js

    import { signuptests } from './signup'
    import { logintests } from './login'
    
    describe('Signup', signuptests)
    describe('Login', logintests)
    

    signup.js

    export const signuptests = () => {
         it('Should have login elements', () => {});
         it('Should Signup', () => {}});
    }
    

    login.js

    export const logintests = () => {
        it('Should Login', () => {}});
    }
    

提交回复
热议问题