DEV Community

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

Collapse
 
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. :)

Collapse
 
dinos_vl profile image
Dinos Vlachantonis

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

Collapse
 
zxqfox profile image
Alexej Yaroshevich

For each thread you have to use separate database.

Also there can be a trick with transactions and rollbacks