rollbar 2.25.0 → 2.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollbar",
3
- "version": "2.25.0",
3
+ "version": "2.25.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "http://github.com/rollbar/rollbar.js"
package/src/api.js CHANGED
@@ -47,7 +47,12 @@ function Api(options, transport, urllib, truncation, jsonBackup) {
47
47
  Api.prototype.postItem = function(data, callback) {
48
48
  var transportOptions = helpers.transportOptions(this.transportOptions, 'POST');
49
49
  var payload = helpers.buildPayload(this.accessToken, data, this.jsonBackup);
50
- this.transport.post(this.accessToken, transportOptions, payload, callback);
50
+ var self = this;
51
+
52
+ // ensure the network request is scheduled after the current tick.
53
+ setTimeout(function() {
54
+ self.transport.post(self.accessToken, transportOptions, payload, callback);
55
+ }, 0);
51
56
  };
52
57
 
53
58
  /**
@@ -62,9 +62,16 @@ function setupShim(window, options) {
62
62
  globals.captureUnhandledRejections(window, handler, true);
63
63
  }
64
64
 
65
+ function pageTelemetryEnabled(ai) {
66
+ if (typeof ai === 'object' && (ai.page === undefined || ai.page)) {
67
+ return true;
68
+ }
69
+ return false;
70
+ }
71
+
65
72
  var ai = options.autoInstrument;
66
73
  if (options.enabled !== false) {
67
- if (ai === undefined || ai === true || (typeof ai === 'object' && ai.network)) {
74
+ if (ai === undefined || ai === true || pageTelemetryEnabled(ai)) {
68
75
  if (window.addEventListener) {
69
76
  window.addEventListener('load', handler.captureLoad.bind(handler));
70
77
  window.addEventListener('DOMContentLoaded', handler.captureDomContentLoaded.bind(handler));
@@ -1,4 +1,5 @@
1
1
  var _ = require('../utility');
2
+ var headers = require('../utility/headers');
2
3
  var scrub = require('../scrub');
3
4
  var urlparser = require('./url');
4
5
  var domUtil = require('./domUtility');
@@ -362,7 +363,7 @@ Instrumenter.prototype.instrumentNetwork = function() {
362
363
  if (args[1] && args[1].headers) {
363
364
  // Argument may be a Headers object, or plain object. Ensure here that
364
365
  // we are working with a Headers object with case-insensitive keys.
365
- var reqHeaders = new Headers(args[1].headers);
366
+ var reqHeaders = headers(args[1].headers);
366
367
 
367
368
  metadata.request_content_type = reqHeaders.get('Content-Type');
368
369
 
@@ -79,20 +79,25 @@ function addBaseInfo(item, options, callback) {
79
79
 
80
80
  function addRequestInfo(window) {
81
81
  return function(item, options, callback) {
82
- if (!window || !window.location) {
83
- return callback(null, item);
82
+ var requestInfo = {};
83
+
84
+ if (window && window.location) {
85
+ requestInfo.url = window.location.href;
86
+ requestInfo.query_string = window.location.search;
84
87
  }
88
+
85
89
  var remoteString = '$remote_ip';
86
90
  if (!options.captureIp) {
87
91
  remoteString = null;
88
92
  } else if (options.captureIp !== true) {
89
93
  remoteString += '_anonymize';
90
94
  }
91
- _.set(item, 'data.request', {
92
- url: window.location.href,
93
- query_string: window.location.search,
94
- user_ip: remoteString
95
- });
95
+ if (remoteString) requestInfo.user_ip = remoteString;
96
+
97
+ if (Object.keys(requestInfo).length > 0) {
98
+ _.set(item, 'data.request', requestInfo);
99
+ }
100
+
96
101
  callback(null, item);
97
102
  };
98
103
  }
package/src/defaults.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- version: '2.25.0',
2
+ version: '2.25.2',
3
3
  endpoint: 'api.rollbar.com/api/1/item/',
4
4
  logLevel: 'debug',
5
5
  reportLevel: 'debug',
@@ -0,0 +1,94 @@
1
+ /*
2
+ * headers - Detect when fetch Headers are undefined and use a partial polyfill.
3
+ *
4
+ * A full polyfill is not used in order to keep package size as small as possible.
5
+ * Since this is only used internally and is not added to the window object,
6
+ * the full interface doesn't need to be supported.
7
+ *
8
+ * This implementation is modified from whatwg-fetch:
9
+ * https://github.com/github/fetch
10
+ */
11
+ function headers(headers) {
12
+ if (typeof Headers === 'undefined') {
13
+ return new FetchHeaders(headers);
14
+ }
15
+
16
+ return new Headers(headers);
17
+ }
18
+
19
+ function normalizeName(name) {
20
+ if (typeof name !== 'string') {
21
+ name = String(name)
22
+ }
23
+ return name.toLowerCase()
24
+ }
25
+
26
+ function normalizeValue(value) {
27
+ if (typeof value !== 'string') {
28
+ value = String(value)
29
+ }
30
+ return value
31
+ }
32
+
33
+ function iteratorFor(items) {
34
+ var iterator = {
35
+ next: function() {
36
+ var value = items.shift()
37
+ return {done: value === undefined, value: value}
38
+ }
39
+ }
40
+
41
+ return iterator
42
+ }
43
+
44
+ function FetchHeaders(headers) {
45
+ this.map = {}
46
+
47
+ if (headers instanceof FetchHeaders) {
48
+ headers.forEach(function(value, name) {
49
+ this.append(name, value)
50
+ }, this)
51
+ } else if (Array.isArray(headers)) {
52
+ headers.forEach(function(header) {
53
+ this.append(header[0], header[1])
54
+ }, this)
55
+ } else if (headers) {
56
+ Object.getOwnPropertyNames(headers).forEach(function(name) {
57
+ this.append(name, headers[name])
58
+ }, this)
59
+ }
60
+ }
61
+
62
+ FetchHeaders.prototype.append = function(name, value) {
63
+ name = normalizeName(name)
64
+ value = normalizeValue(value)
65
+ var oldValue = this.map[name]
66
+ this.map[name] = oldValue ? oldValue + ', ' + value : value
67
+ }
68
+
69
+ FetchHeaders.prototype.get = function(name) {
70
+ name = normalizeName(name)
71
+ return this.has(name) ? this.map[name] : null
72
+ }
73
+
74
+ FetchHeaders.prototype.has = function(name) {
75
+ return this.map.hasOwnProperty(normalizeName(name))
76
+ }
77
+
78
+ FetchHeaders.prototype.forEach = function(callback, thisArg) {
79
+ for (var name in this.map) {
80
+ if (this.map.hasOwnProperty(name)) {
81
+ callback.call(thisArg, this.map[name], name, this)
82
+ }
83
+ }
84
+ }
85
+
86
+ FetchHeaders.prototype.entries = function() {
87
+ var items = []
88
+ this.forEach(function(value, name) {
89
+ items.push([name, value])
90
+ })
91
+ return iteratorFor(items)
92
+ }
93
+
94
+ module.exports = headers;
@@ -43,23 +43,26 @@ describe('options.captureUncaught', function() {
43
43
 
44
44
  var element = document.getElementById('throw-error');
45
45
  element.click();
46
- server.respond();
47
46
 
48
- var body = JSON.parse(server.requests[0].requestBody);
47
+ setTimeout(function() {
48
+ server.respond();
49
49
 
50
- expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
51
- expect(body.data.body.trace.exception.message).to.eql('test error');
52
- expect(body.data.notifier.diagnostic.raw_error.message).to.eql('test error');
53
- expect(body.data.notifier.diagnostic.is_uncaught).to.eql(true);
50
+ var body = JSON.parse(server.requests[0].requestBody);
54
51
 
55
- // karma doesn't unload the browser between tests, so the onerror handler
56
- // will remain installed. Unset captureUncaught so the onerror handler
57
- // won't affect other tests.
58
- rollbar.configure({
59
- captureUncaught: false
60
- });
52
+ expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
53
+ expect(body.data.body.trace.exception.message).to.eql('test error');
54
+ expect(body.data.notifier.diagnostic.raw_error.message).to.eql('test error');
55
+ expect(body.data.notifier.diagnostic.is_uncaught).to.eql(true);
61
56
 
62
- done();
57
+ // karma doesn't unload the browser between tests, so the onerror handler
58
+ // will remain installed. Unset captureUncaught so the onerror handler
59
+ // won't affect other tests.
60
+ rollbar.configure({
61
+ captureUncaught: false
62
+ });
63
+
64
+ done();
65
+ }, 1);
63
66
  });
64
67
 
65
68
  it('should respond to enable/disable in configure', function(done) {
@@ -75,34 +78,43 @@ describe('options.captureUncaught', function() {
75
78
  var rollbar = window.rollbar = new Rollbar(options);
76
79
 
77
80
  element.click();
78
- server.respond();
79
- expect(server.requests.length).to.eql(0); // Disabled, no event
80
- server.requests.length = 0;
81
81
 
82
- rollbar.configure({
83
- captureUncaught: true
84
- });
82
+ setTimeout(function() {
83
+ server.respond();
84
+ expect(server.requests.length).to.eql(0); // Disabled, no event
85
+ server.requests.length = 0;
85
86
 
86
- element.click();
87
- server.respond();
87
+ rollbar.configure({
88
+ captureUncaught: true
89
+ });
88
90
 
89
- var body = JSON.parse(server.requests[0].requestBody);
91
+ element.click();
90
92
 
91
- expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
92
- expect(body.data.body.trace.exception.message).to.eql('test error');
93
- expect(body.data.notifier.diagnostic.is_anonymous).to.not.be.ok();
93
+ setTimeout(function() {
94
+ server.respond();
94
95
 
95
- server.requests.length = 0;
96
+ var body = JSON.parse(server.requests[0].requestBody);
96
97
 
97
- rollbar.configure({
98
- captureUncaught: false
99
- });
98
+ expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
99
+ expect(body.data.body.trace.exception.message).to.eql('test error');
100
+ expect(body.data.notifier.diagnostic.is_anonymous).to.not.be.ok();
100
101
 
101
- element.click();
102
- server.respond();
103
- expect(server.requests.length).to.eql(0); // Disabled, no event
102
+ server.requests.length = 0;
104
103
 
105
- done();
104
+ rollbar.configure({
105
+ captureUncaught: false
106
+ });
107
+
108
+ element.click();
109
+
110
+ setTimeout(function() {
111
+ server.respond();
112
+ expect(server.requests.length).to.eql(0); // Disabled, no event
113
+
114
+ done();
115
+ }, 1);
116
+ }, 1);
117
+ }, 1);
106
118
  });
107
119
 
108
120
  // Test case expects Chrome, which is the currently configured karma js/browser
@@ -132,22 +144,24 @@ describe('options.captureUncaught', function() {
132
144
  Error.prepareStackTrace(e);
133
145
  }
134
146
 
135
- server.respond();
147
+ setTimeout(function() {
148
+ server.respond();
136
149
 
137
- var body = JSON.parse(server.requests[0].requestBody);
150
+ var body = JSON.parse(server.requests[0].requestBody);
138
151
 
139
- expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
140
- expect(body.data.body.trace.exception.message).to.eql('anon error');
141
- expect(body.data.notifier.diagnostic.is_anonymous).to.eql(true);
152
+ expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
153
+ expect(body.data.body.trace.exception.message).to.eql('anon error');
154
+ expect(body.data.notifier.diagnostic.is_anonymous).to.eql(true);
142
155
 
143
- // karma doesn't unload the browser between tests, so the onerror handler
144
- // will remain installed. Unset captureUncaught so the onerror handler
145
- // won't affect other tests.
146
- rollbar.configure({
147
- captureUncaught: false
148
- });
156
+ // karma doesn't unload the browser between tests, so the onerror handler
157
+ // will remain installed. Unset captureUncaught so the onerror handler
158
+ // won't affect other tests.
159
+ rollbar.configure({
160
+ captureUncaught: false
161
+ });
149
162
 
150
- done();
163
+ done();
164
+ }, 1);
151
165
  });
152
166
 
153
167
  it('should ignore duplicate errors by default', function(done) {
@@ -167,24 +181,27 @@ describe('options.captureUncaught', function() {
167
181
  for(var i = 0; i < 2; i++) {
168
182
  element.click(); // use for loop to ensure the stack traces have identical line/col info
169
183
  }
170
- server.respond();
171
184
 
172
- // transmit only once
173
- expect(server.requests.length).to.eql(1);
185
+ setTimeout(function() {
186
+ server.respond();
174
187
 
175
- var body = JSON.parse(server.requests[0].requestBody);
188
+ // transmit only once
189
+ expect(server.requests.length).to.eql(1);
176
190
 
177
- expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
178
- expect(body.data.body.trace.exception.message).to.eql('test error');
191
+ var body = JSON.parse(server.requests[0].requestBody);
179
192
 
180
- // karma doesn't unload the browser between tests, so the onerror handler
181
- // will remain installed. Unset captureUncaught so the onerror handler
182
- // won't affect other tests.
183
- rollbar.configure({
184
- captureUncaught: false
185
- });
193
+ expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
194
+ expect(body.data.body.trace.exception.message).to.eql('test error');
186
195
 
187
- done();
196
+ // karma doesn't unload the browser between tests, so the onerror handler
197
+ // will remain installed. Unset captureUncaught so the onerror handler
198
+ // won't affect other tests.
199
+ rollbar.configure({
200
+ captureUncaught: false
201
+ });
202
+
203
+ done();
204
+ }, 1);
188
205
  });
189
206
 
190
207
  it('should transmit duplicate errors when set in config', function(done) {
@@ -205,24 +222,27 @@ describe('options.captureUncaught', function() {
205
222
  for(var i = 0; i < 2; i++) {
206
223
  element.click(); // use for loop to ensure the stack traces have identical line/col info
207
224
  }
208
- server.respond();
209
225
 
210
- // transmit both errors
211
- expect(server.requests.length).to.eql(2);
226
+ setTimeout(function() {
227
+ server.respond();
212
228
 
213
- var body = JSON.parse(server.requests[0].requestBody);
229
+ // transmit both errors
230
+ expect(server.requests.length).to.eql(2);
214
231
 
215
- expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
216
- expect(body.data.body.trace.exception.message).to.eql('test error');
232
+ var body = JSON.parse(server.requests[0].requestBody);
217
233
 
218
- // karma doesn't unload the browser between tests, so the onerror handler
219
- // will remain installed. Unset captureUncaught so the onerror handler
220
- // won't affect other tests.
221
- rollbar.configure({
222
- captureUncaught: false
223
- });
234
+ expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
235
+ expect(body.data.body.trace.exception.message).to.eql('test error');
224
236
 
225
- done();
237
+ // karma doesn't unload the browser between tests, so the onerror handler
238
+ // will remain installed. Unset captureUncaught so the onerror handler
239
+ // won't affect other tests.
240
+ rollbar.configure({
241
+ captureUncaught: false
242
+ });
243
+
244
+ done();
245
+ }, 1);
226
246
  });
227
247
  it('should send DOMException as trace_chain', function(done) {
228
248
  var server = window.server;
@@ -237,21 +257,24 @@ describe('options.captureUncaught', function() {
237
257
 
238
258
  var element = document.getElementById('throw-dom-exception');
239
259
  element.click();
240
- server.respond();
241
260
 
242
- var body = JSON.parse(server.requests[0].requestBody);
261
+ setTimeout(function() {
262
+ server.respond();
263
+
264
+ var body = JSON.parse(server.requests[0].requestBody);
243
265
 
244
- expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
245
- expect(body.data.body.trace_chain[0].exception.message).to.eql('test DOMException');
266
+ expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
267
+ expect(body.data.body.trace_chain[0].exception.message).to.eql('test DOMException');
246
268
 
247
- // karma doesn't unload the browser between tests, so the onerror handler
248
- // will remain installed. Unset captureUncaught so the onerror handler
249
- // won't affect other tests.
250
- rollbar.configure({
251
- captureUncaught: false
252
- });
269
+ // karma doesn't unload the browser between tests, so the onerror handler
270
+ // will remain installed. Unset captureUncaught so the onerror handler
271
+ // won't affect other tests.
272
+ rollbar.configure({
273
+ captureUncaught: false
274
+ });
253
275
 
254
- done();
276
+ done();
277
+ }, 1);
255
278
  });
256
279
 
257
280
  it('should capture exta frames when stackTraceLimit is set', function(done) {
@@ -269,23 +292,26 @@ describe('options.captureUncaught', function() {
269
292
 
270
293
  var element = document.getElementById('throw-depp-stack-error');
271
294
  element.click();
272
- server.respond();
273
295
 
274
- var body = JSON.parse(server.requests[0].requestBody);
296
+ setTimeout(function() {
297
+ server.respond();
275
298
 
276
- expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
277
- expect(body.data.body.trace.exception.message).to.eql('deep stack error');
278
- expect(body.data.body.trace.frames.length).to.be.above(20);
299
+ var body = JSON.parse(server.requests[0].requestBody);
279
300
 
280
- // karma doesn't unload the browser between tests, so the onerror handler
281
- // will remain installed. Unset captureUncaught so the onerror handler
282
- // won't affect other tests.
283
- rollbar.configure({
284
- captureUncaught: false,
285
- stackTraceLimit: oldLimit // reset to default
286
- });
301
+ expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
302
+ expect(body.data.body.trace.exception.message).to.eql('deep stack error');
303
+ expect(body.data.body.trace.frames.length).to.be.above(20);
287
304
 
288
- done();
305
+ // karma doesn't unload the browser between tests, so the onerror handler
306
+ // will remain installed. Unset captureUncaught so the onerror handler
307
+ // won't affect other tests.
308
+ rollbar.configure({
309
+ captureUncaught: false,
310
+ stackTraceLimit: oldLimit // reset to default
311
+ });
312
+
313
+ done();
314
+ }, 1);
289
315
  });
290
316
  });
291
317
 
@@ -440,16 +466,18 @@ describe('log', function() {
440
466
 
441
467
  rollbar.log('test message', { 'foo': 'bar' });
442
468
 
443
- server.respond();
469
+ setTimeout(function() {
470
+ server.respond();
444
471
 
445
- var body = JSON.parse(server.requests[0].requestBody);
472
+ var body = JSON.parse(server.requests[0].requestBody);
446
473
 
447
- expect(body.data.body.message.body).to.eql('test message');
448
- expect(body.data.body.message.extra).to.eql({ 'foo': 'bar' });
449
- expect(body.data.notifier.diagnostic.is_uncaught).to.eql(undefined);
450
- expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['string', 'object']);
474
+ expect(body.data.body.message.body).to.eql('test message');
475
+ expect(body.data.body.message.extra).to.eql({ 'foo': 'bar' });
476
+ expect(body.data.notifier.diagnostic.is_uncaught).to.eql(undefined);
477
+ expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['string', 'object']);
451
478
 
452
- done();
479
+ done();
480
+ }, 1);
453
481
  })
454
482
 
455
483
  it('should send exception when called with error and extra args', function(done) {
@@ -464,16 +492,18 @@ describe('log', function() {
464
492
 
465
493
  rollbar.log(new Error('test error'), { 'foo': 'bar' });
466
494
 
467
- server.respond();
495
+ setTimeout(function() {
496
+ server.respond();
468
497
 
469
- var body = JSON.parse(server.requests[0].requestBody);
498
+ var body = JSON.parse(server.requests[0].requestBody);
470
499
 
471
- expect(body.data.body.trace.exception.message).to.eql('test error');
472
- expect(body.data.body.trace.extra).to.eql({ 'foo': 'bar' });
473
- expect(body.data.notifier.diagnostic.is_uncaught).to.eql(undefined);
474
- expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['error', 'object']);
500
+ expect(body.data.body.trace.exception.message).to.eql('test error');
501
+ expect(body.data.body.trace.extra).to.eql({ 'foo': 'bar' });
502
+ expect(body.data.notifier.diagnostic.is_uncaught).to.eql(undefined);
503
+ expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['error', 'object']);
475
504
 
476
- done();
505
+ done();
506
+ }, 1);
477
507
  })
478
508
 
479
509
  it('should add custom data when called with error context', function(done) {
@@ -492,15 +522,17 @@ describe('log', function() {
492
522
 
493
523
  rollbar.error(err, { 'foo': 'bar' });
494
524
 
495
- server.respond();
525
+ setTimeout(function() {
526
+ server.respond();
496
527
 
497
- var body = JSON.parse(server.requests[0].requestBody);
528
+ var body = JSON.parse(server.requests[0].requestBody);
498
529
 
499
- expect(body.data.body.trace.exception.message).to.eql('test error');
500
- expect(body.data.custom.foo).to.eql('bar');
501
- expect(body.data.custom.err).to.eql('test');
530
+ expect(body.data.body.trace.exception.message).to.eql('test error');
531
+ expect(body.data.custom.foo).to.eql('bar');
532
+ expect(body.data.custom.err).to.eql('test');
502
533
 
503
- done();
534
+ done();
535
+ }, 1);
504
536
  })
505
537
 
506
538
  it('should remove circular references in custom data', function(done) {
@@ -529,30 +561,32 @@ describe('log', function() {
529
561
  custom.self = custom;
530
562
  rollbar.error(err, custom);
531
563
 
532
- server.respond();
533
-
534
- var body = JSON.parse(server.requests[0].requestBody);
535
-
536
- expect(body.data.body.trace.exception.message).to.eql('test error');
537
- expect(body.data.custom.foo).to.eql('bar');
538
- expect(body.data.custom.err).to.eql('test');
564
+ setTimeout(function() {
565
+ server.respond();
539
566
 
540
- // Duplicate objects are allowed when there is no circular reference.
541
- expect(body.data.custom.notCircular1).to.eql(notCircular);
542
- expect(body.data.custom.notCircular2).to.eql(notCircular);
567
+ var body = JSON.parse(server.requests[0].requestBody);
543
568
 
544
- expect(body.data.custom.self).to.eql(
545
- 'Removed circular reference: object'
546
- );
547
- expect(body.data.custom.array).to.eql([
548
- 'one', 'two', 'Removed circular reference: array'
549
- ]);
550
- expect(body.data.custom.contextData).to.eql({
551
- extra: 'baz',
552
- data: 'Removed circular reference: object'
553
- });
569
+ expect(body.data.body.trace.exception.message).to.eql('test error');
570
+ expect(body.data.custom.foo).to.eql('bar');
571
+ expect(body.data.custom.err).to.eql('test');
572
+
573
+ // Duplicate objects are allowed when there is no circular reference.
574
+ expect(body.data.custom.notCircular1).to.eql(notCircular);
575
+ expect(body.data.custom.notCircular2).to.eql(notCircular);
576
+
577
+ expect(body.data.custom.self).to.eql(
578
+ 'Removed circular reference: object'
579
+ );
580
+ expect(body.data.custom.array).to.eql([
581
+ 'one', 'two', 'Removed circular reference: array'
582
+ ]);
583
+ expect(body.data.custom.contextData).to.eql({
584
+ extra: 'baz',
585
+ data: 'Removed circular reference: object'
586
+ });
554
587
 
555
- done();
588
+ done();
589
+ }, 1);
556
590
  })
557
591
 
558
592
  it('should send message when called with only null arguments', function(done) {
@@ -568,14 +602,16 @@ describe('log', function() {
568
602
 
569
603
  rollbar.log(null);
570
604
 
571
- server.respond();
605
+ setTimeout(function() {
606
+ server.respond();
572
607
 
573
- var body = JSON.parse(server.requests[0].requestBody);
608
+ var body = JSON.parse(server.requests[0].requestBody);
574
609
 
575
- expect(body.data.body.message.body).to.eql('Item sent with null or missing arguments.');
576
- expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['null']);
610
+ expect(body.data.body.message.body).to.eql('Item sent with null or missing arguments.');
611
+ expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['null']);
577
612
 
578
- done();
613
+ done();
614
+ }, 1);
579
615
  })
580
616
 
581
617
  it('should skipFrames when set', function(done) {
@@ -594,14 +630,16 @@ describe('log', function() {
594
630
  rollbar.log(error);
595
631
  rollbar.log(error, { skipFrames: 1 });
596
632
 
597
- server.respond();
633
+ setTimeout(function() {
634
+ server.respond();
598
635
 
599
- var frames1 = JSON.parse(server.requests[0].requestBody).data.body.trace.frames;
600
- var frames2 = JSON.parse(server.requests[1].requestBody).data.body.trace.frames;
636
+ var frames1 = JSON.parse(server.requests[0].requestBody).data.body.trace.frames;
637
+ var frames2 = JSON.parse(server.requests[1].requestBody).data.body.trace.frames;
601
638
 
602
- expect(frames1.length).to.eql(frames2.length + 1);
603
- expect(frames1.slice(0,-1)).to.eql(frames2);
639
+ expect(frames1.length).to.eql(frames2.length + 1);
640
+ expect(frames1.slice(0,-1)).to.eql(frames2);
604
641
 
605
- done();
642
+ done();
643
+ }, 1);
606
644
  })
607
645
  });