In sut I should I have two kinds of dependencies to be stubbed: 3rd party dependencies (mongodb
& co) and own dependencies:
var async = require('async'), // This dependency should not be stubbed
mongodb = require('mongodb'), // 3rd party dependency, should be stubbed
myOwnDependency = require('../my/ownDependency.js') // My own dependency, should be stubbed
In JS there are 3 possibilities two stub dependencies.
By the most of them (rewire
, sinon
) all stubbed modules should still physically installed on dev machine
I.e. I can not say: please load sut and do not load dependencies to be stubbed - do not execute require
for mondodb
and ownDependency.js
- they are under my control.