How to mock a Node.js module loaded with dojo/node
问题 I have an application with the server code running on Node.js and using Dojo. I have a config module defined like: define([ 'dojo/node!nconf', 'dojo/_base/config' ], function (nconf, dojoConfig) { nconf.argv().file({ file: dojoConfig.baseDir + '/config.json' }); console.log('-- file name:', dojoConfig.baseDir + '/config.json'); console.log('-- context:', nconf.get('context')); // ... logic here ... return nconf.get(nconf.get('context')); }); To be able to unit test this module, I've written