@cypress/sinon-chai
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -0,4 +1,5 @@ | ||
"use strict"; | ||
/* eslint-disable no-invalid-this */ | ||
(function (sinonChai) { | ||
"use strict"; | ||
// Module systems magic dance. | ||
@@ -17,7 +18,6 @@ | ||
// Other environment (usually <script> tag): plug in to global chai instance directly. | ||
/* global chai: false */ | ||
chai.use(sinonChai); | ||
} | ||
}(function sinonChai(chai, utils) { | ||
"use strict"; | ||
}(function (chai, utils) { | ||
var slice = Array.prototype.slice; | ||
@@ -35,6 +35,16 @@ | ||
function timesInWords(count) { | ||
return count === 1 ? "once" : | ||
count === 2 ? "twice" : | ||
count === 3 ? "thrice" : | ||
(count || 0) + " times"; | ||
switch (count) { | ||
case 1: { | ||
return "once"; | ||
} | ||
case 2: { | ||
return "twice"; | ||
} | ||
case 3: { | ||
return "thrice"; | ||
} | ||
default: { | ||
return (count || 0) + " times"; | ||
} | ||
} | ||
} | ||
@@ -55,3 +65,3 @@ | ||
passedSuffix = passedSuffix || ""; | ||
failedSuffix = failedSuffix || ""; | ||
failedSuffix = failedSuffix || ""; | ||
@@ -63,8 +73,8 @@ if (isSpy(spy.proxy)) { | ||
if (spy.getCalls().length) { | ||
// if there were calls, display them in case of a failure | ||
failedSuffix += callsSuffix; | ||
// 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; | ||
// Otherwise, replace the entire failed suffix with message that | ||
// there were no calls | ||
failedSuffix = noCallsSuffix; | ||
} | ||
@@ -117,5 +127,5 @@ | ||
var shouldBeAlways = utils.flag(this, "always") && typeof this._obj[alwaysSinonMethod] === "function"; | ||
var sinonMethod = shouldBeAlways ? alwaysSinonMethod : sinonName; | ||
var sinonMethodName = shouldBeAlways ? alwaysSinonMethod : sinonName; | ||
var expression = this._obj[sinonMethod].apply(this._obj, arguments); | ||
var expression = this._obj[sinonMethodName].apply(this._obj, arguments); | ||
var passed = utils.test(this, [expression]); | ||
@@ -158,4 +168,6 @@ var messages = getMessages(passed, | ||
sinonMethod("calledWithMatch", "been called with arguments matching %*"); | ||
sinonMethod("calledImmediatelyBefore", "been called immediately before %1"); | ||
sinonMethod("calledImmediatelyAfter", "been called immediately after %1"); | ||
sinonMethod("returned", "returned %1"); | ||
exceptionalSinonMethod("thrown", "threw", "thrown %1"); | ||
})); |
@@ -5,3 +5,3 @@ Dual licensed under WTFPL and BSD: | ||
Copyright © 2012–2015 Domenic Denicola <d@domenic.me> | ||
Copyright © 2012–2017 Domenic Denicola <d@domenic.me> | ||
@@ -28,3 +28,3 @@ This work is free. You can redistribute it and/or modify it under the | ||
Copyright © 2012–2015, Domenic Denicola <d@domenic.me> | ||
Copyright © 2012–2017, Domenic Denicola <d@domenic.me> | ||
All rights reserved. | ||
@@ -31,0 +31,0 @@ |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"author": "Domenic Denicola <d@domenic.me> (https://domenic.me/)", | ||
@@ -27,8 +27,5 @@ "license": "(BSD-2-Clause OR WTFPL)", | ||
"pretest": "npm run lint", | ||
"test": "npm run test-chai-1-9-2 && npm run test-chai-2-3-0 && npm run test-chai-3-0-0", | ||
"test-current-chai": "mocha", | ||
"test-chai-1-9-2": "npm install chai@1.9.2 && mocha", | ||
"test-chai-2-3-0": "npm install chai@2.3.0 && mocha", | ||
"test-chai-3-0-0": "npm install chai@3.0.0 && mocha", | ||
"lint": "jshint ./lib", | ||
"test": "mocha", | ||
"test-travis": "npm install chai@$CHAI_VERSION && npm install sinon@$SINON_VERSION && npm test", | ||
"lint": "eslint .", | ||
"cover": "istanbul cover node_modules/mocha/bin/_mocha && opener ./coverage/lcov-report/lib/sinon-chai.js.html", | ||
@@ -38,18 +35,14 @@ "commit": "commit-wizard", | ||
}, | ||
"peerDependencies": { | ||
"chai": ">=1.9.2 <4", | ||
"sinon": ">=1.4.0 <2" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.0.0", | ||
"chai": "^4.0.2", | ||
"coffee-script": "~1.8.0", | ||
"condition-circle": "^1.5.0", | ||
"istanbul": "~0.3.2", | ||
"jshint": "^2.5.6", | ||
"mocha": "^1.21.4", | ||
"opener": "^1.4.0", | ||
"eslint": "^3.19.0", | ||
"istanbul": "~0.4.5", | ||
"mocha": "^3.4.2", | ||
"opener": "^1.4.3", | ||
"pre-git": "^3.15.0", | ||
"semantic-release": "^6.3.6", | ||
"simple-commit-message": "^3.0.2", | ||
"sinon": "^1.10.3" | ||
"sinon": "^2.3.4", | ||
"simple-commit-message": "^3.0.2" | ||
}, | ||
@@ -56,0 +49,0 @@ "release": { |
@@ -71,2 +71,10 @@ # Sinon.JS Assertions for Chai | ||
<tr> | ||
<td>calledImmediatelyBefore</td> | ||
<td>spy.should.have.been.calledImmediatelyBefore(spy2)</td> | ||
</tr> | ||
<tr> | ||
<td>calledImmediatelyAfter</td> | ||
<td>spy.should.have.been.calledImmediatelyAfter(spy2)</td> | ||
</tr> | ||
<tr> | ||
<td>calledWithNew</td> | ||
@@ -73,0 +81,0 @@ <td>spy.should.have.been.calledWithNew</td> |
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
18129
0
143
263