sinon-chai
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -6,2 +6,3 @@ (function (sinonChai) { | ||
/* istanbul ignore else */ | ||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") { | ||
@@ -59,4 +60,8 @@ // NodeJS | ||
return { | ||
affirmative: printfArray(["expected %n to " + verbPhrase + action + nonNegatedSuffix].concat(args)), | ||
negative: printfArray(["expected %n to not " + verbPhrase + action].concat(args)) | ||
affirmative: function () { | ||
return printfArray(["expected %n to " + verbPhrase + action + nonNegatedSuffix].concat(args)); | ||
}, | ||
negative: function () { | ||
return printfArray(["expected %n to not " + verbPhrase + action].concat(args)); | ||
} | ||
}; | ||
@@ -63,0 +68,0 @@ } |
@@ -1,5 +0,11 @@ | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Copyright © 2012–2014 Domenic Denicola <domenic@domenicdenicola.com> | ||
This work is free. You can redistribute it and/or modify it under the | ||
terms of the Do What The Fuck You Want To Public License, Version 2, | ||
as published by Sam Hocevar. See below for more details. | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
Copyright © 2012–2014 Domenic Denicola <domenic@domenicdenicola.com> | ||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> | ||
@@ -14,2 +20,1 @@ Everyone is permitted to copy and distribute verbatim or modified | ||
0. You just DO WHAT THE FUCK YOU WANT TO. | ||
@@ -12,29 +12,29 @@ { | ||
], | ||
"version": "2.5.0", | ||
"author": "Domenic Denicola <domenic@domenicdenicola.com> (http://domenic.me)", | ||
"version": "2.6.0", | ||
"author": "Domenic Denicola <domenic@domenicdenicola.com> (http://domenic.me/)", | ||
"license": "WTFPL", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/domenic/sinon-chai.git" | ||
}, | ||
"bugs": "http://github.com/domenic/sinon-chai/issues", | ||
"repository": "domenic/sinon-chai", | ||
"main": "./lib/sinon-chai.js", | ||
"files": [ | ||
"LICENSE.txt", | ||
"lib/*" | ||
], | ||
"scripts": { | ||
"test": "mocha", | ||
"lint": "jshint ./lib", | ||
"cover": "cover run node_modules/mocha/bin/_mocha && cover report html && opener ./cover_html/index.html" | ||
"cover": "istanbul cover node_modules/mocha/bin/_mocha && opener ./coverage/lcov-report/lib/sinon-chai.js.html" | ||
}, | ||
"peerDependencies": { | ||
"chai": ">=1.0.0 <2", | ||
"chai": ">=1.9.2 <2", | ||
"sinon": ">=1.4.0 <2" | ||
}, | ||
"devDependencies": { | ||
"chai": "~1.8", | ||
"coffee-script": "~1.6", | ||
"cover": "~0.2.9", | ||
"jshint": "~2.4", | ||
"mocha": "~1.17", | ||
"opener": "~1.3", | ||
"sinon": "~1.7" | ||
"chai": "^1.9.2", | ||
"coffee-script": "~1.8.0", | ||
"istanbul": "~0.3.2", | ||
"jshint": "^2.5.6", | ||
"mocha": "^1.21.4", | ||
"opener": "^1.4.0", | ||
"sinon": "^1.10.3" | ||
} | ||
} |
@@ -23,5 +23,5 @@ # Sinon.JS Assertions for Chai | ||
mySpy.should.have.been.calledWith("foo"); | ||
expect(mySpy).to.have.been.calledWith("foo"); | ||
``` | ||
## Assertions | ||
@@ -131,3 +131,54 @@ | ||
## Examples | ||
Using Chai's `should`: | ||
```javascript | ||
"use strict"; | ||
var chai = require("chai"); | ||
var sinon = require("sinon"); | ||
var sinonChai = require("sinon-chai"); | ||
chai.should(); | ||
chai.use(sinonChai); | ||
function hello(name, cb) { | ||
cb("hello " + name); | ||
} | ||
describe("hello", function () { | ||
it("should call callback with correct greeting", function () { | ||
var cb = sinon.spy(); | ||
hello("foo", cb); | ||
cb.should.have.been.calledWith("hello foo"); | ||
}); | ||
}); | ||
``` | ||
Using Chai's `expect`: | ||
```javascript | ||
"use strict"; | ||
var chai = require("chai"); | ||
var sinon = require("sinon"); | ||
var sinonChai = require("sinon-chai"); | ||
var expect = chai.expect; | ||
chai.use(sinonChai); | ||
function hello(name, cb) { | ||
cb("hello " + name); | ||
} | ||
describe("hello", function () { | ||
it("should call callback with correct greeting", function () { | ||
var cb = sinon.spy(); | ||
hello("foo", cb); | ||
expect(cb).to.have.been.calledWith("hello foo"); | ||
}); | ||
}); | ||
``` | ||
## Installation and Usage | ||
@@ -134,0 +185,0 @@ |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
13554
109
237
1