Cannot find module '@shelf/jest-mongodb'
See original GitHub issueI must be doing something stupid, but I can’t seem to resolve @shelf/jest-mongodb. Here’s a minimal repro:
$ npm i -D @shelf/jest-mongodb
$ echo "require('@shelf/jest-mongodb')" > test.js
$ node test.js
internal/modules/cjs/loader.js:626
throw err;
^
Error: Cannot find module '@shelf/jest-mongodb'
At the same time,
$ cat node_modules/@shelf/jest-mongodb/package.json | grep name
"name": "@shelf/jest-mongodb",
Any other package (incl. scoped) works. Originally ran into this with jest. I needs to use both ts-jest and @shelf/jest-mongodb, so I require both and then merge them with my own overwrites.
Env:
node -v:v12.3.1npm -v:6.9.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
@shelf/jest-mongodb - npm
Run your tests using Jest & MongoDB in Memory server. Latest version: 4.1.4, last published: a month ago. Start using @shelf/jest-mongodb in ...
Read more >Error with jest config: "Preset @shelf/jest-mongodb not found."
Deleting the package-lock.json, and node_modules folder, then installing packages again; Removing everything but the preset from the jest.config ...
Read more >shelf/jest-mongodb NPM - npm.io
Make sure mongodb is installed in the project as well, as it's required as a peer dependency. 1. Create jest.config.js. module.exports ...
Read more >Error with jest presets: “Preset @shelf/jest-mongodb not found.”
I have tried every combination of characters i can think of in the 'preset' field to get it to find the node_module, and...
Read more >Using with MongoDB - Jest
Jest MongoDB provides all required configuration to run your tests using MongoDB. First install @shelf/jest-mongodb. npm; Yarn. npm ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Had a similar issue and like @alex996 said, all Jest presets are just JS objects. Therefore you can merge them. He chose to use the merge NPM package, but you can also just use the object spread notation.
Here is my
jest.config.jsfile:Can you please explain why do you need to resolve it? If you wanna to use
@shelf/jest-mongodblibrary properly, please look at the readme: https://github.com/shelfio/jest-mongodb#usage You just need to add the library as Jest preset: