Skip to content

Commit

Permalink
no child-process - no second options parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Jun 6, 2019
1 parent 6778173 commit e53b702
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bin/mocha
Expand Up @@ -17,9 +17,7 @@ const {
isNodeFlag,
impliesNoTimeouts
} = require('../lib/cli/node-flags');
const unparse = require('yargs-unparser');
const debug = require('debug')('mocha:cli:mocha');
const {aliases} = require('../lib/cli/run-option-metadata');
const nodeEnv = require('node-environment-flags');

const mochaArgs = {};
Expand Down Expand Up @@ -120,6 +118,8 @@ if (nodeArgs.gc) {
if (Object.keys(nodeArgs).length) {
const {spawn} = require('child_process');
const mochaPath = require.resolve('../lib/cli/cli.js');
const unparse = require('yargs-unparser');
const {aliases} = require('../lib/cli/run-option-metadata');

debug('final node args', nodeArgs);

Expand Down Expand Up @@ -151,5 +151,5 @@ if (Object.keys(nodeArgs).length) {
proc.kill('SIGTERM'); // if that didn't work, we're probably in an infinite loop, so make it die.
});
} else {
require('../lib/cli/cli').main(unparse(mochaArgs, {alias: aliases}));
require('../lib/cli/cli').main(['preParsedOptions', mochaArgs]);
}
2 changes: 1 addition & 1 deletion lib/cli/cli.js
Expand Up @@ -34,7 +34,7 @@ exports.main = (argv = process.argv.slice(2)) => {

Error.stackTraceLimit = Infinity; // configurable via --stack-trace-limit?

var args = loadOptions(argv);
var args = argv[0] === 'preParsedOptions' ? argv[1] : loadOptions(argv);

yargs()
.scriptName('mocha')
Expand Down

0 comments on commit e53b702

Please sign in to comment.