Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 3 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
31 changes: 31 additions & 0 deletions lib/agents/jawsm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict';

const fs = require('fs');
const runtimePath = require('../runtime-path');
const ConsoleAgent = require('../ConsoleAgent');

class JawsmAgent extends ConsoleAgent {
constructor(options) {
super(options);

// disable node error coloring stuff
this.cpOptions = {
env: {
NO_COLOR: 1
}
};

}

async evalScript(code, options = {}) {
return super.evalScript(code, options);
}

parseError(str) {
return super.parseError(str);
}
}

JawsmAgent.runtime = fs.readFileSync(runtimePath.for('jawsm'), 'utf8');

module.exports = JawsmAgent;
26 changes: 26 additions & 0 deletions runtimes/jawsm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var $262 = {
global: globalThis,
gc() {
throw new Test262Error("gc() not yet supported.");
},
createRealm(options) {
throw new Test262Error("createRealm() not yet supported.");
},
evalScript(code) {
throw new Test262Error("evalScript() not yet supported.");
},
getGlobal(name) {
return this.global[name];
},
setGlobal(name, value) {
this.global[name] = value;
},
destroy() {
/* noop */
},
IsHTMLDDA: {},
source: $SOURCE,
get agent() {
throw new Test262Error("agent.* not yet supported.");
},
};