jeudi 12 avril 2018

Mocha --require wait until migration

I have a challenge to run a database migration before start my mocha suite test.

I am using the flag --require to load a bootstrap.js module that I have created and where I run the database migration.

The problem is that migration is an async function and as you know it returns immediately. So, there is any way to wait for the module to be ready until everything it's finished?

I can use some sync lib to convert migration to be synchronous but I would like to hear more strategies.

Aucun commentaire:

Enregistrer un commentaire