Skip to content

Commit 36d8671

Browse files
committed
Pass the --module argument to the SM shell in the expected location
Ref tc39/test262-harness#163
1 parent 3989a6b commit 36d8671

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/agents/jsshell.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ const stackRe = /^([\s\S]*?)\r?\nStack:\r?\n([\s\S]*)$/;
1111
const stackFrameRe = /^(.*?)?@(.*?):(\d+):(\d+)?$/;
1212

1313
class JSShell extends ConsoleAgent {
14-
async evalScript(code, options = {}) {
15-
if (options.module && this.args[0] !== '--module') {
16-
this.args.unshift('--module');
14+
constructor(options) {
15+
super(options);
16+
if (this.args.indexOf('--module') !== -1) {
17+
throw new Error("Passing --module as a SpiderMonkey host argument is not supported.")
1718
}
19+
}
1820

19-
if (!options.module && this.args[0] === '--module') {
20-
this.args.shift();
21+
async evalScript(code, options = {}) {
22+
if (options.module) {
23+
// The file name must come immediataly after the `--module` flag.
24+
this.args.push('--module');
2125
}
2226

2327
return super.evalScript(code, options);

0 commit comments

Comments
 (0)