Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Error if can't resolve given path (or pattern) (fix #799)

Travis Jeffery6ecdce7090cf
diff --git a/bin/_mocha b/bin/_mocha
index 1458c844..bf5fa058 100644
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -410,7 +410,9 @@ function lookupFiles(path, recursive) {
if (exists(path + '.js')) {
path += '.js'
} else {
- return glob.sync(path);
+ files = glob.sync(path);
+ if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'");
+ return files;
}
}