DEV Community


Discussion on: Testing Node.js + Mongoose with an in-memory database

parveen99 profile image

Hey amazing article, I am doing my first assignment using node JS express and Mongo DB as a developer and doing Unit testing for the very first time as a newbie developer. This was the most effective article I found. Thank you, Paula. Also how should I run individual tests, npm test runs it on the whole right ? I

paulasantamaria profile image
Paula Santamaría Author • Edited

In glad my article was helpful 😊.

If you follow this guide, npm test will execute all the tests in the "tests" folder (as specified in the package.json). You can however add some parameters (like --testNamePattern) when running npm test to execute only one test. I'd recommend reading my article Mastering NPM Scripts to learn how pass parameters to an npm script.

Also, if your using VSCode, checkout the Jest extension. It let's you run and debug tests individually.