@@ -646,7 +646,7 @@ for (var idx in frames) {
646
646
);
647
647
});
648
648
649
- it('should capture unhandledrejection as string', function(done) {
649
+ it('should capture unhandledrejection with a string', function(done) {
650
650
var iframe = this.iframe;
651
651
652
652
iframeExecute(
@@ -661,7 +661,101 @@ for (var idx in frames) {
661
661
},
662
662
function(sentryData) {
663
663
if (debounceAssertEventCount(sentryData, 1, done)) {
664
- assert.equal(sentryData[0].exception.values[0].value, 'test');
664
+ assert.equal(sentryData[0].exception.values[0].value, '"test"');
665
+ assert.equal(sentryData[0].exception.values[0].type, 'UnhandledRejection');
666
+ assert.equal(sentryData[0].exception.values[0].stacktrace, undefined);
667
+ assert.equal(sentryData[0].exception.mechanism.handled, false);
668
+ assert.equal(sentryData[0].exception.mechanism.type, 'onunhandledrejection');
669
+ done();
670
+ } else {
671
+ // This test will be skipped if it's not Chrome Desktop
672
+ done();
673
+ }
674
+ }
675
+ );
676
+ });
677
+
678
+ it('should capture unhandledrejection with a monster string', function(done) {
679
+ var iframe = this.iframe;
680
+
681
+ iframeExecute(
682
+ iframe,
683
+ done,
684
+ function() {
685
+ if (isChrome()) {
686
+ Promise.reject('test'.repeat(100));
687
+ } else {
688
+ done();
689
+ }
690
+ },
691
+ function(sentryData) {
692
+ if (debounceAssertEventCount(sentryData, 1, done)) {
693
+ assert.isAtMost(sentryData[0].exception.values[0].value.length, 303);
694
+ assert.equal(sentryData[0].exception.values[0].type, 'UnhandledRejection');
695
+ assert.equal(sentryData[0].exception.values[0].stacktrace, undefined);
696
+ assert.equal(sentryData[0].exception.mechanism.handled, false);
697
+ assert.equal(sentryData[0].exception.mechanism.type, 'onunhandledrejection');
698
+ done();
699
+ } else {
700
+ // This test will be skipped if it's not Chrome Desktop
701
+ done();
702
+ }
703
+ }
704
+ );
705
+ });
706
+
707
+ it('should capture unhandledrejection with an object', function(done) {
708
+ var iframe = this.iframe;
709
+
710
+ iframeExecute(
711
+ iframe,
712
+ done,
713
+ function() {
714
+ if (isChrome()) {
715
+ Promise.reject({ a: 'b' });
716
+ } else {
717
+ done();
718
+ }
719
+ },
720
+ function(sentryData) {
721
+ if (debounceAssertEventCount(sentryData, 1, done)) {
722
+ assert.equal(sentryData[0].exception.values[0].value, '{"a":"b"}');
723
+ assert.equal(sentryData[0].exception.values[0].type, 'UnhandledRejection');
724
+ assert.equal(sentryData[0].exception.values[0].stacktrace, undefined);
725
+ assert.equal(sentryData[0].exception.mechanism.handled, false);
726
+ assert.equal(sentryData[0].exception.mechanism.type, 'onunhandledrejection');
727
+ done();
728
+ } else {
729
+ // This test will be skipped if it's not Chrome Desktop
730
+ done();
731
+ }
732
+ }
733
+ );
734
+ });
735
+
736
+ it('should capture unhandledrejection with an monster object', function(done) {
737
+ var iframe = this.iframe;
738
+
739
+ iframeExecute(
740
+ iframe,
741
+ done,
742
+ function() {
743
+ if (isChrome()) {
744
+ var a = {
745
+ a: '1'.repeat('100'),
746
+ b: '2'.repeat('100'),
747
+ c: '3'.repeat('100'),
748
+ };
749
+ a.d = a.a;
750
+ a.e = a;
751
+ Promise.reject(a);
752
+ } else {
753
+ done();
754
+ }
755
+
28BE
},
756
+ function(sentryData) {
757
+ if (debounceAssertEventCount(sentryData, 1, done)) {
758
+ assert.isAtMost(sentryData[0].exception.values[0].value.length, 303);
665
759
assert.equal(sentryData[0].exception.values[0].type, 'UnhandledRejection');
666
760
assert.equal(sentryData[0].exception.values[0].stacktrace, undefined);
667
761
assert.equal(sentryData[0].exception.mechanism.handled, false);
0 commit comments