New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

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 4.3.0 to 4.4.0

5

History.md
4.4.0 / 2018-02-23
==================
* Change return value of yield and callArg
4.3.0 / 2018-02-10

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

16

lib/sinon/call.js

@@ -101,11 +101,11 @@ "use strict";

callArg: function (pos) {
this.args[pos]();
return this.args[pos]();
},
callArgOn: function (pos, thisValue) {
this.args[pos].apply(thisValue);
return this.args[pos].apply(thisValue);
},
callArgWith: function (pos) {
this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1)));
return this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1)));
},

@@ -115,3 +115,3 @@

var args = slice.call(arguments, 2);
this.args[pos].apply(thisValue, args);
return this.args[pos].apply(thisValue, args);
},

@@ -132,3 +132,3 @@

"yield": function () {
this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0)));
return this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0)));
},

@@ -146,7 +146,7 @@

yieldFn.apply(thisValue, slice.call(arguments, 1));
return yieldFn.apply(thisValue, slice.call(arguments, 1));
},
yieldTo: function (prop) {
this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1)));
return this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1)));
},

@@ -166,3 +166,3 @@

yieldFn.apply(thisValue, slice.call(arguments, 2));
return yieldFn.apply(thisValue, slice.call(arguments, 2));
},

@@ -169,0 +169,0 @@

@@ -389,3 +389,3 @@ "use strict";

function delegateToCalls(method, matchAny, actual, notCalled, totalCallCount) {
function delegateToCalls(method, matchAny, actual, returnsValues, notCalled, totalCallCount) {
spyApi[method] = function () {

@@ -405,7 +405,9 @@ if (!this.called) {

var matches = 0;
var returnValues = [];
for (var i = 0, l = this.callCount; i < l; i += 1) {
currentCall = this.getCall(i);
if (currentCall[actual || method].apply(currentCall, arguments)) {
var returnValue = currentCall[actual || method].apply(currentCall, arguments);
returnValues.push(returnValue);
if (returnValue) {
matches += 1;

@@ -419,2 +421,5 @@

if (returnsValues) {
return returnValues;
}
return matches === this.callCount;

@@ -429,3 +434,3 @@ };

delegateToCalls("calledWith", true);
delegateToCalls("calledOnceWith", true, "calledWith", undefined, 1);
delegateToCalls("calledOnceWith", true, "calledWith", false, undefined, 1);
delegateToCalls("calledWithMatch", true);

@@ -435,8 +440,8 @@ delegateToCalls("alwaysCalledWith", false, "calledWith");

delegateToCalls("calledWithExactly", true);
delegateToCalls("calledOnceWithExactly", true, "calledWithExactly", undefined, 1);
delegateToCalls("calledOnceWithExactly", true, "calledWithExactly", false, undefined, 1);
delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly");
delegateToCalls("neverCalledWith", false, "notCalledWith", function () {
delegateToCalls("neverCalledWith", false, "notCalledWith", false, function () {
return true;
});
delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", function () {
delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", false, function () {
return true;

@@ -450,14 +455,14 @@ });

delegateToCalls("alwaysCalledWithNew", false, "calledWithNew");
delegateToCalls("callArg", false, "callArgWith", function () {
delegateToCalls("callArg", false, "callArgWith", true, function () {
throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
});
spyApi.callArgWith = spyApi.callArg;
delegateToCalls("callArgOn", false, "callArgOnWith", function () {
delegateToCalls("callArgOn", false, "callArgOnWith", true, function () {
throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
});
spyApi.callArgOnWith = spyApi.callArgOn;
delegateToCalls("throwArg", false, "throwArg", function () {
delegateToCalls("throwArg", false, "throwArg", false, function () {
throw new Error(this.toString() + " cannot throw arg since it was not yet invoked.");
});
delegateToCalls("yield", false, "yield", function () {
delegateToCalls("yield", false, "yield", true, function () {
throw new Error(this.toString() + " cannot yield since it was not yet invoked.");

@@ -467,10 +472,10 @@ });

spyApi.invokeCallback = spyApi.yield;
delegateToCalls("yieldOn", false, "yieldOn", function () {
delegateToCalls("yieldOn", false, "yieldOn", true, function () {
throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
});
delegateToCalls("yieldTo", false, "yieldTo", function (property) {
delegateToCalls("yieldTo", false, "yieldTo", true, function (property) {
throw new Error(this.toString() + " cannot yield to '" + valueToString(property) +
"' since it was not yet invoked.");
});
delegateToCalls("yieldToOn", false, "yieldToOn", function (property) {
delegateToCalls("yieldToOn", false, "yieldToOn", true, function (property) {
throw new Error(this.toString() + " cannot yield to '" + valueToString(property) +

@@ -477,0 +482,0 @@ "' since it was not yet invoked.");

{
"name": "sinon",
"description": "JavaScript test spies, stubs and mocks.",
"version": "4.3.0",
"version": "4.4.0",
"homepage": "http://sinonjs.org/",

@@ -6,0 +6,0 @@ "author": "Christian Johansen",

Sorry, the diff of this file is not supported yet

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