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.9.1 to 1.10.0

lib/sinon/util/fake_xdomain_request.js

49

lib/sinon.js

@@ -76,9 +76,5 @@ /*jslint eqeqeq: false, onevar: false, forin: true, nomen: false, regexp: false, plusplus: false*/

property + " as function");
}
if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
} else if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
}
if (wrappedMethod.calledBefore) {
} else if (wrappedMethod.calledBefore) {
var verb = !!wrappedMethod.returns ? "stubbed" : "spied on";

@@ -89,3 +85,3 @@ error = new TypeError("Attempted to wrap " + property + " which is already " + verb);

if (error) {
if (wrappedMethod._stack) {
if (wrappedMethod && wrappedMethod._stack) {
error.stack += '\n--------------\n' + wrappedMethod._stack;

@@ -195,2 +191,6 @@ }

if (!(prop in b)) {
return false;
}
if (!deepEqual(a[prop], b[prop])) {

@@ -341,9 +341,22 @@ return false;

var isNode = typeof module !== "undefined" && module.exports;
var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
var isAMD = typeof define === 'function' && typeof define.amd === 'object' && define.amd;
function makePublicAPI(require, exports, module) {
module.exports = sinon;
sinon.spy = require("./sinon/spy");
sinon.spyCall = require("./sinon/call");
sinon.behavior = require("./sinon/behavior");
sinon.stub = require("./sinon/stub");
sinon.mock = require("./sinon/mock");
sinon.collection = require("./sinon/collection");
sinon.assert = require("./sinon/assert");
sinon.sandbox = require("./sinon/sandbox");
sinon.test = require("./sinon/test");
sinon.testCase = require("./sinon/test_case");
sinon.match = require("./sinon/match");
}
if (isAMD) {
define(function(){
return sinon;
});
define(makePublicAPI);
} else if (isNode) {

@@ -353,15 +366,3 @@ try {

} catch (e) {}
module.exports = sinon;
module.exports.spy = require("./sinon/spy");
module.exports.spyCall = require("./sinon/call");
module.exports.behavior = require("./sinon/behavior");
module.exports.stub = require("./sinon/stub");
module.exports.mock = require("./sinon/mock");
module.exports.collection = require("./sinon/collection");
module.exports.assert = require("./sinon/assert");
module.exports.sandbox = require("./sinon/sandbox");
module.exports.test = require("./sinon/test");
module.exports.testCase = require("./sinon/test_case");
module.exports.assert = require("./sinon/assert");
module.exports.match = require("./sinon/match");
makePublicAPI(require, exports, module);
}

@@ -368,0 +369,0 @@

@@ -18,3 +18,3 @@ /**

(function (sinon, global) {
var commonJSModule = typeof module !== "undefined" && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
var slice = Array.prototype.slice;

@@ -193,7 +193,9 @@ var assert;

if (commonJSModule) {
sinon.assert = assert;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = assert; });
} else if (commonJSModule) {
module.exports = assert;
} else {
sinon.assert = assert;
}
}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global));

@@ -18,3 +18,3 @@ /**

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";

@@ -328,7 +328,9 @@ if (!sinon && commonJSModule) {

if (commonJSModule) {
sinon.behavior = proto;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = proto; });
} else if (commonJSModule) {
module.exports = proto;
} else {
sinon.behavior = proto;
}
}(typeof sinon == "object" && sinon || null));
}(typeof sinon == "object" && sinon || null));

@@ -20,3 +20,3 @@ /**

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
if (!sinon && commonJSModule) {

@@ -198,8 +198,10 @@ sinon = require("../sinon");

if (commonJSModule) {
sinon.spyCall = createSpyCall;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = createSpyCall; });
} else if (commonJSModule) {
module.exports = createSpyCall;
} else {
sinon.spyCall = createSpyCall;
}
}(typeof sinon == "object" && sinon || null));

@@ -19,3 +19,3 @@ /**

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
var push = [].push;

@@ -149,7 +149,9 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;

if (commonJSModule) {
sinon.collection = collection;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = collection; });
} else if (commonJSModule) {
module.exports = collection;
} else {
sinon.collection = collection;
}
}(typeof sinon == "object" && sinon || null));

@@ -15,3 +15,3 @@ /* @depend ../sinon.js */

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";

@@ -239,7 +239,9 @@ if (!sinon && commonJSModule) {

if (commonJSModule) {
sinon.match = match;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = match; });
} else if (commonJSModule) {
module.exports = match;
} else {
sinon.match = match;
}
}(typeof sinon == "object" && sinon || null));

@@ -18,3 +18,3 @@ /**

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
var push = [].push;

@@ -445,7 +445,9 @@ var match;

if (commonJSModule) {
sinon.mock = mock;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = mock; });
} else if (commonJSModule) {
module.exports = mock;
} else {
sinon.mock = mock;
}
}(typeof sinon == "object" && sinon || null));

@@ -20,3 +20,3 @@ /**

if (typeof module !== 'undefined' && module.exports) {
if (typeof module !== "undefined" && module.exports && typeof require == "function") {
var sinon = require("../sinon");

@@ -140,5 +140,7 @@ sinon.extend(sinon, require("./util/fake_timers"));

if (typeof module !== 'undefined' && module.exports) {
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = sinon.sandbox; });
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = sinon.sandbox;
}
}());

@@ -18,3 +18,3 @@ /**

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";
var push = Array.prototype.push;

@@ -150,2 +150,4 @@ var slice = Array.prototype.slice;

createCallProperties.call(this);
try {

@@ -169,4 +171,2 @@ if (matching) {

createCallProperties.call(this);
if (exception !== undefined) {

@@ -179,2 +179,7 @@ throw exception;

named: function named(name) {
this.displayName = name;
return this;
},
getCall: function getCall(i) {

@@ -405,8 +410,9 @@ if (i < 0 || i >= this.callCount) {

spy.spyCall = sinon.spyCall;
sinon.spy = spy;
if (commonJSModule) {
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = spy; });
} else if (commonJSModule) {
module.exports = spy;
} else {
sinon.spy = spy;
}
}(typeof sinon == "object" && sinon || null));

@@ -19,3 +19,3 @@ /**

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";

@@ -155,7 +155,9 @@ if (!sinon && commonJSModule) {

if (commonJSModule) {
sinon.stub = stub;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = stub; });
} else if (commonJSModule) {
module.exports = stub;
} else {
sinon.stub = stub;
}
}(typeof sinon == "object" && sinon || null));

@@ -18,3 +18,3 @@ /**

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";

@@ -93,7 +93,9 @@ if (!sinon && commonJSModule) {

if (commonJSModule) {
sinon.testCase = testCase;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = testCase; });
} else if (commonJSModule) {
module.exports = testCase;
} else {
sinon.testCase = testCase;
}
}(typeof sinon == "object" && sinon || null));

@@ -20,3 +20,3 @@ /**

(function (sinon) {
var commonJSModule = typeof module !== 'undefined' && module.exports;
var commonJSModule = typeof module !== "undefined" && module.exports && typeof require == "function";

@@ -71,7 +71,9 @@ if (!sinon && commonJSModule) {

if (commonJSModule) {
sinon.test = test;
if (typeof define === "function" && define.amd) {
define(["module"], function(module) { module.exports = test; });
} else if (commonJSModule) {
module.exports = test;
} else {
sinon.test = test;
}
}(typeof sinon == "object" && sinon || null));

@@ -169,3 +169,3 @@ /**

var queue = this.queue || [];
var requests = queue.splice(0);
var requests = queue.splice(0, queue.length);
var request;

@@ -172,0 +172,0 @@

@@ -141,3 +141,7 @@ /*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/

}
// in Node, timerId is an object with .ref()/.unref(), and
// its .id field is the actual timer id.
if (typeof timerId === 'object') {
timerId = timerId.id
}
if (timerId in this.timeouts) {

@@ -144,0 +148,0 @@ delete this.timeouts[timerId];

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

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

/**
* Sinon.JS 1.9.1, 2014/04/03
* Sinon.JS 1.10.0, 2014/05/19
*

@@ -87,1 +87,15 @@ * @author Christian Johansen (christian@cjohansen.no)

XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined;
/*global sinon*/
/**
* Helps IE run the fake XDomainRequest. By defining global functions, IE allows
* them to be overwritten at a later point. If these are not defined like
* this, overwriting them will result in anything from an exception to browser
* crash.
*
* If you don't require fake XDR to work in IE, don't include this file.
*/
function XDomainRequest() {}
// Reassign the original function. Now its writable attribute
// should be true. Hackish, I know, but it works.
XDomainRequest = sinon.xdr.XDomainRequest || undefined;

@@ -48,2 +48,10 @@ /*jslint onevar: false, eqeqeq: false*/

});
try {
sinon.wrapMethod(object, "prop", function () {});
throw new Error("Didn't throw");
} catch (e) {
assert.match(e.message,
/Attempted to wrap .* property .* as function/);
}
},

@@ -348,3 +356,2 @@

assert.isFalse(sinon.deepEqual(regexp1, regexp2));
},

@@ -357,3 +364,2 @@

assert(sinon.deepEqual(regexp1, regexp2));
},

@@ -366,3 +372,2 @@

assert.isFalse(sinon.deepEqual(regexp1, regexp2));
},

@@ -381,2 +386,16 @@

"fails unequal objects with undefined properties with different names": function () {
var obj1 = {a: 1, b: 2, c: 3};
var obj2 = {a: 1, b: 2, foo: undefined};
assert.isFalse(sinon.deepEqual(obj1, obj2));
},
"fails unequal objects with undefined properties with different names (different arg order)": function () {
var obj1 = {a: 1, b: 2, foo: undefined};
var obj2 = {a: 1, b: 2, c: 3};
assert.isFalse(sinon.deepEqual(obj1, obj2));
},
"passes equal dates": function () {

@@ -383,0 +402,0 @@ var date1 = new Date(2012, 3, 5);

@@ -272,3 +272,3 @@ /*jslint onevar: false*/

"nots be met with too few calls": function () {
"should not be met with too few calls": function () {
this.expectation.atLeast(2);

@@ -297,3 +297,3 @@ this.expectation();

"nots throw when exceeding at least expectation": function () {
"should not throw when exceeding at least expectation": function () {
var obj = { foobar: function () {} };

@@ -357,3 +357,3 @@ var mock = sinon.mock(obj);

"nots be met with excessive calls": function () {
"should not be met with excessive calls": function () {
var expectation = this.expectation;

@@ -378,3 +378,3 @@ this.expectation.atMost(2);

"nots be met with too few calls": function () {
"should not be met with too few calls": function () {
this.expectation();

@@ -413,3 +413,3 @@

"met": {
"nots be met when not called enough times": function () {
"should not be met when not called enough times": function () {
assert.isFalse(this.expectation.met());

@@ -424,3 +424,3 @@ },

"nots be met when called too many times": function () {
"should not be met when called too many times": function () {
this.expectation();

@@ -555,3 +555,3 @@

"nots allow excessive args": function () {
"should not allow excessive args": function () {
var expectation = this.expectation;

@@ -558,0 +558,0 @@ expectation.withExactArgs(1, 2, 3);

@@ -40,6 +40,9 @@ /*jslint onevar: false, eqeqeq: false, plusplus: false*/

"returns numeric id": function () {
"returns numeric id or object with numeric id": function () {
var result = this.clock.setTimeout("");
assert.isNumber(result);
if (typeof result === 'object')
assert.isNumber(result.id);
else
assert.isNumber(result);
},

@@ -103,6 +106,9 @@

"returns numeric id": function () {
"returns numeric id or object with numeric id": function () {
var result = this.clock.setImmediate(function () { });
assert.isNumber(result);
if (typeof result === 'object')
assert.isNumber(result.id);
else
assert.isNumber(result);
},

@@ -545,6 +551,9 @@

"returns numeric id": function () {
"returns numeric id or object with numeric id": function () {
var result = this.clock.setInterval("");
assert.isNumber(result);
if (typeof result === 'object')
assert.isNumber(result.id);
else
assert.isNumber(result);
},

@@ -551,0 +560,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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