Skip to content

Commit f4159af

Browse files
committed
ref: Update Mocha, Sinon, Chai and relevant tests
1 parent f638521 commit f4159af

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"bluebird": "^3.4.1",
2828
"browserify-versionify": "^1.0.6",
2929
"bundle-collapser": "^1.2.1",
30-
"chai": "2.3.0",
30+
"chai": "^4.1.1",
3131
"derequire": "2.0.3",
3232
"es6-promise": "^4.0.5",
3333
"eslint": "^4.6.1",
@@ -45,11 +45,11 @@
4545
"grunt-sri": "mattrobenolt/grunt-sri#pretty",
4646
"husky": "^0.14.3",
4747
"lint-staged": "^4.0.4",
48-
"mocha": "2.5.3",
48+
"mocha": "^3.5.0",
4949
"mocha-chrome": "^0.2.1",
5050
"prettier": "^1.6.1",
5151
"proxyquireify": "^3.0.2",
52-
"sinon": "1.7.3",
52+
"sinon": "^3.2.1",
5353
"through2": "^2.0.0",
5454
"typescript": "^1.8.10",
5555
"whatwg-fetch": "^1.0.0"

test/integration/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ function parseUrl(url) {
3636
}
3737

3838
describe('integration', function() {
39+
this.timeout(10000);
40+
3941
beforeEach(function(done) {
4042
this.iframe = createIframe(done);
4143
});

test/plugins/react-native.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ describe('React Native plugin', function() {
172172
);
173173
assert.equal(lastXhr.method, 'POST');
174174
assert.equal(lastXhr.requestBody, '{"foo":"bar"}');
175-
assert.equal(lastXhr.requestHeaders['Content-type'], 'application/json');
175+
assert.equal(
176+
lastXhr.requestHeaders['Content-type'],
177+
'application/json;charset=utf-8'
178+
);
176179
assert.equal(lastXhr.requestHeaders['Origin'], 'react-native://');
177180
});
178181

@@ -257,7 +260,7 @@ describe('React Native plugin', function() {
257260
it('clears persisted errors after they are reported', function() {
258261
var payload = {abc: 123};
259262
var callback;
260-
self.sinon.stub(Raven, '_sendProcessedPayload', function(p, cb) {
263+
self.sinon.stub(Raven, '_sendProcessedPayload').callsFake(function(p, cb) {
261264
callback = cb;
262265
});
263266
reactNativePlugin._restorePayload = self.sinon
@@ -276,7 +279,7 @@ describe('React Native plugin', function() {
276279
it('does not clear persisted errors if there is an error reporting', function() {
277280
var payload = {abc: 123};
278281
var callback;
279-
self.sinon.stub(Raven, '_sendProcessedPayload', function(p, cb) {
282+
self.sinon.stub(Raven, '_sendProcessedPayload').callsFake(function(p, cb) {
280283
callback = cb;
281284
});
282285
reactNativePlugin._restorePayload = self.sinon

test/raven.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,8 @@ describe('globals', function() {
16091609

16101610
it('should no-op if CORS is not supported', function() {
16111611
delete XMLHttpRequest.prototype.withCredentials;
1612+
var oldSupportsCORS = sinon.xhr.supportsCORS;
1613+
sinon.xhr.supportsCORS = false;
16121614

16131615
var oldXDR = window.XDomainRequest;
16141616
window.XDomainRequest = undefined;
@@ -1623,6 +1625,7 @@ describe('globals', function() {
16231625
assert.equal(this.requests.length, 1); // the "test" xhr
16241626
assert.equal(this.requests[0].readyState, 0);
16251627

1628+
sinon.xhr.supportsCORS = oldSupportsCORS;
16261629
window.XDomainRequest = oldXDR;
16271630
});
16281631

0 commit comments

Comments
 (0)