Reputation: 6338
I have some tests that interact with a database. I have the test code set to clear out the test table before/after each test. This doesn't work with jest though, since it's running multiple tests in parallel, so it starts another test that clears out the test db while the first one's running!
Is it possible to set jest into a serial mode (without writing my own test runner, which seems complicated)?
Upvotes: 1
Views: 557
Reputation: 45810
Start Jest
using the --runInBand CLI option:
jest --runInBand
That option causes Jest
to
Run all tests serially in the current process
Upvotes: 3