Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the --module argument to the SM shell in the expected location #141

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ConsoleAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 11 additions & 5 deletions lib/agents/jsshell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down