Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Added support to --require files relative to the CWD. Closes #241

TJ Holowaychuk4a075189d26f
diff --git a/bin/_mocha b/bin/_mocha
index 1e494b03..b3f101ea 100755
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -94,6 +94,10 @@ program.on('interfaces', function(){
module.paths.push(cwd, join(cwd, 'node_modules'));
program.on('require', function(mod){
+ var abs = path.existsSync(mod)
+ || path.existsSync(mod + '.js');
+
+ if (abs) mod = join(cwd, mod);
require(mod);
});