☕️ Classic, reliable, trusted test framework for Node.js and the browser
remove duplication of mocha.opts on process.argv
nexdrewf8294e63a995
diff --git a/bin/mocha b/bin/mochaindex 123929e8..031ef56b 100755--- a/bin/mocha+++ b/bin/mocha@@ -8,12 +8,7 @@var spawn = require('child_process').spawn,path = require('path'),fs = require('fs'),- args = [path.join(__dirname, '_mocha')],- getOptions = require('./options');--// load mocha.opts into process.argv--getOptions();+ args = [path.join(__dirname, '_mocha')];process.argv.slice(2).forEach(function(arg){var flag = arg.split('=')[0];diff --git a/test/integration/regression.js b/test/integration/regression.jsindex 564e9221..5e2d863a 100644--- a/test/integration/regression.js+++ b/test/integration/regression.js@@ -1,4 +1,6 @@var assert = require('assert');+var fs = require('fs');+var path = require('path');var run = require('./helpers').runMocha;describe('regressions', function() {@@ -21,4 +23,11 @@ describe('regressions', function() {done();});});++ it('should not duplicate mocha.opts args in process.argv', function() {+ var processArgv = process.argv.join('');+ var mochaOpts = fs.readFileSync(path.join(__dirname, '..', 'mocha.opts'), 'utf-8').split(/[\s]+/).join('');+ assert.notEqual(processArgv.indexOf(mochaOpts), -1, 'process.argv missing mocha.opts');+ assert.equal(processArgv.indexOf(mochaOpts), processArgv.lastIndexOf(mochaOpts), 'process.argv contains duplicated mocha.opts');+ });});