diff --git a/lib/ConsoleAgent.js b/lib/ConsoleAgent.js index f59a865..29c5da6 100644 --- a/lib/ConsoleAgent.js +++ b/lib/ConsoleAgent.js @@ -212,7 +212,7 @@ class ConsoleAgent extends Agent { }; } - this[CHILD_PROCESS] = await this.createChildProcess([tempfile]); + this[CHILD_PROCESS] = await this.createChildProcess([...options.testHostArgs || [], tempfile]); this.hasFinishedCreatingChildProcess = true; if (this.isStopped && this[CHILD_PROCESS] === null) { diff --git a/lib/agents/jsshell.js b/lib/agents/jsshell.js index 8a3db75..a5d837d 100644 --- a/lib/agents/jsshell.js +++ b/lib/agents/jsshell.js @@ -11,13 +11,19 @@ const stackRe = /^([\s\S]*?)\r?\nStack:\r?\n([\s\S]*)$/; const stackFrameRe = /^(.*?)?@(.*?):(\d+):(\d+)?$/; class JSShell extends ConsoleAgent { - async evalScript(code, options = {}) { - if (options.module && this.args[0] !== '--module') { - this.args.unshift('--module'); + constructor(options) { + super(options); + if (this.args.indexOf('--module') !== -1) { + throw new Error("Passing --module as a SpiderMonkey host argument is not supported.") } + } - if (!options.module && this.args[0] === '--module') { - this.args.shift(); + async evalScript(code, options = {}) { + if (options.module) { + if (!options.testHostArgs) { + options.testHostArgs = []; + } + options.testHostArgs.push('--module'); } return super.evalScript(code, options);