I'm in the process of learning Node.js and am wondering about how people mock dependencies in their modules when unit testing.
For example: I have a module that abstracts my MongoDB calls. A module that uses this module may start out something like this.
var myMongo = require("MyMongoModule");
// insert rest of the module here.
I want to ensure I test such a module in isolation while also ensuring that my tests don't insert records/documents into Mongo.
Is there a module/package that I can use that proxies require()
so I can inject in my own mocks? How do other's typically address this issue?