I am trying to set the test database for the testing purpose, but its not working.
I am trying to connect to mongodb using mongoose, but finding problem in connection er
I had same error, for me it was because I was trying to use environment variables in globalSetup
which had the file for initiating db connection.. mongoose.connect(global.__MONGO_URI__
Apparently, environment variables are not initialised yet in globalSetup
so I had to move the code somewhere else, either to setupFilesAfterEnv
or by using Async Test Environment