A working example of MongoDB with Jest
Copy these files to your repo:
setup.js
- spins up in-memory mongodb serverteardown.js
- shuts it downmongo-environment.js
- sets up__MONGO_URI__
global variablejest.config.js
- glues all together
NPM dependencies:
- mongodb-memory-server - required for Jest Async Test Environment
Cache MongoDB binary in CI by putting this folder to the list of cached paths: ~/.mongodb-binaries
MIT © Vlad Holubiev