@@ -20,7 +20,9 @@ _Raven.prototype._getUuid = function() {
20
20
return 'abc123' ;
21
21
} ;
22
22
23
- var joinRegExp = require ( '../src/utils' ) . joinRegExp ;
23
+ var utils = require ( '../src/utils' ) ;
24
+ var joinRegExp = utils . joinRegExp ;
25
+ var supportsErrorEvent = utils . supportsErrorEvent ;
24
26
25
27
// window.console must be stubbed in for browsers that don't have it
26
28
if ( typeof window . console === 'undefined' ) {
@@ -2770,21 +2772,23 @@ describe('Raven (public API)', function() {
2770
2772
} ) ;
2771
2773
2772
2774
describe ( '.captureException' , function ( ) {
2773
- it ( 'should treat ErrorEvents similarly to Errors' , function ( ) {
2774
- var error = new ErrorEvent ( 'pickleRick' , { error : new Error ( 'pickleRick' ) } ) ;
2775
- this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
2776
- this . sinon . stub ( Raven , '_handleStackInfo' ) ;
2777
- Raven . captureException ( error , { foo : 'bar' } ) ;
2778
- assert . isTrue ( Raven . _handleStackInfo . calledOnce ) ;
2779
- } ) ;
2775
+ if ( supportsErrorEvent ( ) ) {
2776
+ it ( 'should treat ErrorEvents similarly to Errors' , function ( ) {
2777
+ var error = new ErrorEvent ( 'pickleRick' , { error : new Error ( 'pickleRick' ) } ) ;
2778
+ this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
2779
+ this . sinon . stub ( Raven , '_handleStackInfo' ) ;
2780
+ Raven . captureException ( error , { foo : 'bar' } ) ;
2781
+ assert . isTrue ( Raven . _handleStackInfo . calledOnce ) ;
2782
+ } ) ;
2780
2783
2781
- it ( 'should send ErrorEvents without Errors as messages' , function ( ) {
2782
- var error = new ErrorEvent ( 'pickleRick' ) ;
2783
- this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
2784
- this . sinon . stub ( Raven , 'captureMessage' ) ;
2785
- Raven . captureException ( error , { foo : 'bar' } ) ;
2786
- assert . isTrue ( Raven . captureMessage . calledOnce ) ;
2787
- } ) ;
2784
+ it ( 'should send ErrorEvents without Errors as messages' , function ( ) {
2785
+ var error = new ErrorEvent ( 'pickleRick' ) ;
2786
+ this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
2787
+ this . sinon . stub ( Raven , 'captureMessage' ) ;
2788
+ Raven . captureException ( error , { foo : 'bar' } ) ;
2789
+ assert . isTrue ( Raven . captureMessage . calledOnce ) ;
2790
+ } ) ;
2791
+ }
2788
2792
2789
2793
it ( 'should send non-Errors as messages' , function ( ) {
2790
2794
this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
0 commit comments