Skip to content

Commit 293401a

Browse files
dostudomenic
authored andcommitted
Add support for sinon v5
Closes #120.
1 parent 31ec838 commit 293401a

File tree

6 files changed

+90
-84
lines changed

6 files changed

+90
-84
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
language: node_js
22
node_js:
3-
- 4
3+
- 6
4+
- 8
5+
- 9
6+
- 10
47
- stable
58
env:
6-
# This matrix used to be larger. In 3.0.0 we moved to only supporting these versions.
7-
# But, we'll retain the infrastructure for a larger matrix, in case we need it in the future.
9+
- CHAI_VERSION=^4.0.0 SINON_VERSION=^5.0.0
810
- CHAI_VERSION=^4.0.0 SINON_VERSION=^4.0.0
911
script:
1012
- npm run lint

package-lock.json

Lines changed: 56 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@
2323
],
2424
"scripts": {
2525
"test": "mocha",
26-
"test-travis": "npm install chai@$CHAI_VERSION && npm install sinon@$SINON_VERSION && npm install && npm test",
26+
"test-travis": "npm install && npm install chai@$CHAI_VERSION && npm install sinon@$SINON_VERSION && npm test",
2727
"lint": "eslint .",
2828
"cover": "istanbul cover node_modules/mocha/bin/_mocha && opener ./coverage/lcov-report/lib/sinon-chai.js.html"
2929
},
3030
"peerDependencies": {
3131
"chai": "^4.0.0",
32-
"sinon": "^4.0.0"
32+
"sinon": ">=4.0.0 <6.0.0"
3333
},
3434
"devDependencies": {
3535
"chai": "^4.1.0",
3636
"eslint": "^3.19.0",
3737
"istanbul": "~0.4.5",
3838
"mocha": "^3.4.2",
3939
"opener": "^1.4.3",
40-
"sinon": "^4.0.0"
40+
"sinon": "^5.0.0"
4141
}
4242
}

test/messages.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ describe("Messages", function () {
304304

305305
describe("about returning", function () {
306306
it("should be correct for the basic case", function () {
307-
var spy = sinon.spy.create(function () {
307+
var spy = sinon.spy(function () {
308308
return 1;
309309
});
310310

@@ -319,7 +319,7 @@ describe("Messages", function () {
319319
});
320320

321321
it("should be correct for the negated case", function () {
322-
var spy = sinon.spy.create(function () {
322+
var spy = sinon.spy(function () {
323323
return 1;
324324
});
325325

@@ -334,7 +334,7 @@ describe("Messages", function () {
334334
});
335335

336336
it("should be correct for the always case", function () {
337-
var spy = sinon.spy.create(function () {
337+
var spy = sinon.spy(function () {
338338
return 1;
339339
});
340340

@@ -349,7 +349,7 @@ describe("Messages", function () {
349349
describe("about throwing", function () {
350350
it("should be correct for the basic cases", function () {
351351
var spy = sinon.spy();
352-
var throwingSpy = sinon.spy.create(function () {
352+
var throwingSpy = sinon.spy(function () {
353353
throw new Error();
354354
});
355355

@@ -380,7 +380,7 @@ describe("Messages", function () {
380380

381381
it("should be correct for the negated cases", function () {
382382
var error = new Error("boo!");
383-
var spy = sinon.spy.create(function () {
383+
var spy = sinon.spy(function () {
384384
throw error;
385385
});
386386

@@ -410,7 +410,7 @@ describe("Messages", function () {
410410

411411
it("should be correct for the always cases", function () {
412412
var spy = sinon.spy();
413-
var throwingSpy = sinon.spy.create(function () {
413+
var throwingSpy = sinon.spy(function () {
414414
throw new Error();
415415
});
416416

test/returning.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var expect = require("chai").expect;
77
describe("Returning", function () {
88
describe("returned", function () {
99
it("should throw an assertion error if the spy does not return the correct value", function () {
10-
var spy = sinon.spy.create(function () {
10+
var spy = sinon.spy(function () {
1111
return 1;
1212
});
1313

@@ -22,7 +22,7 @@ describe("Returning", function () {
2222
});
2323

2424
it("should not throw if the spy returns the correct value", function () {
25-
var spy = sinon.spy.create(function () {
25+
var spy = sinon.spy(function () {
2626
return 1;
2727
});
2828

@@ -38,7 +38,7 @@ describe("Returning", function () {
3838

3939
it("should not throw if the spy returns the correct value amongst others", function () {
4040
var values = [1, 2, 3];
41-
var spy = sinon.spy.create(function () {
41+
var spy = sinon.spy(function () {
4242
return values[spy.callCount - 1];
4343
});
4444

@@ -57,7 +57,7 @@ describe("Returning", function () {
5757

5858
describe("always returned", function () {
5959
it("should throw an assertion error if the spy does not return the correct value", function () {
60-
var spy = sinon.spy.create(function () {
60+
var spy = sinon.spy(function () {
6161
return 1;
6262
});
6363

@@ -72,7 +72,7 @@ describe("Returning", function () {
7272
});
7373

7474
it("should not throw if the spy returns the correct value", function () {
75-
var spy = sinon.spy.create(function () {
75+
var spy = sinon.spy(function () {
7676
return 1;
7777
});
7878

@@ -88,7 +88,7 @@ describe("Returning", function () {
8888

8989
it("should throw an assertion error if the spy returns the correct value amongst others", function () {
9090
var values = [1, 2, 3];
91-
var spy = sinon.spy.create(function () {
91+
var spy = sinon.spy(function () {
9292
values[spy.callCount - 1];
9393
});
9494

0 commit comments

Comments
 (0)