Socket
Socket
Sign inDemoInstall

sinon

Package Overview
Dependencies
Maintainers
4
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinon - npm Package Compare versions

Comparing version 8.0.3 to 8.0.4

5

CHANGELOG.md
8.0.4 / 2020-01-06
==================
* Remove misleading 'own' from exception message
8.0.3 / 2020-01-06

@@ -3,0 +8,0 @@ ==================

50

lib/sinon/sandbox.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc