File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -272,3 +272,44 @@ test('RedBox stack trace with missing filename', t => {
272
272
273
273
afterEach ( )
274
274
} )
275
+
276
+ test ( 'RedBox with throwing stack trace parser' , t => {
277
+ t . plan ( 1 )
278
+ RedBox . __Rewire__ ( 'ErrorStackParser' , {
279
+ parse : function ( ) {
280
+ // This mimicks the former behavior of stacktracejs,
281
+ // see https://github.com/stacktracejs/stackframe/issues/11.
282
+ throw new TypeError ( "Line Number must be a Number" )
283
+ }
284
+ } )
285
+ const ERR_MESSAGE = "original error message"
286
+ const error = new TypeError ( ERR_MESSAGE )
287
+ const component = createComponent ( RedBox , { error} )
288
+
289
+ const renderedError = component
290
+ . props . children [ 0 ]
291
+ . props . children
292
+ t . equal (
293
+ renderedError [ 0 ] ,
294
+ 'TypeError' ,
295
+ 'Main error message begins with error type of original error'
296
+ )
297
+ t . equal (
298
+ renderedError [ 2 ] ,
299
+ ERR_MESSAGE ,
300
+ 'Main error message ends with message originally supplied to error constructor.'
301
+ )
302
+ const renderedStack = component
303
+ . props . children [ 1 ]
304
+
305
+ t . deepEqual (
306
+ renderedStack ,
307
+ < div style = { style . stack } >
308
+ < div style = { style . frame } key = { 0 } >
309
+ < div > Failed to parse stack trace. Stack trace information unavailable.</ div >
310
+ </ div >
311
+ </ div >
312
+ )
313
+
314
+ afterEach ( )
315
+ } )
You can’t perform that action at this time.
0 commit comments