Fix Evaluator tests
MODIFY
packages/evaluator-shim/test/integration/globalObject-mutability.test.js
packages/evaluator-shim/test/integration/globalObject-mutability.test.js
@@ -5,11 +5,14 @@ import stubFunctionConstructors from '../stubFunctionConstructors.js';
const { test } = tap;
-test('globalObject properties mutabile', t => {
- t.plan(3);
+test('globalObject properties mutable', t => {
+ t.plan(4);
// Mimic repairFunctions.
stubFunctionConstructors(sinon);
+ // eslint-disable-next-line no-new-func
+ const global = Function('return this')();
+ global.Evaluator = Evaluator;
const e = new Evaluator();
@@ -22,6 +25,10 @@ test('globalObject properties mutabile', t => {
e.evaluate('Evaluator = function(opts) { this.extra = "extra" }');
t.equal(e.evaluate('(new Evaluator({})).extra'), 'extra');
+ e.evaluate('Function = function() { this.extra = "extra" }');
+ t.equal(e.evaluate('new Function().extra'), 'extra');
+
+ delete global.Evaluator;
sinon.restore();
});

MODIFY
packages/evaluator-shim/test/integration/globalObject-properties.test.js
packages/evaluator-shim/test/integration/globalObject-properties.test.js
@@ -10,6 +10,9 @@ test('globalObject properties', t => {
// Mimic repairFunctions.
stubFunctionConstructors(sinon);
+ // eslint-disable-next-line no-new-func
+ const global = Function('return this')();
+ global.Evaluator = Evaluator;
// eslint-disable-next-line no-new-func
const globalObject = new Function('return this;')();
@@ -35,5 +38,6 @@ test('globalObject properties', t => {
t.equal(e.global.Evaluator, Evaluator);
+ delete global.Evaluator;
sinon.restore();
});

MODIFY
packages/evaluator-shim/test/integration/identity-continuity.test.js
packages/evaluator-shim/test/integration/identity-continuity.test.js
@@ -11,6 +11,9 @@ test('identity Array', t => {
// Mimic repairFunctions.
stubFunctionConstructors(sinon);
+ // eslint-disable-next-line no-new-func
+ const global = Function('return this')();
+ global.Evaluator = Evaluator;
const e1 = new Evaluator();
const e2 = new e1.global.Evaluator();
@@ -25,6 +28,7 @@ test('identity Array', t => {
t.ok(a2 instanceof e1.global.Array);
t.ok(a2 instanceof e2.global.Array);
+ delete global.Evaluator;
sinon.restore();
});
@@ -34,6 +38,9 @@ test('identity Evaluator', t => {
// Mimic repairFunctions.
stubFunctionConstructors(sinon);
+ // eslint-disable-next-line no-new-func
+ const global = Function('return this')();
+ global.Evaluator = Evaluator;
const e1 = new Evaluator();
const e2 = new e1.global.Evaluator();
@@ -48,6 +55,7 @@ test('identity Evaluator', t => {
t.ok(e3 instanceof e1.global.Evaluator);
t.ok(e3 instanceof e2.global.Evaluator);
+ delete global.Evaluator;
sinon.restore();
});
@@ -57,6 +65,9 @@ test('identity eval', t => {
// Mimic repairFunctions.
stubFunctionConstructors(sinon);
+ // eslint-disable-next-line no-new-func
+ const global = Function('return this')();
+ global.Evaluator = Evaluator;
const e1 = new Evaluator();
const e2 = new e1.global.Evaluator();
@@ -72,6 +83,7 @@ test('identity eval', t => {
t.notEqual(e2.evaluate('eval'), eval);
t.notEqual(e2.evaluate('eval'), e1.evaluate('eval'));
+ delete global.Evaluator;
sinon.restore();
});
@@ -81,6 +93,9 @@ test('identity Function', t => {
// Mimic repairFunctions.
stubFunctionConstructors(sinon);
+ // eslint-disable-next-line no-new-func
+ const global = Function('return this')();
+ global.Evaluator = Evaluator;
const e1 = new Evaluator();
const e2 = new e1.global.Evaluator();
@@ -101,5 +116,6 @@ test('identity Function', t => {
t.ok(f2 instanceof e2.global.Function);
t.ok(f2 instanceof e3.global.Function);
+ delete global.Evaluator;
sinon.restore();
});

MODIFY
packages/make-importer/package.json
packages/make-importer/package.json
"depcheck": "depcheck",
"lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
- "test": "exit 0",
"OFF-test": "tap --no-esm --no-coverage --reporter specy 'test/**/*.test.js'",
- "test262": "tap --no-esm --no-coverage --reporter specy test262/test262-run.js",
+ "OFF-test262": "tap --no-esm --no-coverage --reporter specy test262/test262-run.js",
"lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.js'",
"lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'"
},

MODIFY
packages/transform-module/package.json
packages/transform-module/package.json
"module": "dist/transform-module.esm.js",
"browser": "dist/transform-module.umd.js",
"scripts": {
- "build": "rollup -c",
- "test": "tape -r esm 'test/**/*.js'",
+ "lint": "eslint '**/*.js'",
"lint-fix": "eslint --fix '**/*.js'",
- "lint": "eslint '**/*.js'"
+ "OFF-test": "tape -r esm 'test/**/*.js'",
+ "OFF-build": "rollup -c"
},
"devEngines": {
"node": "8.x || 9.x || 10.x || 11.x || 12.x"

Fix Evaluator tests