Skip to content

Commit

Permalink
Fix regression on sandbox.stub(obj,protoMethod)
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 authored and Franck Romano committed Oct 1, 2019
1 parent 414002d commit 64e563e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/sinon/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ var collection = {
},

stub: function stub(object, property) {
if (object && typeof property !== "undefined" && !Object.prototype.hasOwnProperty.call(object, property)) {
if (object && typeof property !== "undefined"
&& !(property in object)) {
throw new TypeError("Cannot stub non-existent own property " + valueToString(property));
}

Expand Down

0 comments on commit 64e563e

Please sign in to comment.