In a database integration test, you want the database to reset between each test suite.
The problem: Jest runs your tests in parallel by default. It gets unpredictable when several suites hit the same database at the same time.
The fix: run the tests sequentially with --runInBand.
npx jest --runInBandThe catch: the option applies to every test, unit tests included. Your fast unit tests will run in sequence too, even though they don't need to.
A GitHub issue about it: https://github.com/jestjs/jest/issues/10936