require.main.require works but not inside Mocha test
I have written a global function for requiring certain files of my app/framework: global.coRequireModel = function(name) { // CRASH happens here return require.main.require('./api/_co' + name + '/_co' + name + '.model'); } This module is in /components/coGlobalFunctions. It is required in my main app app.js like this: require('./components/coGlobalFunctions'); Then in other modules using "something" from the framework I use: var baseScheme = coRequireModel('Base'); This works but not in the Mocha tests which give me a "Error: Cannot find module" right before the require.main.require call. It