Skip to content

armgit / mocha

Public Imported from GitHub
0

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

fixed weird formatting on previous commit

Tj Holowaychuk08a4d52b7277
diff --git a/bin/mocha b/bin/mocha
index 75b97344..c0839f32 100755
--- a/bin/mocha
+++ b/bin/mocha
@@ -104,19 +104,17 @@ if (program.timeout) suite.timeout(program.timeout);
var files = program.args;
-/**
- * Defaults matching path to test/*.js and adjusts
- * to check for *.coffee as well if CS is available
- */
+// default files to test/*.js
+// with optional coffee-script support
if (!files.length) {
- var fileMatcher = /\.js$/;
files = fs.readdirSync('test').filter(function(path){
- try {
- require('coffee-script');
- fileMatcher = /\.(js|coffee)$/;
- } catch (e) {}
- return path.match(fileMatcher);
+ try {
+ require('coffee-script');
+ return path.match(/\.(js|coffee)$/);
+ } catch (e) {
+ return path.match(/\.js$/);
+ }
}).map(function(path){
return join('test', path);
});