jest-mongodb icon indicating copy to clipboard operation
jest-mongodb copied to clipboard

update to use config file location for finding jest mongodb config #436

Open JamieSinn opened this issue 2 years ago • 0 comments

For the same usecase as specified in my other PR: https://github.com/shelfio/jest-mongodb/pull/389

In our monorepo there's currently a problem where executing tests from the root directory via Nx means that the preset does not look in the correct (project directory) location for the jest-mongodb-config.js file.

This updates the helpers that determine that file's location to get the cwd from Jest's globalConfig rather than reading it from process.cwd(). Since it needs to Jest config to do this, I moved the instantiation of the MongoMemoryServer class to be inside the environment class's constructor.

I also added a devDependency on jest-environment-node because Typescript was complaining about not having type definitions for it (since its listed as a peerDependency)

cc @ajwootto

JamieSinn avatar Oct 20 '23 14:10 JamieSinn