jest-mongodb-downloader
When being run, this script simply downloads the MongoDB version defined in jest-mongodb-config.js
.
Why?
But jest-mongodb
does this automatically upon start, so why would you want to do this? -- When explicitly triggering the download, you can make use of Docker’s caching, and avoid downloading MongoDB again and again if you just modified some source code.
Usage
-
Install with yarn add @nodepit/jest-mongodb-downloader -D
-
Add the following line to your Dockerfile before running the tests and copying the source code (make sure that jest-mongodb-config.js
is already in the image).
Add MONGOMS_DISABLE_POSTINSTALL
to prevent downloading the default version of MongoDB and only install the version which is specified in the jest-mongodb-config.js
.
ENV MONGOMS_DISABLE_POSTINSTALL=1
RUN yarn
COPY jest-mongodb-config.js ./
RUN yarn run jest-mongodb-downloader
-
Give a GitHub star to say “Thank you, NodePit!”
Copyright nodepit.com, 2020.