11/* global StackFrame: false, StackParser: false, CapturedExceptions: false */
2+ describe ( 'StackParser' , function ( ) {
3+ describe ( '#parse' , function ( ) {
4+ var unit = new StackParser ( ) ;
5+ it ( 'should parse Safari 6 Error.stack' , function ( ) {
6+ var stackFrames = unit . parse ( CapturedExceptions . SAFARI_6 ) ;
7+ expect ( stackFrames ) . toBeTruthy ( ) ;
8+ expect ( stackFrames . length ) . toBe ( 3 ) ;
9+ expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '48' ) ) ;
10+ expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'dumpException3' , [ ] , 'http://path/to/file.js' , '52' ) ) ;
11+ expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'onclick' , [ ] , 'http://path/to/file.js' , '82' ) ) ;
12+ } ) ;
213
3- describe ( 'error-parser.js' , function ( ) {
4- describe ( 'StackParser' , function ( ) {
5- describe ( '#parse' , function ( ) {
6- var unit = new StackParser ( ) ;
7- it ( 'should parse Safari 6 Error.stack' , function ( ) {
8- var stackFrames = unit . parse ( CapturedExceptions . SAFARI_6 ) ;
9- expect ( stackFrames ) . toBeTruthy ( ) ;
10- expect ( stackFrames . length ) . toBe ( 3 ) ;
11- expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '48' ) ) ;
12- expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'dumpException3' , [ ] , 'http://path/to/file.js' , '52' ) ) ;
13- expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'onclick' , [ ] , 'http://path/to/file.js' , '82' ) ) ;
14- } ) ;
15-
16- it ( 'should parse Safari 7 Error.stack' , function ( ) {
17- var stackFrames = unit . parse ( CapturedExceptions . SAFARI_7 ) ;
18- expect ( stackFrames ) . toBeTruthy ( ) ;
19- expect ( stackFrames . length ) . toBe ( 3 ) ;
20- expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '48' , '22' ) ) ;
21- expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '52' , '15' ) ) ;
22- expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '108' , '107' ) ) ;
23- } ) ;
14+ it ( 'should parse Safari 7 Error.stack' , function ( ) {
15+ var stackFrames = unit . parse ( CapturedExceptions . SAFARI_7 ) ;
16+ expect ( stackFrames ) . toBeTruthy ( ) ;
17+ expect ( stackFrames . length ) . toBe ( 3 ) ;
18+ expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '48' , '22' ) ) ;
19+ expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '52' , '15' ) ) ;
20+ expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '108' , '107' ) ) ;
21+ } ) ;
2422
25- it ( 'should parse Firefox 31 Error.stack' , function ( ) {
26- var stackFrames = unit . parse ( CapturedExceptions . FIREFOX_31 ) ;
27- expect ( stackFrames ) . toBeTruthy ( ) ;
28- expect ( stackFrames . length ) . toBe ( 2 ) ;
29- expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '41' , '13' ) ) ;
30- expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '1' , '1' ) ) ;
31- } ) ;
23+ it ( 'should parse Firefox 31 Error.stack' , function ( ) {
24+ var stackFrames = unit . parse ( CapturedExceptions . FIREFOX_31 ) ;
25+ expect ( stackFrames ) . toBeTruthy ( ) ;
26+ expect ( stackFrames . length ) . toBe ( 2 ) ;
27+ expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '41' , '13' ) ) ;
28+ expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '1' , '1' ) ) ;
29+ } ) ;
3230
33- it ( 'should parse V8 Error stacks' , function ( ) {
34- var stackFrames = unit . parse ( CapturedExceptions . CHROME_15 ) ;
35- expect ( stackFrames ) . toBeTruthy ( ) ;
36- expect ( stackFrames . length ) . toBe ( 4 ) ;
37- expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '13' , '17' ) ) ;
38- expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '16' , '5' ) ) ;
39- expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '20' , '5' ) ) ;
40- expect ( stackFrames [ 3 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '24' , '4' ) ) ;
41- } ) ;
31+ it ( 'should parse V8 Error stacks' , function ( ) {
32+ var stackFrames = unit . parse ( CapturedExceptions . CHROME_15 ) ;
33+ expect ( stackFrames ) . toBeTruthy ( ) ;
34+ expect ( stackFrames . length ) . toBe ( 4 ) ;
35+ expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '13' , '17' ) ) ;
36+ expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '16' , '5' ) ) ;
37+ expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '20' , '5' ) ) ;
38+ expect ( stackFrames [ 3 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '24' , '4' ) ) ;
39+ } ) ;
4240
43- it ( 'should parse IE 10 Error stacks' , function ( ) {
44- var stackFrames = unit . parse ( CapturedExceptions . IE_10 ) ;
45- expect ( stackFrames ) . toBeTruthy ( ) ;
46- expect ( stackFrames . length ) . toBe ( 3 ) ;
47- expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '48' , '13' ) ) ;
48- expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '46' , '9' ) ) ;
49- expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '82' , '1' ) ) ;
50- } ) ;
41+ it ( 'should parse IE 10 Error stacks' , function ( ) {
42+ var stackFrames = unit . parse ( CapturedExceptions . IE_10 ) ;
43+ expect ( stackFrames ) . toBeTruthy ( ) ;
44+ expect ( stackFrames . length ) . toBe ( 3 ) ;
45+ expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '48' , '13' ) ) ;
46+ expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '46' , '9' ) ) ;
47+ expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '82' , '1' ) ) ;
48+ } ) ;
5149
52- it ( 'should parse Opera 9.27 Error messages' , function ( ) {
53- var stackFrames = unit . parse ( CapturedExceptions . OPERA_927 ) ;
54- expect ( stackFrames ) . toBeTruthy ( ) ;
55- expect ( stackFrames . length ) . toBe ( 3 ) ;
56- expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '42' ) ) ;
57- expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '27' ) ) ;
58- expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '18' ) ) ;
59- } ) ;
50+ it ( 'should parse Opera 9.27 Error messages' , function ( ) {
51+ var stackFrames = unit . parse ( CapturedExceptions . OPERA_927 ) ;
52+ expect ( stackFrames ) . toBeTruthy ( ) ;
53+ expect ( stackFrames . length ) . toBe ( 3 ) ;
54+ expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '42' ) ) ;
55+ expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '27' ) ) ;
56+ expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( 'foo' , [ ] , 'http://path/to/file.js' , '18' ) ) ;
57+ } ) ;
6058
61- it ( 'should parse Opera 11 Error messages' , function ( ) {
62- var stackFrames = unit . parse ( CapturedExceptions . OPERA_11 ) ;
63- expect ( stackFrames ) . toBeTruthy ( ) ;
64- expect ( stackFrames . length ) . toBe ( 4 ) ;
65- expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'run' , [ ] , 'http://path/to/file.js' , '27' ) ) ;
66- expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '18' ) ) ;
67- expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '11' ) ) ;
68- expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '15' ) ) ;
69- } ) ;
59+ it ( 'should parse Opera 11 Error messages' , function ( ) {
60+ var stackFrames = unit . parse ( CapturedExceptions . OPERA_11 ) ;
61+ expect ( stackFrames ) . toBeTruthy ( ) ;
62+ expect ( stackFrames . length ) . toBe ( 4 ) ;
63+ expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'run' , [ ] , 'http://path/to/file.js' , '27' ) ) ;
64+ expect ( stackFrames [ 0 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '18' ) ) ;
65+ expect ( stackFrames [ 1 ] ) . toEqual ( new StackFrame ( 'bar' , [ ] , 'http://path/to/file.js' , '11' ) ) ;
66+ expect ( stackFrames [ 2 ] ) . toEqual ( new StackFrame ( '' , [ ] , 'http://path/to/file.js' , '15' ) ) ;
7067 } ) ;
7168 } ) ;
72- } ) ;
69+ } ) ;
0 commit comments