Running jest tests without sequential flag (-i) fails due to "deadlock detected"
Lots of tests fail without using "-i" , e.g "$yarnpkg jest -i models"
Example of error message is :
FAIL models src/models/tests/team.test.js (11.965 s) ● Team Model › non-global teams must have an associated object
error: TRUNCATE TABLE chat_threads CASCADE - deadlock detected
14 |
15 | if (tablename !== 'migrations') {
> 16 | return db.raw(`TRUNCATE TABLE ${tablename} CASCADE`)
| ^
17 | }
18 |
19 | return true
at Object.raw (node_modules/knex/lib/util/make-knex.js:114:30)
at Function.raw (node_modules/knex/lib/util/make-knex.js:90:29)
at map (src/models/__tests__/_clearDb.js:16:21)
at Array.map (<anonymous>)
at dbCleaner (src/models/__tests__/_clearDb.js:12:12)
Error seems to be in the _clearDb.js file, related to it's custom TRUNCATE sql command.