Fix the issue created by https://github.com/shelfio/jest-mongodb/pull/389
Update the global setup and teardown to support having Jest "projects" specified. If specified, the preset will write a globalSetup.json file to each project directory, and remove all of them during teardown.
If the "projects" option is not in use, it will continue with the behaviour introduced in the above PR by writing a single globalSetup.json file to the rootDir.
This behaviour attempts to accommodate the use-case described in that PR without breaking the functionality for test setups using projects.
Edit:
Updated to instead use the globalConfig's "rootDir" field rather than the projectConfig in environment.ts. This field is set even when the projects option is in use. We only need to write one globalConfig.json file per Jest execution.
Fix the issue created by https://github.com/shelfio/jest-mongodb/pull/389 Update the global setup and teardown to support having Jest "projects" specified. If specified, the preset will write a
globalSetup.json
file to each project directory, and remove all of them during teardown.If the "projects" option is not in use, it will continue with the behaviour introduced in the above PR by writing a single
globalSetup.json
file to therootDir
.This behaviour attempts to accommodate the use-case described in that PR without breaking the functionality for test setups using
projects
.Edit: Updated to instead use the globalConfig's "rootDir" field rather than the projectConfig in
environment.ts
. This field is set even when theprojects
option is in use. We only need to write oneglobalConfig.json
file per Jest execution.