You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have multiple test files that use Mongo. I would like to connect only once (in the globalSetup.ts), and disconnect only once, after every test is done, on globalTeardown.ts.
Hi, I have multiple test files that use Mongo. I would like to connect only once (in the
globalSetup.ts
), and disconnect only once, after every test is done, onglobalTeardown.ts
.I tried following the steps from #212
But it doesn't seem to work.
This is my
globalSetup.ts
. It seems to be working fine, theMONGO_URL
is always set../server/tests/__scripts__/globalSetup.ts
However, in all of my tests, Mongo is just unresponsive. Jest throws the "Exceeded timeout of 5000ms for a hook" error.
It does work, however, if I connect inside the test file using
beforeAll
:./server/tests/repositories/notificationRepository.test.ts
This is my config:
./server/tests/jest.base.config.js
Am I missing something obvious? Is there a way I can connect to Mongo inside
globalSetup
and use the connection throughout my test files?Thanks!
The text was updated successfully, but these errors were encountered: