@@ -13,7 +13,12 @@ describe("getImportGlobalsSrc", function () {
13
13
14
14
src = getImportGlobalsSrc ( ) ;
15
15
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
+ } ) ;
17
22
actualGlobals . sort ( ) ;
18
23
expectedGlobals . sort ( ) ;
19
24
expect ( actualGlobals ) . to . eql ( expectedGlobals ) ;
@@ -28,12 +33,18 @@ describe("getImportGlobalsSrc", function () {
28
33
actualGlobals ,
29
34
expectedGlobals = Object . keys ( global ) ;
30
35
31
- src = getImportGlobalsSrc ( ignore ) ;
36
+ // getImportGlobalsSrc modifies the ignore array, so let's create a copy
37
+ src = getImportGlobalsSrc ( ignore . slice ( 0 ) ) ;
32
38
expectedGlobals = expectedGlobals . filter ( function filterIgnoredVars ( value ) {
33
39
return ignore . indexOf ( value ) === - 1 ;
34
40
} ) ;
35
41
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
+ } ) ;
37
48
actualGlobals . sort ( ) ;
38
49
expectedGlobals . sort ( ) ;
39
50
expect ( actualGlobals ) . to . eql ( expectedGlobals ) ;