Socket
Socket
Sign inDemoInstall

sinon

Package Overview
Dependencies
Maintainers
2
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 1.5.0 to 1.5.2

10

Changelog.txt

@@ -0,1 +1,11 @@

== 1.5.2 / 2012-11-28
* Revert stub.reset changes that caused existing tests to fail.
== 1.5.1 / 2012-11-27
* Ensure window.Image can be stubbed. (Adrian Phinney)
* Fix spy() in IE 8 (Scott Andrews)
* Fix sinon base in IE 8 (Scott Andrews)
* Format arguments ouput when mock excpetation is not met (kbackowski)
* Calling spy.reset directly from stub.reset (Thomas Meyer)
== 1.5.0 / 2012-10-19

@@ -2,0 +12,0 @@ * Don't force "use strict" on Sinon consumers

11

lib/sinon.js

@@ -41,3 +41,3 @@ /*jslint eqeqeq: false, onevar: false, forin: true, nomen: false, regexp: false, plusplus: false*/

function isFunction(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply);
}

@@ -142,2 +142,6 @@

if ((a === null && b !== null) || (a !== null && b === null)) {
return false;
}
var aString = Object.prototype.toString.call(a);

@@ -286,4 +290,7 @@ if (aString != Object.prototype.toString.call(b)) {

if (value === null) {
return "null";
return "null";
}
else if (value === undefined) {
return "undefined";
}
var string = Object.prototype.toString.call(value);

@@ -290,0 +297,0 @@ return string.substring(8, string.length - 1).toLowerCase();

14

lib/sinon/mock.js

@@ -303,8 +303,8 @@ /**

sinon.expectation.fail(this.method + " received no arguments, expected " +
this.expectedArguments.join());
sinon.format(this.expectedArguments));
}
if (args.length < this.expectedArguments.length) {
sinon.expectation.fail(this.method + " received too few arguments (" + args.join() +
"), expected " + this.expectedArguments.join());
sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) +
"), expected " + sinon.format(this.expectedArguments));
}

@@ -314,4 +314,4 @@

args.length != this.expectedArguments.length) {
sinon.expectation.fail(this.method + " received too many arguments (" + args.join() +
"), expected " + this.expectedArguments.join());
sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) +
"), expected " + sinon.format(this.expectedArguments));
}

@@ -321,4 +321,4 @@

if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
sinon.expectation.fail(this.method + " received wrong arguments (" + args.join() +
"), expected " + this.expectedArguments.join());
sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
", expected " + sinon.format(this.expectedArguments));
}

@@ -325,0 +325,0 @@ }

@@ -108,9 +108,13 @@ /**

// Retain the function length:
var p;
if (func.length) {
return eval("(function proxy(" + vars.substring(0, func.length * 2 - 1) +
") { return proxy.invoke(func, this, slice.call(arguments)); })");
eval("p = (function proxy(" + vars.substring(0, func.length * 2 - 1) +
") { return p.invoke(func, this, slice.call(arguments)); });");
}
return function proxy() {
return proxy.invoke(func, this, slice.call(arguments));
};
else {
p = function proxy() {
return p.invoke(func, this, slice.call(arguments));
};
}
return p;
}

@@ -117,0 +121,0 @@

{
"name": "sinon",
"description": "JavaScript test spies, stubs and mocks.",
"version": "1.5.0",
"version": "1.5.2",
"homepage": "http://cjohansen.no/sinon/",

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

@@ -108,8 +108,13 @@ /*jslint onevar: false*/

"stub returns undefined when detached": function () {
var stub = sinon.stub.create();
stub.returnsThis();
"stub returns undefined when detached": {
requiresSupportFor: {
strictMode: (function () { return this; }()) === undefined
},
"": function () {
var stub = sinon.stub.create();
stub.returnsThis();
// Due to strict mode, would be `global` otherwise
assert.same(stub(), undefined);
// Due to strict mode, would be `global` otherwise
assert.same(stub(), undefined);
}
},

@@ -1380,3 +1385,15 @@

assert(decoy.notCalled);
},
"reset only resets call history": function () {
var obj = { a: function () {} };
var spy = sinon.spy();
sinon.stub(obj, "a").callsArg(1);
obj.a(null, spy);
obj.a.reset();
obj.a(null, spy);
assert(spy.calledTwice);
}
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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