jest-environment-mongodb-ephemeral
v1.0.5
Published
Jest environment with an in-memory MongoDB server running the EphemeralForTest storage engine
Downloads
3
Maintainers
Readme
jest-environment-mongodb-ephemeral
This package provides a wrapper around
jest-environment-mongodb
with the storageEngine
setting preconfigured to ephemeralForTest
.
This makes it possible to set the storage engine on a per test file basis via docblocks, without setting up Jest projects.
Installation
NPM
npm install --save-dev mongodb-memory-server jest-environment-mongodb-ephemeral
Yarn
yarn add --dev mongodb-memory-server jest-environment-mongodb-ephemeral
Usage
By adding a @jest-environment
docblock at
the top of a test file, you can specify mongodb-ephemeral
to be used for all
tests in that file:
/**
* @jest-environment mongodb-ephemeral
*/
This overrides any environment set by testEnvironment
in the Jest
configuration file.
Additionally, any instance.storageEngine
option provided by
testEnvironmentOptions
will be overridden with ephemeralForTest
. All other
options provided by testEnvironmentOptions
will be in effect.