@cypress/sinon-chai
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -24,2 +24,5 @@ (function (sinonChai) { | ||
var callsSuffix = "\n\n The following calls were made:\n%C"; | ||
var noCallsSuffix = ", but it was never called"; | ||
function isSpy(putativeSpy) { | ||
@@ -52,2 +55,3 @@ return typeof putativeSpy === "function" && | ||
failedSuffix = failedSuffix || ""; | ||
if (isSpy(spy.proxy)) { | ||
@@ -57,2 +61,11 @@ spy = spy.proxy; | ||
if (spy.getCalls().length) { | ||
// if there were calls, display them in case of a failure | ||
failedSuffix += callsSuffix; | ||
} else { | ||
// otherwise, replace the entire failed suffix with message that | ||
// there were no calls | ||
failedSuffix = noCallsSuffix; | ||
} | ||
function printfArray(array) { | ||
@@ -131,9 +144,7 @@ return spy.printf.apply(spy, array); | ||
var calls = "\n\n The following calls were made:\n%C"; | ||
sinonProperty("called", "been called", " at least once", " at least once, but it was never called"); | ||
sinonPropertyAsBooleanMethod("callCount", "been called exactly %1", "", ", but it was called %c" + calls); | ||
sinonProperty("calledOnce", "been called exactly once", "", ", but it was called %c" + calls); | ||
sinonProperty("calledTwice", "been called exactly twice", "", ", but it was called %c" + calls); | ||
sinonProperty("calledThrice", "been called exactly thrice", "", ", but it was called %c" + calls); | ||
sinonProperty("called", "been called at least once"); | ||
sinonPropertyAsBooleanMethod("callCount", "been called exactly %1", "", ", but it was called %c"); | ||
sinonProperty("calledOnce", "been called exactly once", "", ", but it was called %c"); | ||
sinonProperty("calledTwice", "been called exactly twice", "", ", but it was called %c"); | ||
sinonProperty("calledThrice", "been called exactly thrice", "", ", but it was called %c"); | ||
sinonMethodAsProperty("calledWithNew", "been called with new"); | ||
@@ -143,7 +154,7 @@ sinonMethod("calledBefore", "been called before %1"); | ||
sinonMethod("calledOn", "been called with %1 as this", "", ", but it was called with %t instead"); | ||
sinonMethod("calledWith", "been called with arguments %*", "", calls); | ||
sinonMethod("calledWithExactly", "been called with exact arguments %*", "", calls); | ||
sinonMethod("calledWithMatch", "been called with arguments matching %*", "", calls); | ||
sinonMethod("calledWith", "been called with arguments %*"); | ||
sinonMethod("calledWithExactly", "been called with exact arguments %*"); | ||
sinonMethod("calledWithMatch", "been called with arguments matching %*"); | ||
sinonMethod("returned", "returned %1"); | ||
exceptionalSinonMethod("thrown", "threw", "thrown %1"); | ||
})); |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Domenic Denicola <d@domenic.me> (https://domenic.me/)", | ||
@@ -61,3 +61,5 @@ "license": "(BSD-2-Clause OR WTFPL)", | ||
"commit-msg": "simple", | ||
"pre-commit": [], | ||
"pre-commit": [ | ||
"npm test" | ||
], | ||
"pre-push": [], | ||
@@ -64,0 +66,0 @@ "post-commit": [], |
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
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
17726
130