Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Fixed --watch with paths omitting ".js"

TJ Holowaychukb4bdd4f70e36
diff --git a/bin/mocha b/bin/mocha
index c4c56c53..00385f90 100755
--- a/bin/mocha
+++ b/bin/mocha
@@ -158,6 +158,13 @@ if (!files.length) {
});
}
+// resolve
+
+files = files.map(function(path){
+ path = require.resolve(join(cwd, path));
+ return path;
+});
+
// --watch
if (program.watch) {
@@ -207,7 +214,6 @@ load(files, function(){
function load(files, fn) {
var pending = files.length;
files.forEach(function(file){
- file = join(cwd, file);
delete require.cache[file];
suite.emit('pre-require', global, file);
suite.emit('require', require(file), file);