Skip to content

armgit / mocha

Public Imported from GitHub
0

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

Suport ops path specify

nishigori87c744718be5
diff --git a/bin/_mocha b/bin/_mocha
index e08e1092..e0661c5b 100755
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -90,6 +90,7 @@ program
.option('--no-deprecation', 'silence deprecation warnings')
.option('--no-exit', 'require a clean shutdown of the event loop: mocha will not call process.exit')
.option('--no-timeouts', 'disables timeouts, given implicitly with --debug')
+ .option('--opts <path>', 'specify opts path', 'test/mocha.opts')
.option('--prof', 'log statistical profiling information')
.option('--recursive', 'include sub directories')
.option('--reporters', 'display available reporters')
@@ -169,10 +170,14 @@ program.on('require', function(mod){
requires.push(mod);
});
-// mocha.opts support
+// --opts
+
+var opsPath = process.argv.indexOf('--opts') !== -1
+ ? process.argv[process.argv.indexOf('--opts') + 1]
+ : 'test/mocha.opts';
try {
- var opts = fs.readFileSync('test/mocha.opts', 'utf8')
+ var opts = fs.readFileSync(opsPath, 'utf8')
.trim()
.split(/\s+/);