@@ -101,6 +101,56 @@ for (var idx in frames) {
101
101
}
102
102
) ;
103
103
} ) ;
104
+
105
+ it ( 'should allow to ignore specific urls' , function ( done ) {
106
+ var iframe = this . iframe ;
107
+
108
+ iframeExecute (
109
+ iframe ,
110
+ done ,
111
+ function ( ) {
112
+ /**
113
+ * We always filter on the caller, not the cause of the error
114
+ *
115
+ * > foo.js file called a function in bar.js
116
+ * > bar.js file called a function in baz.js
117
+ * > baz.js threw an error
118
+ *
119
+ * foo.js is blacklisted in the `init` call (init.js), thus we filter it
120
+ * */
121
+ var urlWithBlacklistedUrl = new Error ( 'filter' ) ;
122
+ urlWithBlacklistedUrl . stack =
123
+ 'Error: bar\n' +
124
+ ' at baz(http://localhost:5000/baz.js:2:9)\n' +
125
+ ' at bar(http://localhost:5000/bar.js:2:3)\n' +
126
+ ' at http://localhost:5000/foo.js:7:19' ;
127
+
128
+ /**
129
+ * > foo-pass.js file called a function in bar-pass.js
130
+ * > bar-pass.js file called a function in baz-pass.js
131
+ * > baz-pass.js threw an error
132
+ *
133
+ * foo-pass.js is *not* blacklisted in the `init` call (init.js), thus we don't filter it
134
+ * */
135
+ var urlWithoutBlacklistedUrl = new Error ( 'pass' ) ;
136
+ urlWithoutBlacklistedUrl . stack =
137
+ 'Error: bar\n' +
138
+ ' at baz(http://localhost:5000/baz-pass.js:2:9)\n' +
139
+ ' at bar(http://localhost:5000/bar-pass.js:2:3)\n' +
140
+ ' at http://localhost:5000/foo-pass.js:7:19' ;
141
+
142
+ Sentry . captureException ( urlWithBlacklistedUrl ) ;
143
+ Sentry . captureException ( urlWithoutBlacklistedUrl ) ;
144
+ } ,
145
+ function ( sentryData ) {
146
+ if ( debounceAssertEventCount ( sentryData , 1 , done ) ) {
147
+ assert . equal ( sentryData [ 0 ] . exception . values [ 0 ] . type , 'Error' ) ;
148
+ assert . equal ( sentryData [ 0 ] . exception . values [ 0 ] . value , 'pass' ) ;
149
+ done ( ) ;
150
+ }
151
+ }
152
+ ) ;
153
+ } ) ;
104
154
} ) ;
105
155
106
156
describe ( 'API' , function ( ) {
0 commit comments