My application has some integration tests which require it to connect to a test database.
The problem is that, for every test, I need to create a connection, use this connection inside the test, and than dispose the connection after the test, regardless of whether the test passed.
I know Mocha has beforeEach and afterEach hooks, but I'm not finding a way to create an object on the beforeEach function, have access to it inside the test, and then being able to dispose it in the afterEach function.
What should I do?
Aucun commentaire:
Enregistrer un commentaire