Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable jest-mongodb and use real database #249

Open
piranna opened this issue Jan 29, 2021 · 0 comments
Open

Option to disable jest-mongodb and use real database #249

piranna opened this issue Jan 29, 2021 · 0 comments

Comments

@piranna
Copy link

piranna commented Jan 29, 2021

Add and option to disable jest-mongodb and use real database, so it's possible to use the same tests both in local and/or unit tests, and for a real deployment like integration tests.

Implementation would be easy, just a matter creating the MongodbMemoryServer instance inside

module.exports = async () => {
after checking for a condition, and later check on
module.exports = async function () {
if global.__MONGOD__ has been set... Problem is what condition to use. Obvious one would be an environment variable, like if process.env.MONGO_URL is already set, but maybe overwritting it by jest-mongodb could be a valid use case, for example if it's already set in a .env file... Maybe a DISABLE_JEST_MONGODB environment variable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant