Comparing version 1.14.1 to 1.15.0
@@ -33,3 +33,3 @@ /** | ||
if (method.proxy) { | ||
if (method.proxy && method.proxy.isSinonProxy) { | ||
verifyIsStub(method.proxy); | ||
@@ -171,4 +171,5 @@ } else { | ||
mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called"); | ||
mirrorPropAsAssertion("notCalled", function (spy) { return !spy.called; }, | ||
"expected %n to not have been called but was called %c%C"); | ||
mirrorPropAsAssertion("notCalled", function (spy) { | ||
return !spy.called; | ||
}, "expected %n to not have been called but was called %c%C"); | ||
mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C"); | ||
@@ -175,0 +176,0 @@ mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C"); |
@@ -27,2 +27,6 @@ /** | ||
function mock(object) { | ||
if (typeof console !== undefined && console.warn) { | ||
console.warn("mock will be removed from Sinon.JS v2.0"); | ||
} | ||
if (!object) { | ||
@@ -29,0 +33,0 @@ return sinon.expectation.create("Anonymous mock"); |
@@ -86,2 +86,3 @@ /** | ||
} | ||
p.isSinonProxy = true; | ||
return p; | ||
@@ -347,6 +348,8 @@ } | ||
delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly"); | ||
delegateToCalls("neverCalledWith", false, "notCalledWith", | ||
function () { return true; }); | ||
delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", | ||
function () { return true; }); | ||
delegateToCalls("neverCalledWith", false, "notCalledWith", function () { | ||
return true; | ||
}); | ||
delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", function () { | ||
return true; | ||
}); | ||
delegateToCalls("threw", true); | ||
@@ -353,0 +356,0 @@ delegateToCalls("alwaysThrew", false, "threw"); |
@@ -52,3 +52,3 @@ /** | ||
for (var prop in object) { | ||
if (typeof object[prop] === "function") { | ||
if (typeof sinon.getPropertyDescriptor(object, prop).value === "function") { | ||
stub(object, prop); | ||
@@ -55,0 +55,0 @@ } |
@@ -44,7 +44,5 @@ /** | ||
function testCase(tests, prefix) { | ||
/*jsl:ignore*/ | ||
if (!tests || typeof tests != "object") { | ||
throw new TypeError("sinon.testCase needs an object with test functions"); | ||
} | ||
/*jsl:end*/ | ||
@@ -58,9 +56,5 @@ prefix = prefix || "test"; | ||
for (testName in tests) { | ||
if (tests.hasOwnProperty(testName)) { | ||
if (tests.hasOwnProperty(testName) && !/^(setUp|tearDown)$/.test(testName)) { | ||
property = tests[testName]; | ||
if (/^(setUp|tearDown)$/.test(testName)) { | ||
continue; | ||
} | ||
if (typeof property == "function" && rPrefix.test(testName)) { | ||
@@ -67,0 +61,0 @@ method = property; |
@@ -146,2 +146,3 @@ /** | ||
if (!owned) { | ||
// In some cases `delete` may throw an error | ||
try { | ||
@@ -152,7 +153,2 @@ delete object[property]; | ||
// on Chrome < 43, PhantomJS, etc. | ||
// Use strict equality comparison to check failures then force a reset | ||
// via direct assignment. | ||
if (object[property] === method) { | ||
object[property] = wrappedMethod; | ||
} | ||
} else if (hasES5Support) { | ||
@@ -162,3 +158,5 @@ Object.defineProperty(object, property, wrappedMethodDesc); | ||
if (!hasES5Support && object[property] === method) { | ||
// Use strict equality comparison to check failures then force a reset | ||
// via direct assignment. | ||
if (object[property] === method) { | ||
object[property] = wrappedMethod; | ||
@@ -165,0 +163,0 @@ } |
@@ -154,3 +154,5 @@ /** | ||
if (!this.responses) { this.responses = []; } | ||
if (!this.responses) { | ||
this.responses = []; | ||
} | ||
@@ -157,0 +159,0 @@ if (arguments.length == 1) { |
@@ -223,2 +223,2 @@ /** | ||
} | ||
})(this); | ||
})(typeof global !== "undefined" ? global : self); |
@@ -21,2 +21,3 @@ /** | ||
var supportsCustomEvent = typeof CustomEvent !== "undefined"; | ||
var supportsFormData = typeof FormData !== "undefined"; | ||
var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest }; | ||
@@ -28,3 +29,5 @@ sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest; | ||
sinonXhr.workingXHR = sinonXhr.supportsXHR ? sinonXhr.GlobalXMLHttpRequest : sinonXhr.supportsActiveX | ||
? function () { return new sinonXhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0") } : false; | ||
? function () { | ||
return new sinonXhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0") | ||
} : false; | ||
sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest()); | ||
@@ -370,9 +373,4 @@ | ||
this.dispatchEvent(new sinon.Event("readystatechange")); | ||
switch (this.readyState) { | ||
case FakeXMLHttpRequest.DONE: | ||
this.dispatchEvent(new sinon.Event("load", false, false, this)); | ||
this.dispatchEvent(new sinon.Event("loadend", false, false, this)); | ||
this.upload.dispatchEvent(new sinon.Event("load", false, false, this)); | ||
if (supportsProgress) { | ||
@@ -382,4 +380,9 @@ this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); | ||
} | ||
this.upload.dispatchEvent(new sinon.Event("load", false, false, this)); | ||
this.dispatchEvent(new sinon.Event("load", false, false, this)); | ||
this.dispatchEvent(new sinon.Event("loadend", false, false, this)); | ||
break; | ||
} | ||
this.dispatchEvent(new sinon.Event("readystatechange")); | ||
}, | ||
@@ -428,3 +431,3 @@ | ||
this.requestHeaders[contentType] = value[0] + ";charset=utf-8"; | ||
} else if (!(data instanceof FormData)) { | ||
} else if (supportsFormData && !(data instanceof FormData)) { | ||
this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; | ||
@@ -452,2 +455,3 @@ } | ||
this.requestHeaders = {}; | ||
this.responseHeaders = {}; | ||
@@ -626,2 +630,2 @@ if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) { | ||
})(typeof global !== "undefined" ? global : this); | ||
})(typeof global !== "undefined" ? global : self); |
@@ -14,18 +14,20 @@ /** | ||
*/ | ||
function setTimeout() {} | ||
function clearTimeout() {} | ||
function setImmediate() {} | ||
function clearImmediate() {} | ||
function setInterval() {} | ||
function clearInterval() {} | ||
function Date() {} | ||
if (typeof window !== "undefined") { | ||
function setTimeout() {} | ||
function clearTimeout() {} | ||
function setImmediate() {} | ||
function clearImmediate() {} | ||
function setInterval() {} | ||
function clearInterval() {} | ||
function Date() {} | ||
// Reassign the original functions. Now their writable attribute | ||
// should be true. Hackish, I know, but it works. | ||
setTimeout = sinon.timers.setTimeout; | ||
clearTimeout = sinon.timers.clearTimeout; | ||
setImmediate = sinon.timers.setImmediate; | ||
clearImmediate = sinon.timers.clearImmediate; | ||
setInterval = sinon.timers.setInterval; | ||
clearInterval = sinon.timers.clearInterval; | ||
Date = sinon.timers.Date; | ||
// Reassign the original functions. Now their writable attribute | ||
// should be true. Hackish, I know, but it works. | ||
setTimeout = sinon.timers.setTimeout; | ||
clearTimeout = sinon.timers.clearTimeout; | ||
setImmediate = sinon.timers.setImmediate; | ||
clearImmediate = sinon.timers.clearImmediate; | ||
setInterval = sinon.timers.setInterval; | ||
clearInterval = sinon.timers.clearInterval; | ||
Date = sinon.timers.Date; | ||
} |
@@ -9,6 +9,8 @@ /** | ||
*/ | ||
function XDomainRequest() {} | ||
if (typeof window !== "undefined") { | ||
function XDomainRequest() {} | ||
// Reassign the original function. Now its writable attribute | ||
// should be true. Hackish, I know, but it works. | ||
XDomainRequest = sinon.xdr.XDomainRequest || undefined; | ||
// Reassign the original function. Now its writable attribute | ||
// should be true. Hackish, I know, but it works. | ||
XDomainRequest = sinon.xdr.XDomainRequest || undefined; | ||
} |
@@ -14,6 +14,8 @@ /** | ||
*/ | ||
function XMLHttpRequest() {} | ||
if (typeof window !== "undefined") { | ||
function XMLHttpRequest() {} | ||
// Reassign the original function. Now its writable attribute | ||
// should be true. Hackish, I know, but it works. | ||
XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined; | ||
// Reassign the original function. Now its writable attribute | ||
// should be true. Hackish, I know, but it works. | ||
XMLHttpRequest = sinon.xhr.XMLHttpRequest || undefined; | ||
} |
{ | ||
"name": "sinon", | ||
"description": "JavaScript test spies, stubs and mocks.", | ||
"version": "1.14.1", | ||
"homepage": "http://cjohansen.no/sinon/", | ||
"version": "1.15.0", | ||
"homepage": "http://sinonjs.org/", | ||
"author": "Christian Johansen", | ||
@@ -15,11 +15,7 @@ "repository": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "BSD", | ||
"url": "http://github.com/cjohansen/Sinon.JS/blob/master/LICENSE" | ||
} | ||
], | ||
"license": "BSD-3-Clause", | ||
"scripts": { | ||
"test": "node test/node/run.js", | ||
"lint": "jscs **/*.js", | ||
"ci-test": "./scripts/ci-test.sh", | ||
"test": "npm run lint && ./scripts/ci-test.sh", | ||
"lint": "jscs .", | ||
"prepublish": "./build" | ||
@@ -30,13 +26,13 @@ }, | ||
"util": ">=0.10.3 <1", | ||
"lolex": "1.1.0" | ||
"lolex": "1.1.0", | ||
"samsam": "1.1.2" | ||
}, | ||
"devDependencies": { | ||
"buster-core": ">=0.6.4", | ||
"buster-assertions": "~0.10", | ||
"buster-evented-logger": "~0.4", | ||
"buster-test": "~0.5", | ||
"buster-format": "~0.5.6", | ||
"http-server": "*", | ||
"jscs": "~1.5.9" | ||
"buster": "0.7.18", | ||
"jscs": "1.11.3", | ||
"buster-istanbul": "0.1.13" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"main": "./lib/sinon.js", | ||
@@ -43,0 +39,0 @@ "engines": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
3
0
0
2
186990
4
31
4085
+ Addedsamsam@1.1.2
+ Addedsamsam@1.1.2(transitive)
- Removedsamsam@1.1.3(transitive)