rollbar 2.25.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/dist/rollbar.js +7 -2
- 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 +7 -2
- 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 +7 -2
- 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 +7 -2
- 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/package.json +1 -1
- package/src/api.js +6 -1
- package/src/browser/shim.js +8 -1
- package/src/defaults.js +1 -1
- package/test/browser.core.test.js +185 -147
- package/test/browser.rollbar.test.js +330 -244
- package/test/react-native.rollbar.test.js +12 -8
|
@@ -341,23 +341,26 @@ describe('options.captureUncaught', function() {
|
|
|
341
341
|
|
|
342
342
|
var element = document.getElementById('throw-error');
|
|
343
343
|
element.click();
|
|
344
|
-
server.respond();
|
|
345
344
|
|
|
346
|
-
|
|
345
|
+
setTimeout(function() {
|
|
346
|
+
server.respond();
|
|
347
347
|
|
|
348
|
-
|
|
349
|
-
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
350
|
-
expect(body.data.notifier.diagnostic.raw_error.message).to.eql('test error');
|
|
351
|
-
expect(body.data.notifier.diagnostic.is_uncaught).to.eql(true);
|
|
348
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
352
349
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
captureUncaught: false
|
|
358
|
-
});
|
|
350
|
+
expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
|
|
351
|
+
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
352
|
+
expect(body.data.notifier.diagnostic.raw_error.message).to.eql('test error');
|
|
353
|
+
expect(body.data.notifier.diagnostic.is_uncaught).to.eql(true);
|
|
359
354
|
|
|
360
|
-
|
|
355
|
+
// karma doesn't unload the browser between tests, so the onerror handler
|
|
356
|
+
// will remain installed. Unset captureUncaught so the onerror handler
|
|
357
|
+
// won't affect other tests.
|
|
358
|
+
rollbar.configure({
|
|
359
|
+
captureUncaught: false
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
done();
|
|
363
|
+
}, 1);
|
|
361
364
|
});
|
|
362
365
|
|
|
363
366
|
it('should respond to enable/disable in configure', function(done) {
|
|
@@ -373,34 +376,44 @@ describe('options.captureUncaught', function() {
|
|
|
373
376
|
var rollbar = window.rollbar = new Rollbar(options);
|
|
374
377
|
|
|
375
378
|
element.click();
|
|
376
|
-
server.respond();
|
|
377
|
-
expect(server.requests.length).to.eql(0); // Disabled, no event
|
|
378
|
-
server.requests.length = 0;
|
|
379
379
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
380
|
+
setTimeout(function() {
|
|
381
|
+
server.respond();
|
|
382
|
+
expect(server.requests.length).to.eql(0); // Disabled, no event
|
|
383
|
+
server.requests.length = 0;
|
|
383
384
|
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
rollbar.configure({
|
|
386
|
+
captureUncaught: true
|
|
387
|
+
});
|
|
386
388
|
|
|
387
|
-
|
|
389
|
+
element.click();
|
|
388
390
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
expect(body.data.notifier.diagnostic.is_anonymous).to.not.be.ok();
|
|
391
|
+
setTimeout(function() {
|
|
392
|
+
server.respond();
|
|
392
393
|
|
|
393
|
-
|
|
394
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
394
395
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
|
|
397
|
+
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
398
|
+
expect(body.data.notifier.diagnostic.is_anonymous).to.not.be.ok();
|
|
398
399
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
server.requests.length = 0;
|
|
401
|
+
|
|
402
|
+
rollbar.configure({
|
|
403
|
+
captureUncaught: false
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
element.click();
|
|
407
|
+
|
|
408
|
+
setTimeout(function() {
|
|
409
|
+
server.respond();
|
|
410
|
+
expect(server.requests.length).to.eql(0); // Disabled, no event
|
|
411
|
+
|
|
412
|
+
done();
|
|
413
|
+
}, 1);
|
|
414
|
+
}, 1);
|
|
415
|
+
}, 1);
|
|
402
416
|
|
|
403
|
-
done();
|
|
404
417
|
});
|
|
405
418
|
|
|
406
419
|
// Test case expects Chrome, which is the currently configured karma js/browser
|
|
@@ -430,22 +443,24 @@ describe('options.captureUncaught', function() {
|
|
|
430
443
|
Error.prepareStackTrace(e);
|
|
431
444
|
}
|
|
432
445
|
|
|
433
|
-
|
|
446
|
+
setTimeout(function() {
|
|
447
|
+
server.respond();
|
|
434
448
|
|
|
435
|
-
|
|
449
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
436
450
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
451
|
+
expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
|
|
452
|
+
expect(body.data.body.trace.exception.message).to.eql('anon error');
|
|
453
|
+
expect(body.data.notifier.diagnostic.is_anonymous).to.eql(true);
|
|
440
454
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
455
|
+
// karma doesn't unload the browser between tests, so the onerror handler
|
|
456
|
+
// will remain installed. Unset captureUncaught so the onerror handler
|
|
457
|
+
// won't affect other tests.
|
|
458
|
+
rollbar.configure({
|
|
459
|
+
captureUncaught: false
|
|
460
|
+
});
|
|
447
461
|
|
|
448
|
-
|
|
462
|
+
done();
|
|
463
|
+
}, 1);
|
|
449
464
|
});
|
|
450
465
|
|
|
451
466
|
it('should ignore duplicate errors by default', function(done) {
|
|
@@ -465,24 +480,27 @@ describe('options.captureUncaught', function() {
|
|
|
465
480
|
for(var i = 0; i < 2; i++) {
|
|
466
481
|
element.click(); // use for loop to ensure the stack traces have identical line/col info
|
|
467
482
|
}
|
|
468
|
-
server.respond();
|
|
469
483
|
|
|
470
|
-
|
|
471
|
-
|
|
484
|
+
setTimeout(function() {
|
|
485
|
+
server.respond();
|
|
472
486
|
|
|
473
|
-
|
|
487
|
+
// transmit only once
|
|
488
|
+
expect(server.requests.length).to.eql(1);
|
|
474
489
|
|
|
475
|
-
|
|
476
|
-
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
490
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
477
491
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
// won't affect other tests.
|
|
481
|
-
rollbar.configure({
|
|
482
|
-
captureUncaught: false
|
|
483
|
-
});
|
|
492
|
+
expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
|
|
493
|
+
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
484
494
|
|
|
485
|
-
|
|
495
|
+
// karma doesn't unload the browser between tests, so the onerror handler
|
|
496
|
+
// will remain installed. Unset captureUncaught so the onerror handler
|
|
497
|
+
// won't affect other tests.
|
|
498
|
+
rollbar.configure({
|
|
499
|
+
captureUncaught: false
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
done();
|
|
503
|
+
}, 1);
|
|
486
504
|
});
|
|
487
505
|
|
|
488
506
|
it('should transmit duplicate errors when set in config', function(done) {
|
|
@@ -503,24 +521,27 @@ describe('options.captureUncaught', function() {
|
|
|
503
521
|
for(var i = 0; i < 2; i++) {
|
|
504
522
|
element.click(); // use for loop to ensure the stack traces have identical line/col info
|
|
505
523
|
}
|
|
506
|
-
server.respond();
|
|
507
524
|
|
|
508
|
-
|
|
509
|
-
|
|
525
|
+
setTimeout(function() {
|
|
526
|
+
server.respond();
|
|
510
527
|
|
|
511
|
-
|
|
528
|
+
// transmit both errors
|
|
529
|
+
expect(server.requests.length).to.eql(2);
|
|
512
530
|
|
|
513
|
-
|
|
514
|
-
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
531
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
515
532
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
// won't affect other tests.
|
|
519
|
-
rollbar.configure({
|
|
520
|
-
captureUncaught: false
|
|
521
|
-
});
|
|
533
|
+
expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
|
|
534
|
+
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
522
535
|
|
|
523
|
-
|
|
536
|
+
// karma doesn't unload the browser between tests, so the onerror handler
|
|
537
|
+
// will remain installed. Unset captureUncaught so the onerror handler
|
|
538
|
+
// won't affect other tests.
|
|
539
|
+
rollbar.configure({
|
|
540
|
+
captureUncaught: false
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
done();
|
|
544
|
+
}, 1);
|
|
524
545
|
});
|
|
525
546
|
it('should send DOMException as trace_chain', function(done) {
|
|
526
547
|
var server = window.server;
|
|
@@ -535,21 +556,24 @@ describe('options.captureUncaught', function() {
|
|
|
535
556
|
|
|
536
557
|
var element = document.getElementById('throw-dom-exception');
|
|
537
558
|
element.click();
|
|
538
|
-
server.respond();
|
|
539
559
|
|
|
540
|
-
|
|
560
|
+
setTimeout(function() {
|
|
561
|
+
server.respond();
|
|
541
562
|
|
|
542
|
-
|
|
543
|
-
expect(body.data.body.trace_chain[0].exception.message).to.eql('test DOMException');
|
|
563
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
544
564
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
// won't affect other tests.
|
|
548
|
-
rollbar.configure({
|
|
549
|
-
captureUncaught: false
|
|
550
|
-
});
|
|
565
|
+
expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
|
|
566
|
+
expect(body.data.body.trace_chain[0].exception.message).to.eql('test DOMException');
|
|
551
567
|
|
|
552
|
-
|
|
568
|
+
// karma doesn't unload the browser between tests, so the onerror handler
|
|
569
|
+
// will remain installed. Unset captureUncaught so the onerror handler
|
|
570
|
+
// won't affect other tests.
|
|
571
|
+
rollbar.configure({
|
|
572
|
+
captureUncaught: false
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
done();
|
|
576
|
+
}, 1);
|
|
553
577
|
});
|
|
554
578
|
|
|
555
579
|
it('should capture exta frames when stackTraceLimit is set', function(done) {
|
|
@@ -567,23 +591,26 @@ describe('options.captureUncaught', function() {
|
|
|
567
591
|
|
|
568
592
|
var element = document.getElementById('throw-depp-stack-error');
|
|
569
593
|
element.click();
|
|
570
|
-
server.respond();
|
|
571
594
|
|
|
572
|
-
|
|
595
|
+
setTimeout(function() {
|
|
596
|
+
server.respond();
|
|
573
597
|
|
|
574
|
-
|
|
575
|
-
expect(body.data.body.trace.exception.message).to.eql('deep stack error');
|
|
576
|
-
expect(body.data.body.trace.frames.length).to.be.above(20);
|
|
598
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
577
599
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
rollbar.configure({
|
|
582
|
-
captureUncaught: false,
|
|
583
|
-
stackTraceLimit: oldLimit // reset to default
|
|
584
|
-
});
|
|
600
|
+
expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
|
|
601
|
+
expect(body.data.body.trace.exception.message).to.eql('deep stack error');
|
|
602
|
+
expect(body.data.body.trace.frames.length).to.be.above(20);
|
|
585
603
|
|
|
586
|
-
|
|
604
|
+
// karma doesn't unload the browser between tests, so the onerror handler
|
|
605
|
+
// will remain installed. Unset captureUncaught so the onerror handler
|
|
606
|
+
// won't affect other tests.
|
|
607
|
+
rollbar.configure({
|
|
608
|
+
captureUncaught: false,
|
|
609
|
+
stackTraceLimit: oldLimit // reset to default
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
done();
|
|
613
|
+
}, 1);
|
|
587
614
|
});
|
|
588
615
|
|
|
589
616
|
it('should add _wrappedSource when wrapGlobalEventHandlers is set', function(done) {
|
|
@@ -775,16 +802,18 @@ describe('log', function() {
|
|
|
775
802
|
|
|
776
803
|
rollbar.log('test message', { 'foo': 'bar' });
|
|
777
804
|
|
|
778
|
-
|
|
805
|
+
setTimeout(function() {
|
|
806
|
+
server.respond();
|
|
779
807
|
|
|
780
|
-
|
|
808
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
781
809
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
810
|
+
expect(body.data.body.message.body).to.eql('test message');
|
|
811
|
+
expect(body.data.body.message.extra).to.eql({ 'foo': 'bar' });
|
|
812
|
+
expect(body.data.notifier.diagnostic.is_uncaught).to.eql(undefined);
|
|
813
|
+
expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['string', 'object']);
|
|
786
814
|
|
|
787
|
-
|
|
815
|
+
done();
|
|
816
|
+
}, 1);
|
|
788
817
|
})
|
|
789
818
|
|
|
790
819
|
it('should send exception when called with error and extra args', function(done) {
|
|
@@ -799,16 +828,18 @@ describe('log', function() {
|
|
|
799
828
|
|
|
800
829
|
rollbar.log(new Error('test error'), { 'foo': 'bar' });
|
|
801
830
|
|
|
802
|
-
|
|
831
|
+
setTimeout(function() {
|
|
832
|
+
server.respond();
|
|
803
833
|
|
|
804
|
-
|
|
834
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
805
835
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
836
|
+
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
837
|
+
expect(body.data.body.trace.extra).to.eql({ 'foo': 'bar' });
|
|
838
|
+
expect(body.data.notifier.diagnostic.is_uncaught).to.eql(undefined);
|
|
839
|
+
expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['error', 'object']);
|
|
810
840
|
|
|
811
|
-
|
|
841
|
+
done();
|
|
842
|
+
}, 1);
|
|
812
843
|
})
|
|
813
844
|
|
|
814
845
|
it('should add custom data when called with error context', function(done) {
|
|
@@ -827,15 +858,17 @@ describe('log', function() {
|
|
|
827
858
|
|
|
828
859
|
rollbar.error(err, { 'foo': 'bar' });
|
|
829
860
|
|
|
830
|
-
|
|
861
|
+
setTimeout(function() {
|
|
862
|
+
server.respond();
|
|
831
863
|
|
|
832
|
-
|
|
864
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
833
865
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
866
|
+
expect(body.data.body.trace.exception.message).to.eql('test error');
|
|
867
|
+
expect(body.data.custom.foo).to.eql('bar');
|
|
868
|
+
expect(body.data.custom.err).to.eql('test');
|
|
837
869
|
|
|
838
|
-
|
|
870
|
+
done();
|
|
871
|
+
}, 1);
|
|
839
872
|
})
|
|
840
873
|
|
|
841
874
|
it('should send message when called with only null arguments', function(done) {
|
|
@@ -851,14 +884,16 @@ describe('log', function() {
|
|
|
851
884
|
|
|
852
885
|
rollbar.log(null);
|
|
853
886
|
|
|
854
|
-
|
|
887
|
+
setTimeout(function() {
|
|
888
|
+
server.respond();
|
|
855
889
|
|
|
856
|
-
|
|
890
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
857
891
|
|
|
858
|
-
|
|
859
|
-
|
|
892
|
+
expect(body.data.body.message.body).to.eql('Item sent with null or missing arguments.');
|
|
893
|
+
expect(body.data.notifier.diagnostic.original_arg_types).to.eql(['null']);
|
|
860
894
|
|
|
861
|
-
|
|
895
|
+
done();
|
|
896
|
+
}, 1);
|
|
862
897
|
})
|
|
863
898
|
|
|
864
899
|
it('should skipFrames when set', function(done) {
|
|
@@ -877,15 +912,17 @@ describe('log', function() {
|
|
|
877
912
|
rollbar.log(error);
|
|
878
913
|
rollbar.log(error, { skipFrames: 1 });
|
|
879
914
|
|
|
880
|
-
|
|
915
|
+
setTimeout(function() {
|
|
916
|
+
server.respond();
|
|
881
917
|
|
|
882
|
-
|
|
883
|
-
|
|
918
|
+
var frames1 = JSON.parse(server.requests[0].requestBody).data.body.trace.frames;
|
|
919
|
+
var frames2 = JSON.parse(server.requests[1].requestBody).data.body.trace.frames;
|
|
884
920
|
|
|
885
|
-
|
|
886
|
-
|
|
921
|
+
expect(frames1.length).to.eql(frames2.length + 1);
|
|
922
|
+
expect(frames1.slice(0,-1)).to.eql(frames2);
|
|
887
923
|
|
|
888
|
-
|
|
924
|
+
done();
|
|
925
|
+
}, 1);
|
|
889
926
|
})
|
|
890
927
|
|
|
891
928
|
it('should call the item callback on error', function(done) {
|
|
@@ -917,11 +954,13 @@ describe('log', function() {
|
|
|
917
954
|
|
|
918
955
|
rollbar.log('test', callback);
|
|
919
956
|
|
|
920
|
-
|
|
957
|
+
setTimeout(function() {
|
|
958
|
+
server.respond();
|
|
921
959
|
|
|
922
|
-
|
|
960
|
+
expect(callbackCalled.message).to.eql('Test error');
|
|
923
961
|
|
|
924
|
-
|
|
962
|
+
done();
|
|
963
|
+
}, 1);
|
|
925
964
|
})
|
|
926
965
|
});
|
|
927
966
|
|
|
@@ -960,14 +999,16 @@ describe('onerror', function() {
|
|
|
960
999
|
|
|
961
1000
|
window.onerror("TestRollbarError: testing window.onerror", window.location.href);
|
|
962
1001
|
|
|
963
|
-
|
|
1002
|
+
setTimeout(function() {
|
|
1003
|
+
server.respond();
|
|
964
1004
|
|
|
965
|
-
|
|
1005
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
966
1006
|
|
|
967
|
-
|
|
968
|
-
|
|
1007
|
+
expect(body.access_token).to.eql('POST_CLIENT_ITEM_TOKEN');
|
|
1008
|
+
expect(body.data.body.trace.exception.message).to.eql('testing window.onerror');
|
|
969
1009
|
|
|
970
|
-
|
|
1010
|
+
done();
|
|
1011
|
+
}, 1);
|
|
971
1012
|
})
|
|
972
1013
|
});
|
|
973
1014
|
|
|
@@ -1007,11 +1048,13 @@ describe('callback options', function() {
|
|
|
1007
1048
|
|
|
1008
1049
|
rollbar.log('test'); // generate a payload to ignore
|
|
1009
1050
|
|
|
1010
|
-
|
|
1051
|
+
setTimeout(function() {
|
|
1052
|
+
server.respond();
|
|
1011
1053
|
|
|
1012
|
-
|
|
1054
|
+
expect(server.requests.length).to.eql(0);
|
|
1013
1055
|
|
|
1014
|
-
|
|
1056
|
+
done();
|
|
1057
|
+
}, 1);
|
|
1015
1058
|
});
|
|
1016
1059
|
|
|
1017
1060
|
it('should receive valid arguments at checkIgnore', function(done) {
|
|
@@ -1032,12 +1075,14 @@ describe('callback options', function() {
|
|
|
1032
1075
|
|
|
1033
1076
|
rollbar.log(new Error('test'));
|
|
1034
1077
|
|
|
1035
|
-
|
|
1078
|
+
setTimeout(function() {
|
|
1079
|
+
server.respond();
|
|
1036
1080
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1081
|
+
// Should be ignored if all checks pass.
|
|
1082
|
+
expect(server.requests.length).to.eql(0);
|
|
1039
1083
|
|
|
1040
|
-
|
|
1084
|
+
done();
|
|
1085
|
+
}, 1);
|
|
1041
1086
|
});
|
|
1042
1087
|
|
|
1043
1088
|
it('should receive uncaught at checkIgnore', function(done) {
|
|
@@ -1060,12 +1105,14 @@ describe('callback options', function() {
|
|
|
1060
1105
|
var element = document.getElementById('throw-error');
|
|
1061
1106
|
element.click();
|
|
1062
1107
|
|
|
1063
|
-
|
|
1108
|
+
setTimeout(function() {
|
|
1109
|
+
server.respond();
|
|
1064
1110
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1111
|
+
// Should be ignored if checkIgnore receives isUncaught.
|
|
1112
|
+
expect(server.requests.length).to.eql(0);
|
|
1067
1113
|
|
|
1068
|
-
|
|
1114
|
+
done();
|
|
1115
|
+
}, 1);
|
|
1069
1116
|
})
|
|
1070
1117
|
|
|
1071
1118
|
it('should send when checkIgnore returns false', function(done) {
|
|
@@ -1083,14 +1130,16 @@ describe('callback options', function() {
|
|
|
1083
1130
|
|
|
1084
1131
|
rollbar.log('test'); // generate a payload to inspect
|
|
1085
1132
|
|
|
1086
|
-
|
|
1133
|
+
setTimeout(function() {
|
|
1134
|
+
server.respond();
|
|
1087
1135
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1136
|
+
expect(server.requests.length).to.eql(1);
|
|
1137
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
1138
|
+
expect(body.data.notifier.configured_options.checkIgnore.substr(0,8))
|
|
1139
|
+
.to.eql('function');
|
|
1092
1140
|
|
|
1093
|
-
|
|
1141
|
+
done();
|
|
1142
|
+
}, 1);
|
|
1094
1143
|
});
|
|
1095
1144
|
|
|
1096
1145
|
it('should use onSendCallback when set', function(done) {
|
|
@@ -1108,15 +1157,17 @@ describe('callback options', function() {
|
|
|
1108
1157
|
|
|
1109
1158
|
rollbar.log('test'); // generate a payload to inspect
|
|
1110
1159
|
|
|
1111
|
-
|
|
1160
|
+
setTimeout(function() {
|
|
1161
|
+
server.respond();
|
|
1112
1162
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1163
|
+
expect(server.requests.length).to.eql(1);
|
|
1164
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
1165
|
+
expect(body.data.foo).to.eql('bar');
|
|
1166
|
+
expect(body.data.notifier.configured_options.onSendCallback.substr(0,8))
|
|
1167
|
+
.to.eql('function');
|
|
1118
1168
|
|
|
1119
|
-
|
|
1169
|
+
done();
|
|
1170
|
+
}, 1);
|
|
1120
1171
|
});
|
|
1121
1172
|
|
|
1122
1173
|
it('should use transform when set', function(done) {
|
|
@@ -1134,15 +1185,17 @@ describe('callback options', function() {
|
|
|
1134
1185
|
|
|
1135
1186
|
rollbar.log('test'); // generate a payload to inspect
|
|
1136
1187
|
|
|
1137
|
-
|
|
1188
|
+
setTimeout(function() {
|
|
1189
|
+
server.respond();
|
|
1138
1190
|
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1191
|
+
expect(server.requests.length).to.eql(1);
|
|
1192
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
1193
|
+
expect(body.data.foo).to.eql('baz');
|
|
1194
|
+
expect(body.data.notifier.configured_options.transform.substr(0,8))
|
|
1195
|
+
.to.eql('function');
|
|
1144
1196
|
|
|
1145
|
-
|
|
1197
|
+
done();
|
|
1198
|
+
}, 1);
|
|
1146
1199
|
});
|
|
1147
1200
|
});
|
|
1148
1201
|
|
|
@@ -1232,13 +1285,15 @@ describe('options.autoInstrument', function() {
|
|
|
1232
1285
|
|
|
1233
1286
|
rollbar.log('test'); // generate a payload to inspect
|
|
1234
1287
|
|
|
1235
|
-
|
|
1288
|
+
setTimeout(function() {
|
|
1289
|
+
server.respond();
|
|
1236
1290
|
|
|
1237
|
-
|
|
1291
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
1238
1292
|
|
|
1239
|
-
|
|
1293
|
+
expect(body.data.body.telemetry[0].body.message).to.eql('console test');
|
|
1240
1294
|
|
|
1241
|
-
|
|
1295
|
+
done();
|
|
1296
|
+
}, 1);
|
|
1242
1297
|
});
|
|
1243
1298
|
|
|
1244
1299
|
function initRollbarForNetworkTelemetry() {
|
|
@@ -1281,20 +1336,24 @@ describe('options.autoInstrument', function() {
|
|
|
1281
1336
|
try {
|
|
1282
1337
|
rollbar.log('test'); // generate a payload to inspect
|
|
1283
1338
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1339
|
+
setTimeout(function() {
|
|
1340
|
+
server.respond();
|
|
1286
1341
|
|
|
1287
|
-
|
|
1288
|
-
|
|
1342
|
+
expect(server.requests.length).to.eql(2);
|
|
1343
|
+
var body = JSON.parse(server.requests[1].requestBody);
|
|
1289
1344
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1345
|
+
// Verify request capture and scrubbing
|
|
1346
|
+
expect(body.data.body.telemetry[0].body.request).to.eql('{"name":"bar","secret":"********"}');
|
|
1292
1347
|
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
expect(body.data.body.telemetry[0].body.response.headers['Password']).to.eql('********');
|
|
1348
|
+
// Verify request headers capture and case-insensitive scrubbing
|
|
1349
|
+
expect(body.data.body.telemetry[0].body.request_headers).to.eql({'Content-type': 'application/json', Secret: '********'});
|
|
1296
1350
|
|
|
1297
|
-
|
|
1351
|
+
// Verify response capture and scrubbing
|
|
1352
|
+
expect(body.data.body.telemetry[0].body.response.body).to.eql('{"name":"foo","password":"********"}');
|
|
1353
|
+
expect(body.data.body.telemetry[0].body.response.headers['Password']).to.eql('********');
|
|
1354
|
+
|
|
1355
|
+
done();
|
|
1356
|
+
}, 1);
|
|
1298
1357
|
} catch (e) {
|
|
1299
1358
|
done(e);
|
|
1300
1359
|
}
|
|
@@ -1330,17 +1389,21 @@ describe('options.autoInstrument', function() {
|
|
|
1330
1389
|
try {
|
|
1331
1390
|
rollbar.log('test'); // generate a payload to inspect
|
|
1332
1391
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1392
|
+
setTimeout(function() {
|
|
1393
|
+
server.respond();
|
|
1335
1394
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1395
|
+
expect(server.requests.length).to.eql(2);
|
|
1396
|
+
var body = JSON.parse(server.requests[1].requestBody);
|
|
1338
1397
|
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
expect(body.data.body.telemetry[0].body.response.headers['Password']).to.eql('********');
|
|
1398
|
+
// Verify request headers capture and case-insensitive scrubbing
|
|
1399
|
+
expect(body.data.body.telemetry[0].body.request_headers).to.eql({Secret: '********'});
|
|
1342
1400
|
|
|
1343
|
-
|
|
1401
|
+
// Verify response capture and scrubbing
|
|
1402
|
+
expect(body.data.body.telemetry[0].body.response.body).to.eql('{"name":"foo","password":"********"}');
|
|
1403
|
+
expect(body.data.body.telemetry[0].body.response.headers['Password']).to.eql('********');
|
|
1404
|
+
|
|
1405
|
+
done();
|
|
1406
|
+
}, 1);
|
|
1344
1407
|
} catch (e) {
|
|
1345
1408
|
done(e);
|
|
1346
1409
|
}
|
|
@@ -1376,18 +1439,22 @@ describe('options.autoInstrument', function() {
|
|
|
1376
1439
|
try {
|
|
1377
1440
|
rollbar.log('test'); // generate a payload to inspect
|
|
1378
1441
|
|
|
1379
|
-
|
|
1380
|
-
|
|
1442
|
+
setTimeout(function() {
|
|
1443
|
+
server.respond();
|
|
1381
1444
|
|
|
1382
|
-
|
|
1383
|
-
|
|
1445
|
+
expect(server.requests.length).to.eql(2);
|
|
1446
|
+
var body = JSON.parse(server.requests[1].requestBody);
|
|
1384
1447
|
|
|
1385
|
-
|
|
1386
|
-
|
|
1448
|
+
// Verify request headers capture and case-insensitive scrubbing
|
|
1449
|
+
expect(body.data.body.telemetry[0].body.request_headers).to.eql({Secret: '********'});
|
|
1387
1450
|
|
|
1388
|
-
|
|
1451
|
+
// Not scrubbed for unrecognized content type
|
|
1452
|
+
expect(body.data.body.telemetry[0].body.response.body).to.eql('{"name":"foo","password":"123456"}');
|
|
1389
1453
|
|
|
1390
|
-
|
|
1454
|
+
expect(body.data.body.telemetry[0].body.response.headers['Password']).to.eql('********');
|
|
1455
|
+
|
|
1456
|
+
done();
|
|
1457
|
+
}, 1);
|
|
1391
1458
|
} catch (e) {
|
|
1392
1459
|
done(e);
|
|
1393
1460
|
}
|
|
@@ -1427,22 +1494,28 @@ describe('options.autoInstrument', function() {
|
|
|
1427
1494
|
xhr.onreadystatechange = function () {
|
|
1428
1495
|
if(xhr.readyState === 4) {
|
|
1429
1496
|
try {
|
|
1430
|
-
|
|
1431
|
-
|
|
1497
|
+
setTimeout(function() {
|
|
1498
|
+
server.respond();
|
|
1432
1499
|
|
|
1433
|
-
|
|
1500
|
+
expect(server.requests.length).to.eql(2);
|
|
1501
|
+
var body = JSON.parse(server.requests[1].requestBody);
|
|
1434
1502
|
|
|
1435
|
-
|
|
1436
|
-
expect(body.data.body.trace.frames.length).to.be.above(1);
|
|
1503
|
+
expect(body.data.body.trace.exception.message).to.eql('HTTP request failed with Status 404');
|
|
1437
1504
|
|
|
1438
|
-
|
|
1505
|
+
// Just knowing a stack is present is enough for this test.
|
|
1506
|
+
expect(body.data.body.trace.frames.length).to.be.above(1);
|
|
1507
|
+
|
|
1508
|
+
done();
|
|
1509
|
+
}, 1);
|
|
1439
1510
|
} catch (e) {
|
|
1440
1511
|
done(e);
|
|
1441
1512
|
}
|
|
1442
1513
|
}
|
|
1443
1514
|
};
|
|
1444
1515
|
xhr.send(JSON.stringify({name: 'bar', secret: 'xhr post' }));
|
|
1445
|
-
|
|
1516
|
+
setTimeout(function() {
|
|
1517
|
+
server.respond();
|
|
1518
|
+
}, 1);
|
|
1446
1519
|
});
|
|
1447
1520
|
|
|
1448
1521
|
it('should add telemetry events for fetch calls', function(done) {
|
|
@@ -1491,36 +1564,45 @@ describe('options.autoInstrument', function() {
|
|
|
1491
1564
|
.then(function(response) {
|
|
1492
1565
|
try {
|
|
1493
1566
|
rollbar.log('test'); // generate a payload to inspect
|
|
1494
|
-
|
|
1567
|
+
} catch (e) {
|
|
1568
|
+
done(e);
|
|
1569
|
+
return;
|
|
1570
|
+
}
|
|
1495
1571
|
|
|
1496
|
-
|
|
1497
|
-
|
|
1572
|
+
setTimeout(function() {
|
|
1573
|
+
try {
|
|
1574
|
+
server.respond();
|
|
1498
1575
|
|
|
1499
|
-
|
|
1500
|
-
|
|
1576
|
+
expect(server.requests.length).to.eql(2);
|
|
1577
|
+
var body = JSON.parse(server.requests[1].requestBody);
|
|
1501
1578
|
|
|
1502
|
-
|
|
1503
|
-
|
|
1579
|
+
// Verify request capture and scrubbing
|
|
1580
|
+
expect(body.data.body.telemetry[0].body.request).to.eql('{"name":"bar","secret":"********"}');
|
|
1504
1581
|
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
// Disable here due to the Sinon limitation.
|
|
1508
|
-
//
|
|
1509
|
-
// Verify response capture and scrubbing
|
|
1510
|
-
// expect(body.data.body.telemetry[0].body.response.body).to.eql('{"name":"foo","password":"********"}');
|
|
1582
|
+
// Verify request headers capture and case-insensitive scrubbing
|
|
1583
|
+
expect(body.data.body.telemetry[0].body.request_headers).to.eql({'content-type': 'application/json', secret: '********'});
|
|
1511
1584
|
|
|
1512
|
-
|
|
1513
|
-
|
|
1585
|
+
// When using the Sinon test stub, the response body is populated in Headless Chrome 73,
|
|
1586
|
+
// but not in 77. When using the Fetch API normally, it is populated in all tested Chrome versions.
|
|
1587
|
+
// Disable here due to the Sinon limitation.
|
|
1588
|
+
//
|
|
1589
|
+
// Verify response capture and scrubbing
|
|
1590
|
+
// expect(body.data.body.telemetry[0].body.response.body).to.eql('{"name":"foo","password":"********"}');
|
|
1514
1591
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1592
|
+
// Verify response headers capture and case-insensitive scrubbing
|
|
1593
|
+
expect(body.data.body.telemetry[0].body.response.headers).to.eql({'content-type': 'application/json', password: '********'});
|
|
1517
1594
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1595
|
+
// Assert that the original stream reader hasn't been read.
|
|
1596
|
+
expect(response.bodyUsed).to.eql(false);
|
|
1597
|
+
|
|
1598
|
+
rollbar.configure({ autoInstrument: false });
|
|
1599
|
+
window.fetch.restore();
|
|
1600
|
+
done();
|
|
1601
|
+
} catch (e) {
|
|
1602
|
+
done(e);
|
|
1603
|
+
return;
|
|
1604
|
+
}
|
|
1605
|
+
}, 1);
|
|
1524
1606
|
})
|
|
1525
1607
|
});
|
|
1526
1608
|
|
|
@@ -1555,23 +1637,25 @@ describe('options.autoInstrument', function() {
|
|
|
1555
1637
|
};
|
|
1556
1638
|
var fetchRequest = new Request('https://example.com/xhr-test');
|
|
1557
1639
|
window.fetch(fetchRequest, fetchInit).then(function(_response) {
|
|
1558
|
-
|
|
1559
|
-
|
|
1640
|
+
setTimeout(function() {
|
|
1641
|
+
try {
|
|
1642
|
+
server.respond();
|
|
1560
1643
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1644
|
+
expect(server.requests.length).to.eql(1);
|
|
1645
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
1563
1646
|
|
|
1564
|
-
|
|
1647
|
+
expect(body.data.body.trace.exception.message).to.eql('HTTP request failed with Status 404');
|
|
1565
1648
|
|
|
1566
|
-
|
|
1567
|
-
|
|
1649
|
+
// Just knowing a stack is present is enough for this test.
|
|
1650
|
+
expect(body.data.body.trace.frames.length).to.be.above(1);
|
|
1568
1651
|
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1652
|
+
rollbar.configure({ autoInstrument: false });
|
|
1653
|
+
window.fetch.restore();
|
|
1654
|
+
done();
|
|
1655
|
+
} catch (e) {
|
|
1656
|
+
done(e);
|
|
1657
|
+
}
|
|
1658
|
+
}, 1);
|
|
1575
1659
|
})
|
|
1576
1660
|
});
|
|
1577
1661
|
|
|
@@ -1596,16 +1680,18 @@ describe('options.autoInstrument', function() {
|
|
|
1596
1680
|
|
|
1597
1681
|
rollbar.log('test'); // generate a payload to inspect
|
|
1598
1682
|
|
|
1599
|
-
|
|
1683
|
+
setTimeout(function() {
|
|
1684
|
+
server.respond();
|
|
1600
1685
|
|
|
1601
|
-
|
|
1686
|
+
var body = JSON.parse(server.requests[0].requestBody);
|
|
1602
1687
|
|
|
1603
|
-
|
|
1688
|
+
window.console = oldConsole;
|
|
1604
1689
|
|
|
1605
|
-
|
|
1606
|
-
|
|
1690
|
+
expect(rollbar.client.notifier.diagnostic.instrumentConsole).to.have.property('error');
|
|
1691
|
+
expect(body.data.notifier.diagnostic.instrumentConsole).to.have.property('error');
|
|
1607
1692
|
|
|
1608
|
-
|
|
1693
|
+
done();
|
|
1694
|
+
}, 1);
|
|
1609
1695
|
});
|
|
1610
1696
|
});
|
|
1611
1697
|
|