1

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)?

1
  • with such a set up don't miss stopping execution after first failure. otherwise results may be unreliable(both successful or failure cases) Commented Feb 23, 2019 at 23:02

1 Answer 1

3

Start Jest using the --runInBand CLI option:

jest --runInBand

That option causes Jest to

Run all tests serially in the current process

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.