Skip to content

Commit

Permalink
feat(bin/options.js): Add support for comment lines in "mocha.opts"
Browse files Browse the repository at this point in the history
Modified code to strip comment lines, those beginning with a hash character ('#'), from "mocha.opts"
prior to processing its contents.

Fixes #3370
  • Loading branch information
plroebuck authored and boneskull committed May 18, 2018
1 parent e0306ff commit 9d9e6c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function getOptions() {
try {
const opts = fs
.readFileSync(optsPath, 'utf8')
.replace(/^#.*$/gm, '')
.replace(/\\\s/g, '%20')
.split(/\s/)
.filter(Boolean)
Expand Down
1 change: 1 addition & 0 deletions test/integration/regression.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 5 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
###
### mocha.opts
###

--require ./test/setup
--ui bdd
--globals okGlobalA,okGlobalB
--globals okGlobalC
--globals callback*
--timeout 200

0 comments on commit 9d9e6c6

Please sign in to comment.