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 committed Aug 13, 2019
1 parent fcffd5a commit 18ad1c1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/mocha
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 18ad1c1

Please sign in to comment.