File tree 2 files changed +5
-2
lines changed
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ var defaultBehaviors = {
258
258
Object . defineProperty ( rootStub . rootObj , rootStub . propName , {
259
259
value : newVal ,
260
260
enumerable : true ,
261
- configurable : isPropertyConfigurable ( rootStub . rootObj , rootStub . propName )
261
+ configurable : rootStub . shadowsPropOnPrototype || isPropertyConfigurable ( rootStub . rootObj , rootStub . propName )
262
262
} ) ;
263
263
264
264
return fake ;
Original file line number Diff line number Diff line change @@ -94,11 +94,14 @@ function stub(object, property) {
94
94
var func = typeof actualDescriptor . value === "function" ? actualDescriptor . value : null ;
95
95
var s = createStub ( func ) ;
96
96
97
+ var propIsOwn = Boolean ( actualDescriptor . isOwn ) ;
98
+
97
99
extend . nonEnum ( s , {
98
100
rootObj : object ,
99
101
propName : property ,
102
+ shadowsPropOnPrototype : ! propIsOwn ,
100
103
restore : function restore ( ) {
101
- if ( actualDescriptor !== undefined ) {
104
+ if ( actualDescriptor !== undefined && propIsOwn ) {
102
105
Object . defineProperty ( object , property , actualDescriptor ) ;
103
106
return ;
104
107
}
You can’t perform that action at this time.
0 commit comments