Replies: 1 comment
-
We are using https://www.npmjs.com/package/mongodb-memory-server for testing, the setup is here: https://github.com/feathersjs/feathers/blob/dove/packages/mongodb/test/index.test.ts#L143 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
When running a feathers app with MongoDB, how can one go about unit testing without having to connect to an actual MongoDB?
The documentation around test-database-setup (and this article) mentions that one can specify a local file path for
nedb
in theconfig/test.json
file like so:The documentation and article also mentions that "The same thing can be done with connection strings for other databases.", but this does not seem to work for MongoDB.
I tried setting the following in the
config/test.json
file:Which MongoDB doesn't seem to like.
Is there a recommended way by Feathers to mock out MongoDB? Looks like there are options like mongodb-memory-server and mongo-mock, but don't want to sink too much time into those if Feathers has a better way of achieving this.
Thanks!
System configuration
Module versions (especially the part that's not working):
"@feathersjs/adapter-commons": "^5.0.23"
"@feathersjs/feathers": "^5.0.23"
"@feathersjs/mongodb": "^5.0.23"
"mongodb": "^6.4.0",
NodeJS version: v20
Beta Was this translation helpful? Give feedback.
All reactions