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
It worked for me ensuring sequential running of nicely separated to modules tests:
1) Keep tests in separated files, but without spec/test in naming.
|__testsToRunSequentially.test.js
|__tests
|__testSuite1.js
|__testSuite2.js
|__index.js
2) File with test suite also should look like this (testSuite1.js):
export const testSuite1 = () => describe(/*your suite inside*/)
3) Import them to testToRunSequentially.test.js and run with --runInBand:
import { testSuite1, testSuite2 } from './tests'
describe('sequentially run tests', () => {
testSuite1()
testSuite2()
})