Skip to content

Commit

Permalink
treat '--require esm' as Node option (#3983)
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba authored Aug 13, 2019
1 parent 7297b0a commit 5f1cad5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/mocha
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ if (nodeArgs.gc) {
delete nodeArgs.gc;
}

// --require/-r is treated as Mocha flag except when 'esm' is preloaded
if (mochaArgs.require && mochaArgs.require.includes('esm')) {
nodeArgs.require = ['esm'];
mochaArgs.require = mochaArgs.require.filter(mod => mod !== 'esm');
if (!mochaArgs.require.length) {
delete mochaArgs.require;
}
delete mochaArgs.r;
}

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

0 comments on commit 5f1cad5

Please sign in to comment.