Skip to content

Commit 05e78d9

Browse files
committed
Update Mocha, Sinon, Chai and relevant tests
1 parent 586ea46 commit 05e78d9

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
@@ -25,7 +25,7 @@
2525
"bluebird": "^3.4.1",
2626
"browserify-versionify": "^1.0.6",
2727
"bundle-collapser": "^1.2.1",
28-
"chai": "2.3.0",
28+
"chai": "^4.1.1",
2929
"derequire": "2.0.3",
3030
"es6-promise": "^4.0.5",
3131
"eslint-config-prettier": "^2.3.0",
@@ -48,10 +48,10 @@
4848
"jquery": "^2.1.4",
4949
"lint-staged": "^4.0.4",
5050
"lodash": "^3.10.1",
51-
"mocha": "2.5.3",
51+
"mocha": "^3.5.0",
5252
"prettier": "^1.6.1",
5353
"proxyquireify": "^3.0.2",
54-
"sinon": "1.7.3",
54+
"sinon": "^3.2.1",
5555
"through2": "^2.0.0",
5656
"typescript": "^1.8.10",
5757
"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)