rollbar 2.24.0 → 2.25.1
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/.github/pull_request_template.md +15 -6
- package/.github/workflows/ci.yml +1 -1
- package/dist/rollbar.js +54 -14
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +54 -14
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +54 -14
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +54 -14
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/index.d.ts +83 -3
- package/package.json +4 -6
- package/src/api.js +6 -1
- package/src/browser/shim.js +8 -1
- package/src/browser/telemetry.js +6 -4
- package/src/browser/transforms.js +2 -2
- package/src/defaults.js +1 -1
- package/src/errorParser.js +2 -2
- package/src/server/parser.js +12 -14
- package/src/server/transforms.js +1 -1
- package/src/utility.js +37 -4
- package/test/browser.core.test.js +216 -126
- package/test/browser.rollbar.test.js +330 -244
- package/test/browser.transforms.test.js +43 -0
- package/test/react-native.rollbar.test.js +12 -8
- package/test/server.rollbar.test.js +6 -6
- package/test/server.transforms.test.js +52 -1
|
@@ -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
|
-
|
|
47
|
+
setTimeout(function() {
|
|
48
|
+
server.respond();
|
|
49
49
|
|
|
50
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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
|
-
|
|
83
|
-
|
|
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
|
-
|
|
87
|
-
|
|
87
|
+
rollbar.configure({
|
|
88
|
+
captureUncaught: true
|
|
89
|
+
});
|
|
88
90
|
|
|
89
|
-
|
|
91
|
+
element.click();
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
expect(body.data.notifier.diagnostic.is_anonymous).to.not.be.ok();
|
|
93
|
+
setTimeout(function() {
|
|
94
|
+
server.respond();
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
102
|
-
server.respond();
|
|
103
|
-
expect(server.requests.length).to.eql(0); // Disabled, no event
|
|
102
|
+
server.requests.length = 0;
|
|
104
103
|
|
|
105
|
-
|
|
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
|
-
|
|
147
|
+
setTimeout(function() {
|
|
148
|
+
server.respond();
|
|
136
149
|
|
|
137
|
-
|
|
150
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
138
151
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
|
|
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
|
-
|
|
173
|
-
|
|
185
|
+
setTimeout(function() {
|
|
186
|
+
server.respond();
|
|
174
187
|
|
|
175
|
-
|
|
188
|
+
// transmit only once
|
|
189
|
+
expect(server.requests.length).to.eql(1);
|
|
176
190
|
|
|
177
|
-
|
|
178
|
-
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
191
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
179
192
|
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
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
|
-
|
|
211
|
-
|
|
226
|
+
setTimeout(function() {
|
|
227
|
+
server.respond();
|
|
212
228
|
|
|
213
|
-
|
|
229
|
+
// transmit both errors
|
|
230
|
+
expect(server.requests.length).to.eql(2);
|
|
214
231
|
|
|
215
|
-
|
|
216
|
-
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
232
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
217
233
|
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
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
|
-
|
|
261
|
+
setTimeout(function() {
|
|
262
|
+
server.respond();
|
|
243
263
|
|
|
244
|
-
|
|
245
|
-
expect(body.data.body.trace_chain[0].exception.message).to.eql('test DOMException');
|
|
264
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
246
265
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
// won't affect other tests.
|
|
250
|
-
rollbar.configure({
|
|
251
|
-
captureUncaught: false
|
|
252
|
-
});
|
|
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');
|
|
253
268
|
|
|
254
|
-
|
|
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
|
+
});
|
|
275
|
+
|
|
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
|
-
|
|
296
|
+
setTimeout(function() {
|
|
297
|
+
server.respond();
|
|
275
298
|
|
|
276
|
-
|
|
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
|
-
|
|
281
|
-
|
|
282
|
-
|
|
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
|
-
|
|
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
|
-
|
|
469
|
+
setTimeout(function() {
|
|
470
|
+
server.respond();
|
|
444
471
|
|
|
445
|
-
|
|
472
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
446
473
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
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
|
-
|
|
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
|
-
|
|
495
|
+
setTimeout(function() {
|
|
496
|
+
server.respond();
|
|
468
497
|
|
|
469
|
-
|
|
498
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
470
499
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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
|
-
|
|
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,71 @@ describe('log', function() {
|
|
|
492
522
|
|
|
493
523
|
rollbar.error(err, { 'foo': 'bar' });
|
|
494
524
|
|
|
495
|
-
|
|
525
|
+
setTimeout(function() {
|
|
526
|
+
server.respond();
|
|
527
|
+
|
|
528
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
496
529
|
|
|
497
|
-
|
|
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');
|
|
498
533
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
534
|
+
done();
|
|
535
|
+
}, 1);
|
|
536
|
+
})
|
|
502
537
|
|
|
503
|
-
|
|
538
|
+
it('should remove circular references in custom data', function(done) {
|
|
539
|
+
var server = window.server;
|
|
540
|
+
stubResponse(server);
|
|
541
|
+
server.requests.length = 0;
|
|
542
|
+
|
|
543
|
+
var options = {
|
|
544
|
+
accessToken: 'POST_CLIENT_ITEM_TOKEN',
|
|
545
|
+
addErrorContext: true
|
|
546
|
+
};
|
|
547
|
+
var rollbar = window.rollbar = new Rollbar(options);
|
|
548
|
+
|
|
549
|
+
var err = new Error('test error');
|
|
550
|
+
var contextData = { extra: 'baz' }
|
|
551
|
+
contextData.data = contextData;
|
|
552
|
+
var context = { err: 'test', contextData: contextData };
|
|
553
|
+
err.rollbarContext = context;
|
|
554
|
+
|
|
555
|
+
var array = ['one', 'two'];
|
|
556
|
+
array.push(array);
|
|
557
|
+
var custom = { foo: 'bar', array: array };
|
|
558
|
+
var notCircular = { key: 'value' };
|
|
559
|
+
custom.notCircular1 = notCircular;
|
|
560
|
+
custom.notCircular2 = notCircular;
|
|
561
|
+
custom.self = custom;
|
|
562
|
+
rollbar.error(err, custom);
|
|
563
|
+
|
|
564
|
+
setTimeout(function() {
|
|
565
|
+
server.respond();
|
|
566
|
+
|
|
567
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
568
|
+
|
|
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
|
+
});
|
|
587
|
+
|
|
588
|
+
done();
|
|
589
|
+
}, 1);
|
|
504
590
|
})
|
|
505
591
|
|
|
506
592
|
it('should send message when called with only null arguments', function(done) {
|
|
@@ -516,14 +602,16 @@ describe('log', function() {
|
|
|
516
602
|
|
|
517
603
|
rollbar.log(null);
|
|
518
604
|
|
|
519
|
-
|
|
605
|
+
setTimeout(function() {
|
|
606
|
+
server.respond();
|
|
520
607
|
|
|
521
|
-
|
|
608
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
522
609
|
|
|
523
|
-
|
|
524
|
-
|
|
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']);
|
|
525
612
|
|
|
526
|
-
|
|
613
|
+
done();
|
|
614
|
+
}, 1);
|
|
527
615
|
})
|
|
528
616
|
|
|
529
617
|
it('should skipFrames when set', function(done) {
|
|
@@ -542,14 +630,16 @@ describe('log', function() {
|
|
|
542
630
|
rollbar.log(error);
|
|
543
631
|
rollbar.log(error, { skipFrames: 1 });
|
|
544
632
|
|
|
545
|
-
|
|
633
|
+
setTimeout(function() {
|
|
634
|
+
server.respond();
|
|
546
635
|
|
|
547
|
-
|
|
548
|
-
|
|
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;
|
|
549
638
|
|
|
550
|
-
|
|
551
|
-
|
|
639
|
+
expect(frames1.length).to.eql(frames2.length + 1);
|
|
640
|
+
expect(frames1.slice(0,-1)).to.eql(frames2);
|
|
552
641
|
|
|
553
|
-
|
|
642
|
+
done();
|
|
643
|
+
}, 1);
|
|
554
644
|
})
|
|
555
645
|
});
|