File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,11 @@ function getDefinePropertySrc() {
18
18
value +
19
19
"', {enumerable: false, value: " +
20
20
srcs [ value ] +
21
- "}); " ;
21
+ ", " +
22
+ "writable: true}); " ;
22
23
} , "" ) ;
23
24
24
25
return src ;
25
26
}
26
27
27
- module . exports = getDefinePropertySrc ;
28
+ module . exports = getDefinePropertySrc ;
Original file line number Diff line number Diff line change @@ -66,16 +66,17 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv +
66
66
expect ( rewire ( "./moduleB.js" ) . __with__ . toString ( ) ) . to . be ( __with__Src ) ;
67
67
} ) ;
68
68
69
- it ( "should provide __set__ as a non-enumerable property" , function ( ) {
70
- expect ( Object . keys ( rewire ( "./moduleA.js" ) ) . indexOf ( "__set__" ) ) . to . be ( - 1 )
71
- } ) ;
72
69
73
- it ( "should provide __get__ as a non-enumerable property" , function ( ) {
74
- expect ( Object . keys ( rewire ( "./moduleA.js" ) ) . indexOf ( "__get__" ) ) . to . be ( - 1 )
75
- } ) ;
70
+ [ "__get__" , "__set__" , "__with__" ] . forEach ( function ( funcName ) {
71
+ it ( "should provide " + funcName + " as a non-enumerable property" , function ( ) {
72
+ expect ( Object . keys ( rewire ( "./moduleA.js" ) ) . indexOf ( funcName ) ) . to . be ( - 1 )
73
+ } ) ;
76
74
77
- it ( "should provide __with__ as a non-enumerable property" , function ( ) {
78
- expect ( Object . keys ( rewire ( "./moduleA.js" ) ) . indexOf ( "__with__" ) ) . to . be ( - 1 )
75
+ it ( "should provide " + funcName + " as a writable property" , function ( ) {
76
+ var obj = rewire ( "./moduleA.js" ) ;
77
+ var desc = Object . getOwnPropertyDescriptor ( obj , funcName ) ;
78
+ expect ( desc . writable ) . to . be ( true ) ;
79
+ } ) ;
79
80
} ) ;
80
81
81
82
it ( "should not influence other modules" , function ( ) {
You can’t perform that action at this time.
0 commit comments