Skip to content

Commit

Permalink
peer review changes
Browse files Browse the repository at this point in the history
also ensure `lib/cli/cli.js` is executable
  • Loading branch information
boneskull committed Mar 12, 2019
1 parent 96efa24 commit 3d5320a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bin/mocha
Expand Up @@ -3,14 +3,14 @@
'use strict';

/**
* This wrapper executable checks for known node flags and appends them when found, before invoking the "real" _mocha(1) executable.
* This wrapper executable checks for known node flags and appends them when found,
* before invoking the "real" executable (`lib/cli/cli.js`)
*
* @module bin/mocha
* @private
*/

const {deprecate, warn} = require('../lib/utils');
const {spawn} = require('child_process');
const {loadOptions} = require('../lib/cli/options');
const {
unparseNodeFlags,
Expand All @@ -22,7 +22,6 @@ const debug = require('debug')('mocha:cli:mocha');
const {aliases} = require('../lib/cli/run-option-metadata');
const nodeEnv = require('node-environment-flags');

const mochaPath = require.resolve('./_mocha');
const mochaArgs = {};
const nodeArgs = {};

Expand Down Expand Up @@ -118,9 +117,12 @@ if (nodeArgs.gc) {
delete nodeArgs.gc;
}

debug('final node args', nodeArgs);

if (Object.keys(nodeArgs).length) {
const {spawn} = require('child_process');
const mochaPath = require.resolve('../lib/cli/cli.js');

debug('final node args', nodeArgs);

const args = [].concat(
unparseNodeFlags(nodeArgs),
mochaPath,
Expand Down
2 changes: 2 additions & 0 deletions lib/cli/cli.js
@@ -1,3 +1,5 @@
#!/usr/bin/env node

'use strict';

/**
Expand Down

0 comments on commit 3d5320a

Please sign in to comment.