Nice way to implement tests.
I will try this way.
I've used mongo in docker container to perform my local tests.
Same in ci/cd.
Do you tried this way in ci/cd, like bitbucket pipelines?
Thanks for sharing.
Yes, one of the first things I tried was executing this tests in a CI pipeline. I was worried to find any unexpected issues, but it worked perfectly!
For CI pipelines I'd recommend using mongodb-memory-server-core and a mongodb + node.js docker image. That way the npm install will not download mongod binaries but use the ones already installed instead.
Hey, I've been struggling to get mongodb-memory-server to work on Circle Ci, any chance you could share your CircleCi config? I keep getting this error when running tests on the CI pipeline:
Error: Status Code is 403 (MongoDB's 404)
This means that the requested version-platform combination dosnt exist
🤔 looks like MongoMemoryServer is trying to download a binary for the default MongoDB version that is compatible with the OS running on your CircleCI server/container but can't find it.
I've never worked with CircleCI but I'd recommend you to check if the MongoDB version that MongoMemoryServer is trying to download is available for your OS & architecture.
Here's the code where the download URL for the binaries is generated, in case you want to check that out: MongoBinaryDownloadUrl.
Maybe you can set a specific version of MongoDB that exists for your platform, like this:
Another way to go would be to activate debug mode so you can get more info on the error. Just set the debug option to "1" in the package.json config section. More info here
Nice way to implement tests.
I will try this way.
I've used mongo in docker container to perform my local tests.
Same in ci/cd.
Do you tried this way in ci/cd, like bitbucket pipelines?
Thanks for sharing.
Yes, one of the first things I tried was executing this tests in a CI pipeline. I was worried to find any unexpected issues, but it worked perfectly!
For CI pipelines I'd recommend using
mongodb-memory-server-core
and a mongodb + node.js docker image. That way thenpm install
will not download mongod binaries but use the ones already installed instead.Hey, I've been struggling to get mongodb-memory-server to work on Circle Ci, any chance you could share your CircleCi config? I keep getting this error when running tests on the CI pipeline:
This is my db configuration:
🤔 looks like MongoMemoryServer is trying to download a binary for the default MongoDB version that is compatible with the OS running on your CircleCI server/container but can't find it.
I've never worked with CircleCI but I'd recommend you to check if the MongoDB version that MongoMemoryServer is trying to download is available for your OS & architecture.
Here's the code where the download URL for the binaries is generated, in case you want to check that out: MongoBinaryDownloadUrl.
Maybe you can set a specific version of MongoDB that exists for your platform, like this:
Another way to go would be to activate debug mode so you can get more info on the error. Just set the
debug
option to "1" in the package.jsonconfig
section. More info hereThanks for the suggestion, Paula. I found that for my circleci build, specifying a version like
4.2.6
did not work but specifyinglatest
worked.Hope that helps!