Skip to content

armgit / mocha

Public Imported from GitHub
0

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

feat(bin/options.js): Add support for comment lines in "mocha.opts"

Paul Roebuckcd3e1b39f61c
diff --git a/bin/options.js b/bin/options.js
index 60cbcd70..a25a18e2 100644
--- a/bin/options.js
+++ b/bin/options.js
@@ -32,6 +32,7 @@ function getOptions() {
try {
const opts = fs
.readFileSync(optsPath, 'utf8')
+ .replace(/^#.*$/gm, '')
.replace(/\\\s/g, '%20')
.split(/\s/)
.filter(Boolean)
diff --git a/test/integration/regression.spec.js b/test/integration/regression.spec.js
index e1f6b19d..92f2223c 100644
--- a/test/integration/regression.spec.js
+++ b/test/integration/regression.spec.js
@@ -32,6 +32,7 @@ describe('regressions', function() {
var processArgv = process.argv.join('');
var mochaOpts = fs
.readFileSync(path.join(__dirname, '..', 'mocha.opts'), 'utf-8')
+ .replace(/^#.*$/gm, '')
.split(/[\s]+/)
.join('');
assert.notEqual(
diff --git a/test/mocha.opts b/test/mocha.opts
index c233b952..c6f308ee 100644
--- a/test/mocha.opts
+++ b/test/mocha.opts
@@ -1,6 +1,11 @@
+###
+### mocha.opts
+###
+
--require ./test/setup
--ui bdd
--globals okGlobalA,okGlobalB
--globals okGlobalC
--globals callback*
--timeout 200
+