Comparing version 8.0.3 to 8.0.4
8.0.4 / 2020-01-06 | ||
================== | ||
* Remove misleading 'own' from exception message | ||
8.0.3 / 2020-01-06 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -6,5 +6,3 @@ "use strict"; | ||
var getPropertyDescriptor = require("./util/core/get-property-descriptor"); | ||
var isEsModule = require("./util/core/is-es-module"); | ||
var isPropertyConfigurable = require("./util/core/is-property-configurable"); | ||
var isNonExistentOwnProperty = require("./util/core/is-non-existent-own-property"); | ||
var match = require("@sinonjs/samsam").createMatcher; | ||
@@ -216,3 +214,3 @@ var sinonAssert = require("./assert"); | ||
if (typeof descriptor === "undefined") { | ||
throw new TypeError("Cannot replace non-existent own property " + valueToString(property)); | ||
throw new TypeError("Cannot replace non-existent property " + valueToString(property)); | ||
} | ||
@@ -250,3 +248,3 @@ | ||
if (typeof descriptor === "undefined") { | ||
throw new TypeError("Cannot replace non-existent own property " + valueToString(property)); | ||
throw new TypeError("Cannot replace non-existent property " + valueToString(property)); | ||
} | ||
@@ -279,3 +277,3 @@ | ||
if (typeof descriptor === "undefined") { | ||
throw new TypeError("Cannot replace non-existent own property " + valueToString(property)); | ||
throw new TypeError("Cannot replace non-existent property " + valueToString(property)); | ||
} | ||
@@ -305,25 +303,11 @@ | ||
sandbox.spy = function spy() { | ||
var s = sinonSpy.apply(sinonSpy, arguments); | ||
function commonPostInitSetup(args, spy) { | ||
var object = args[0]; | ||
var property = args[1]; | ||
push(collection, s); | ||
var isSpyingOnEntireObject = typeof property === "undefined" && typeof object === "object"; | ||
return s; | ||
}; | ||
if (isSpyingOnEntireObject) { | ||
var ownMethods = collectOwnMethods(spy); | ||
sandbox.stub = function stub(object, property) { | ||
if (isEsModule(object)) { | ||
throw new TypeError("ES Modules cannot be stubbed"); | ||
} | ||
if (isNonExistentOwnProperty(object, property)) { | ||
throw new TypeError("Cannot stub non-existent own property " + valueToString(property)); | ||
} | ||
var stubbed = sinonStub.apply(null, arguments); | ||
var isStubbingEntireObject = typeof property === "undefined" && typeof object === "object"; | ||
if (isStubbingEntireObject) { | ||
var ownMethods = collectOwnMethods(stubbed); | ||
forEach(ownMethods, function(method) { | ||
@@ -335,9 +319,19 @@ push(collection, method); | ||
} else { | ||
push(collection, stubbed); | ||
usePromiseLibrary(promiseLib, stubbed); | ||
push(collection, spy); | ||
usePromiseLibrary(promiseLib, spy); | ||
} | ||
return stubbed; | ||
return spy; | ||
} | ||
sandbox.spy = function spy() { | ||
var createdSpy = sinonSpy.apply(sinonSpy, arguments); | ||
return commonPostInitSetup(arguments, createdSpy); | ||
}; | ||
sandbox.stub = function stub() { | ||
var createdStub = sinonStub.apply(sinonStub, arguments); | ||
return commonPostInitSetup(arguments, createdStub); | ||
}; | ||
// eslint-disable-next-line no-unused-vars | ||
@@ -344,0 +338,0 @@ sandbox.fake = function fake(f) { |
{ | ||
"name": "sinon", | ||
"description": "JavaScript test spies, stubs and mocks.", | ||
"version": "8.0.3", | ||
"version": "8.0.4", | ||
"homepage": "https://sinonjs.org/", | ||
@@ -6,0 +6,0 @@ "author": "Christian Johansen", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4667759
54091