Skip to content

Commit

Permalink
Fix #1980: Load mocha.opts from bin/mocha and bin/_mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
danielstjules committed Dec 26, 2015
1 parent 4f26ce7 commit 9b1e587
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bin/_mocha
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ program.on('require', function(mod){
requires.push(mod);
});

// load mocha.opts into process.argv

getOptions();
// If not already done, load mocha.opts
if (!process.env.LOADED_MOCHA_OPTS) {
getOptions();
}

// parse args

Expand Down
5 changes: 5 additions & 0 deletions bin/mocha
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
var spawn = require('child_process').spawn,
path = require('path'),
fs = require('fs'),
getOptions = require('./options'),
args = [path.join(__dirname, '_mocha')];

// Load mocha.opts into process.argv
// Must be loaded here to handle node-specific options
getOptions();

process.argv.slice(2).forEach(function(arg){
var flag = arg.split('=')[0];

Expand Down
2 changes: 2 additions & 0 deletions bin/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ function getOptions() {
} catch (err) {
// ignore
}

process.env.LOADED_MOCHA_OPTS = true;
}

0 comments on commit 9b1e587

Please sign in to comment.