Version: 26.x
Using with MongoDB
With the Global Setup/Teardown and Async Test Environment APIs, Jest can work smoothly with MongoDB.
#
Use jest-mongodb PresetJest MongoDB provides all required configuration to run your tests using MongoDB.
- First install
@shelf/jest-mongodb
- Specify preset in your Jest configuration:
- Write your test
There's no need to load any dependencies.
See documentation for details (configuring MongoDB version, etc).