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. :)
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. :)
Might be answering super late but thanks for the feedback! :)
For each thread you have to use separate database.
Also there can be a trick with transactions and rollbacks