@@ -13,7 +13,12 @@ describe("getImportGlobalsSrc", function () {
1313
1414 src = getImportGlobalsSrc ( ) ;
1515 vm . runInNewContext ( src , context ) ;
16- actualGlobals = Object . keys ( context ) ;
16+ actualGlobals = Object . keys ( context ) . filter ( function ( key ) {
17+ // node v0.10 does not set a constructor property on the context
18+ // node v0.11 does set a constructor property
19+ // so just lets filter it, because it doesn't make sense to mock it anyway
20+ return key !== "constructor" ;
21+ } ) ;
1722 actualGlobals . sort ( ) ;
1823 expectedGlobals . sort ( ) ;
1924 expect ( actualGlobals ) . to . eql ( expectedGlobals ) ;
@@ -28,12 +33,18 @@ describe("getImportGlobalsSrc", function () {
2833 actualGlobals ,
2934 expectedGlobals = Object . keys ( global ) ;
3035
31- src = getImportGlobalsSrc ( ignore ) ;
36+ // getImportGlobalsSrc modifies the ignore array, so let's create a copy
37+ src = getImportGlobalsSrc ( ignore . slice ( 0 ) ) ;
3238 expectedGlobals = expectedGlobals . filter ( function filterIgnoredVars ( value ) {
3339 return ignore . indexOf ( value ) === - 1 ;
3440 } ) ;
3541 vm . runInNewContext ( src , context ) ;
36- actualGlobals = Object . keys ( context ) ;
42+ actualGlobals = Object . keys ( context ) . filter ( function ( key ) {
43+ // node v0.10 does not set a constructor property on the context
44+ // node v0.11 does set a constructor property
45+ // so just lets filter it, because it doesn't make sense to mock it anyway
46+ return key !== "constructor" ;
47+ } ) ;
3748 actualGlobals . sort ( ) ;
3849 expectedGlobals . sort ( ) ;
3950 expect ( actualGlobals ) . to . eql ( expectedGlobals ) ;
0 commit comments