Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit bdd9c9c

Browse files
committed
fixes for tests from PR #188
2 parents 7ae54c7 + 79c4657 commit bdd9c9c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/noderunner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function runTest(testPath) {
1717
var content,
1818
context = LIBS.vm.createContext({});
1919

20-
context.global = context
20+
context.self = void 0;
2121

2222
content = LIBS.fs.readFileSync(LIBS.path.resolve(TEST_DIR, testPath)).toString();
2323
LIBS.vm.runInContext(POLYFILL_CODE, context, POLYFILL_PATH);

tests/polyfilling.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function assert(value, expected, message) {
1212

1313
const context = new vm.createContext();
1414
var script = new vm.Script('this');
15+
context.self = void 0;
1516
const window = script.runInContext(context);
1617

1718
const fs = require('fs');
@@ -22,10 +23,11 @@ window.window = window; // circular, in case the polyfill uses window
2223
var originalIntl = window.Intl;
2324
var script = new vm.Script(code);
2425
script.runInContext(context);
25-
assert(typeof global.Intl, 'object', 'for this test to function, global.Intl is required');
26+
assert(typeof window.Intl, 'object', 'for this test to function, window.Intl is required');
2627
assert(typeof window.IntlPolyfill, 'object', 'polyfill should always add the custom global IntlPolyfill');
27-
assert(window.Intl, originalIntl, 'validating that the polyfilling process does not touch the original Intl value');
28-
28+
if (originalIntl) {
29+
assert(window.Intl, originalIntl, 'validating that the polyfilling process does not touch the original Intl value if it exists');
30+
}
2931
// second evaluation
3032
window.window = window; // circular, in case the polyfill uses window
3133
window.Intl = undefined; // disabling Intl

0 commit comments

Comments
 (0)