1
1
import { exceptionFromError } from '../../../src/eventbuilder' ;
2
2
import { defaultStackParser as parser } from '../../../src/stack-parsers' ;
3
+ import { makeMockError } from '../helper/error-object' ;
3
4
4
5
describe ( 'Tracekit - Chrome Tests' , ( ) => {
5
6
it ( 'should parse Chrome error with no location' , ( ) => {
6
7
const NO_LOCATION = { message : 'foo' , name : 'bar' , stack : 'error\n at Array.forEach (native)' } ;
7
- const ex = exceptionFromError ( parser , NO_LOCATION ) ;
8
+ const ex = exceptionFromError ( parser , makeMockError ( NO_LOCATION ) ) ;
8
9
9
10
expect ( ex ) . toEqual ( {
10
11
value : 'foo' ,
@@ -26,7 +27,7 @@ describe('Tracekit - Chrome Tests', () => {
26
27
' at http://path/to/file.js:24:4' ,
27
28
} ;
28
29
29
- const ex = exceptionFromError ( parser , CHROME_15 ) ;
30
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME_15 ) ) ;
30
31
31
32
expect ( ex ) . toEqual ( {
32
33
value : "Object #<Object> has no method 'undef'" ,
@@ -53,7 +54,7 @@ describe('Tracekit - Chrome Tests', () => {
53
54
' at I.e.fn.(anonymous function) [as index] (http://localhost:8080/file.js:10:3651)' ,
54
55
} ;
55
56
56
- const ex = exceptionFromError ( parser , CHROME_36 ) ;
57
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME_36 ) ) ;
57
58
58
59
expect ( ex ) . toEqual ( {
59
60
value : 'Default error' ,
@@ -99,7 +100,7 @@ describe('Tracekit - Chrome Tests', () => {
99
100
' at TESTTESTTEST.proxiedMethod(webpack:///./~/react-proxy/modules/createPrototypeProxy.js?:44:30)' ,
100
101
} ;
101
102
102
- const ex = exceptionFromError ( parser , CHROME_XX_WEBPACK ) ;
103
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME_XX_WEBPACK ) ) ;
103
104
104
105
expect ( ex ) . toEqual ( {
105
106
value : "Cannot read property 'error' of undefined" ,
@@ -152,7 +153,7 @@ describe('Tracekit - Chrome Tests', () => {
152
153
'at http://localhost:8080/file.js:31:13\n' ,
153
154
} ;
154
155
155
- const ex = exceptionFromError ( parser , CHROME_48_EVAL ) ;
156
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME_48_EVAL ) ) ;
156
157
157
158
expect ( ex ) . toEqual ( {
158
159
value : 'message string' ,
@@ -184,7 +185,7 @@ describe('Tracekit - Chrome Tests', () => {
184
185
' at n.handle (blob:http%3A//localhost%3A8080/abfc40e9-4742-44ed-9dcd-af8f99a29379:7:2863)' ,
185
186
} ;
186
187
187
- const ex = exceptionFromError ( parser , CHROME_48_BLOB ) ;
188
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME_48_BLOB ) ) ;
188
189
189
190
expect ( ex ) . toEqual ( {
190
191
value : 'Error: test' ,
@@ -247,7 +248,7 @@ describe('Tracekit - Chrome Tests', () => {
247
248
at examplescheme://examplehost/cd351f7250857e22ceaa.worker.js:70179:15` ,
248
249
} ;
249
250
250
- const ex = exceptionFromError ( parser , CHROMIUM_EMBEDDED_FRAMEWORK_CUSTOM_SCHEME ) ;
251
+ const ex = exceptionFromError ( parser , makeMockError ( CHROMIUM_EMBEDDED_FRAMEWORK_CUSTOM_SCHEME ) ) ;
251
252
252
253
expect ( ex ) . toEqual ( {
253
254
value : 'message string' ,
@@ -277,7 +278,7 @@ describe('Tracekit - Chrome Tests', () => {
277
278
at http://localhost:5000/test:24:7` ,
278
279
} ;
279
280
280
- const ex = exceptionFromError ( parser , CHROME73_NATIVE_CODE_EXCEPTION ) ;
281
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME73_NATIVE_CODE_EXCEPTION ) ) ;
281
282
282
283
expect ( ex ) . toEqual ( {
283
284
value : 'test' ,
@@ -310,7 +311,7 @@ describe('Tracekit - Chrome Tests', () => {
310
311
at http://localhost:5000/:50:19` ,
311
312
} ;
312
313
313
- const ex = exceptionFromError ( parser , CHROME73_EVAL_EXCEPTION ) ;
314
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME73_EVAL_EXCEPTION ) ) ;
314
315
315
316
expect ( ex ) . toEqual ( {
316
317
value : 'bad' ,
@@ -342,7 +343,7 @@ describe('Tracekit - Chrome Tests', () => {
342
343
at test (http://localhost:5000/:33:23)` ,
343
344
} ;
344
345
345
- const ex = exceptionFromError ( parser , CHROME_109_ASYNC_URL ) ;
346
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME_109_ASYNC_URL ) ) ;
346
347
347
348
expect ( ex ) . toEqual ( {
348
349
value : 'bad' ,
@@ -368,7 +369,7 @@ describe('Tracekit - Chrome Tests', () => {
368
369
at Global code (http://localhost:5000/test:24:7)` ,
369
370
} ;
370
371
371
- const ex = exceptionFromError ( parser , EDGE44_NATIVE_CODE_EXCEPTION ) ;
372
+ const ex = exceptionFromError ( parser , makeMockError ( EDGE44_NATIVE_CODE_EXCEPTION ) ) ;
372
373
373
374
expect ( ex ) . toEqual ( {
374
375
value : 'test' ,
@@ -401,7 +402,7 @@ describe('Tracekit - Chrome Tests', () => {
401
402
at Anonymous function (http://localhost:5000/:50:8)` ,
402
403
} ;
403
404
404
- const ex = exceptionFromError ( parser , EDGE44_EVAL_EXCEPTION ) ;
405
+ const ex = exceptionFromError ( parser , makeMockError ( EDGE44_EVAL_EXCEPTION ) ) ;
405
406
406
407
expect ( ex ) . toEqual ( {
407
408
value : 'aha' ,
@@ -437,7 +438,7 @@ describe('Tracekit - Chrome Tests', () => {
437
438
at TESTTESTTEST.someMethod (C:\\Users\\user\\path\\to\\file.js:295:108)` ,
438
439
} ;
439
440
440
- const ex = exceptionFromError ( parser , CHROME_ELECTRON_RENDERER ) ;
441
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME_ELECTRON_RENDERER ) ) ;
441
442
442
443
expect ( ex ) . toEqual ( {
443
444
value : "Cannot read property 'error' of undefined" ,
@@ -469,7 +470,7 @@ describe('Tracekit - Chrome Tests', () => {
469
470
at commitLayoutEffects (react-dom.development.js?f8c1:23426:1)` ,
470
471
} ;
471
472
472
- const ex = exceptionFromError ( parser , EXCEPTION ) ;
473
+ const ex = exceptionFromError ( parser , makeMockError ( EXCEPTION ) ) ;
473
474
474
475
expect ( ex ) . toEqual ( {
475
476
value : 'aha' ,
@@ -535,7 +536,7 @@ describe('Tracekit - Chrome Tests', () => {
535
536
at Array.reduce(<anonymous>)` ,
536
537
} ;
537
538
538
- const ex = exceptionFromError ( parser , EXCEPTION ) ;
539
+ const ex = exceptionFromError ( parser , makeMockError ( EXCEPTION ) ) ;
539
540
540
541
expect ( ex ) . toEqual ( {
541
542
value : 'aha' ,
@@ -582,7 +583,7 @@ describe('Tracekit - Chrome Tests', () => {
582
583
at more (http://localhost:5000/(some)/(thing)/index.html:25:7)` ,
583
584
} ;
584
585
585
- const ex = exceptionFromError ( parser , CHROME_BRACES_URL ) ;
586
+ const ex = exceptionFromError ( parser , makeMockError ( CHROME_BRACES_URL ) ) ;
586
587
587
588
expect ( ex ) . toEqual ( {
588
589
value : 'bad' ,
@@ -620,7 +621,7 @@ describe('Tracekit - Chrome Tests', () => {
620
621
at http://localhost:5000/:50:19` ,
621
622
} ;
622
623
623
- const ex = exceptionFromError ( parser , LONG_FRAME ) ;
624
+ const ex = exceptionFromError ( parser , makeMockError ( LONG_FRAME ) ) ;
624
625
625
626
expect ( ex ) . toEqual ( {
626
627
value : 'bad' ,
0 commit comments