dummy startSES function, test to load it
MODIFY
package.json
package.json
"description": "Secure EcmaScript",
"main": "index.js",
"scripts": {
- "test": "tape test/**/*.js"
+ "test": "tape -r esm test/**/*.js"
},
"devDependencies": {
"esm": "^3.0.37",

MODIFY
src/SES.js
src/SES.js
+function startSES() {
+}
+exports.startSES = startSES;

MODIFY
test/test.js
test/test.js
var test = require('tape');
var Realm = require('../proposal-realms/shim/src/realm.js').default;
+var SES = require('../index.js');
test('hello', function(t) {
t.plan(2); // need t.plan or t.end, but both is ok too
@@ -8,9 +9,24 @@ test('hello', function(t) {
t.end();
});
-test('load', function(t) {
+test('realm smoketest', function(t) {
const r = new Realm();
let o = r.evaluate('123+4');
t.equal(o, 127);
+
+ var captured = 0;
+ r.global.other = function(a, b) { captured = a; return a+b; };
+ o = r.evaluate('other(1,2)');
+ t.equal(o, 3);
+ t.equal(captured, 1);
+
t.end();
});
+
+test('activate', function(t) {
+ const r = new Realm();
+ r.global.startSES = SES.startSES;
+ r.evaluate('startSES()');
+ t.end();
+});
+

dummy startSES function, test to load it