diff options
author | Johannes Ewald <johannes.ewald@peerigon.com> | 2014-05-20 15:21:01 +0400 |
---|---|---|
committer | Johannes Ewald <johannes.ewald@peerigon.com> | 2014-05-20 15:21:01 +0400 |
commit | 4551fd830d5e8719424c1b96940e8b89643380fd (patch) | |
tree | 1136a8af4ba675e32e20d32f1d1d17ba1de91eab /test | |
parent | 5560d14bbe57aca6a5a5be55da2a08655e4ab1ab (diff) |
Added fix for node 0.11.x tests
Diffstat (limited to 'test')
-rw-r--r-- | test/getImportGlobalsSrc.test.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/getImportGlobalsSrc.test.js b/test/getImportGlobalsSrc.test.js index 0d9b020..e733614 100644 --- a/test/getImportGlobalsSrc.test.js +++ b/test/getImportGlobalsSrc.test.js @@ -13,7 +13,12 @@ describe("getImportGlobalsSrc", function () { src = getImportGlobalsSrc();
vm.runInNewContext(src, context);
- actualGlobals = Object.keys(context);
+ actualGlobals = Object.keys(context).filter(function (key) {
+ // node v0.10 does not set a constructor property on the context
+ // node v0.11 does set a constructor property
+ // so just lets filter it, because it doesn't make sense to mock it anyway
+ return key !== "constructor";
+ });
actualGlobals.sort();
expectedGlobals.sort();
expect(actualGlobals).to.eql(expectedGlobals);
@@ -28,12 +33,18 @@ describe("getImportGlobalsSrc", function () { actualGlobals,
expectedGlobals = Object.keys(global);
- src = getImportGlobalsSrc(ignore);
+ // getImportGlobalsSrc modifies the ignore array, so let's create a copy
+ src = getImportGlobalsSrc(ignore.slice(0));
expectedGlobals = expectedGlobals.filter(function filterIgnoredVars(value) {
return ignore.indexOf(value) === -1;
});
vm.runInNewContext(src, context);
- actualGlobals = Object.keys(context);
+ actualGlobals = Object.keys(context).filter(function (key) {
+ // node v0.10 does not set a constructor property on the context
+ // node v0.11 does set a constructor property
+ // so just lets filter it, because it doesn't make sense to mock it anyway
+ return key !== "constructor";
+ });
actualGlobals.sort();
expectedGlobals.sort();
expect(actualGlobals).to.eql(expectedGlobals);
|