DEV Community

Discussion on: End-to-end API testing using Knex & Migrations

jreinhold profile image
Jeppe Reinhold

Wow, this was exactly what I was looking for, thanks!

But won't this break down as soon as we run multiple tests in parallel with Jest? Then we'll have the scenario where one test is tearing down the database, while another one is using it?

Also, for constructive criticism, it would be nice if you either explained what the globalSetup/globalTeardown in Jest did, or at least linked to it. :)

dinos_vl profile image
Dinos Vlachantonis Author

Might be answering super late but thanks for the feedback! :)

zxqfox profile image
Alexej Yaroshevich

For each thread you have to use separate database.

Also there can be a trick with transactions and rollbacks