1
+ // jscs:disable maximumLineLength
1
2
/* global StackFrame: false, ErrorStackParser: false, CapturedExceptions: false */
2
- describe ( 'ErrorStackParser' , function ( ) {
3
- describe ( '#parse' , function ( ) {
3
+ describe ( 'ErrorStackParser' , function ( ) {
4
+ describe ( '#parse' , function ( ) {
4
5
var unit = ErrorStackParser ;
5
- it ( 'should not parse IE 9 Error' , function ( ) {
6
- expect ( function ( ) {
6
+ it ( 'should not parse IE 9 Error' , function ( ) {
7
+ expect ( function ( ) {
7
8
unit . parse ( CapturedExceptions . IE_9 ) ;
8
9
} ) . toThrow ( new Error ( 'Cannot parse given Error object' ) ) ;
9
10
} ) ;
10
11
11
- it ( 'should parse Safari 6 Error.stack' , function ( ) {
12
+ it ( 'should parse Safari 6 Error.stack' , function ( ) {
12
13
var stackFrames = unit . parse ( CapturedExceptions . SAFARI_6 ) ;
13
14
expect ( stackFrames ) . toBeTruthy ( ) ;
14
15
expect ( stackFrames . length ) . toBe ( 3 ) ;
@@ -17,7 +18,7 @@ describe('ErrorStackParser', function () {
17
18
expect ( stackFrames [ 2 ] ) . toMatchStackFrame ( [ 'onclick' , undefined , 'http://path/to/file.js' , 82 ] ) ;
18
19
} ) ;
19
20
20
- it ( 'should parse Safari 7 Error.stack' , function ( ) {
21
+ it ( 'should parse Safari 7 Error.stack' , function ( ) {
21
22
var stackFrames = unit . parse ( CapturedExceptions . SAFARI_7 ) ;
22
23
expect ( stackFrames ) . toBeTruthy ( ) ;
23
24
expect ( stackFrames . length ) . toBe ( 3 ) ;
@@ -26,7 +27,7 @@ describe('ErrorStackParser', function () {
26
27
expect ( stackFrames [ 2 ] ) . toMatchStackFrame ( [ 'bar' , undefined , 'http://path/to/file.js' , 108 , 107 ] ) ;
27
28
} ) ;
28
29
29
- it ( 'should parse Safari 8 Error.stack' , function ( ) {
30
+ it ( 'should parse Safari 8 Error.stack' , function ( ) {
30
31
var stackFrames = unit . parse ( CapturedExceptions . SAFARI_8 ) ;
31
32
expect ( stackFrames ) . toBeTruthy ( ) ;
32
33
expect ( stackFrames . length ) . toBe ( 3 ) ;
@@ -46,7 +47,7 @@ describe('ErrorStackParser', function () {
46
47
expect ( stackFrames [ 4 ] ) . toMatchStackFrame ( [ 'global code' , undefined , 'http://localhost:8080/file.js' , 33 , 18 ] ) ;
47
48
} ) ;
48
49
49
- it ( 'should parse Firefox 31 Error.stack' , function ( ) {
50
+ it ( 'should parse Firefox 31 Error.stack' , function ( ) {
50
51
var stackFrames = unit . parse ( CapturedExceptions . FIREFOX_31 ) ;
51
52
expect ( stackFrames ) . toBeTruthy ( ) ;
52
53
expect ( stackFrames . length ) . toBe ( 2 ) ;
@@ -65,15 +66,15 @@ describe('ErrorStackParser', function () {
65
66
expect ( stackFrames [ 4 ] ) . toMatchStackFrame ( [ undefined , undefined , 'http://localhost:8080/file.js' , 33 , 9 ] ) ;
66
67
} ) ;
67
68
68
- it ( 'should parse function names containing @ in Firefox 43 Error.stack' , function ( ) {
69
+ it ( 'should parse function names containing @ in Firefox 43 Error.stack' , function ( ) {
69
70
var stackFrames = unit . parse ( CapturedExceptions . FIREFOX_43_FUNCTION_NAME_WITH_AT_SIGN ) ;
70
71
expect ( stackFrames ) . toBeTruthy ( ) ;
71
72
expect ( stackFrames . length ) . toBe ( 2 ) ;
72
73
expect ( stackFrames [ 0 ] ) . toMatchStackFrame ( [ 'obj["@fn"]' , undefined , 'Scratchpad/1' , 10 , 29 ] ) ;
73
74
expect ( stackFrames [ 1 ] ) . toMatchStackFrame ( [ undefined , undefined , 'Scratchpad/1' , 11 , 1 ] ) ;
74
75
} ) ;
75
76
76
- it ( 'should parse V8 Error.stack' , function ( ) {
77
+ it ( 'should parse V8 Error.stack' , function ( ) {
77
78
var stackFrames = unit . parse ( CapturedExceptions . CHROME_15 ) ;
78
79
expect ( stackFrames ) . toBeTruthy ( ) ;
79
80
expect ( stackFrames . length ) . toBe ( 4 ) ;
@@ -83,20 +84,20 @@ describe('ErrorStackParser', function () {
83
84
expect ( stackFrames [ 3 ] ) . toMatchStackFrame ( [ undefined , undefined , 'http://path/to/file.js' , 24 , 4 ] ) ;
84
85
} ) ;
85
86
86
- it ( 'should parse V8 entries with no location' , function ( ) {
87
- var stackFrames = unit . parse ( { stack : " Error\n at Array.forEach (native)" } ) ;
87
+ it ( 'should parse V8 entries with no location' , function ( ) {
88
+ var stackFrames = unit . parse ( { stack : ' Error\n at Array.forEach (native)' } ) ;
88
89
expect ( stackFrames . length ) . toBe ( 1 ) ;
89
90
expect ( stackFrames [ 0 ] ) . toMatchStackFrame ( [ 'Array.forEach' , undefined , '(native)' , undefined , undefined ] ) ;
90
91
} ) ;
91
92
92
- it ( 'should parse V8 Error.stack entries with port numbers' , function ( ) {
93
+ it ( 'should parse V8 Error.stack entries with port numbers' , function ( ) {
93
94
var stackFrames = unit . parse ( CapturedExceptions . CHROME_36 ) ;
94
95
expect ( stackFrames ) . toBeTruthy ( ) ;
95
96
expect ( stackFrames . length ) . toBe ( 2 ) ;
96
97
expect ( stackFrames [ 0 ] ) . toMatchStackFrame ( [ 'dumpExceptionError' , undefined , 'http://localhost:8080/file.js' , 41 , 27 ] ) ;
97
98
} ) ;
98
99
99
- it ( 'should parse error stacks with Constructors' , function ( ) {
100
+ it ( 'should parse error stacks with Constructors' , function ( ) {
100
101
var stackFrames = unit . parse ( CapturedExceptions . CHROME_46 ) ;
101
102
expect ( stackFrames ) . toBeTruthy ( ) ;
102
103
expect ( stackFrames . length ) . toBe ( 2 ) ;
@@ -115,7 +116,7 @@ describe('ErrorStackParser', function () {
115
116
expect ( stackFrames [ 4 ] ) . toMatchStackFrame ( [ undefined , undefined , 'http://localhost:8080/file.js' , 31 , 13 ] ) ;
116
117
} ) ;
117
118
118
- it ( 'should parse IE 10 Error stacks' , function ( ) {
119
+ it ( 'should parse IE 10 Error stacks' , function ( ) {
119
120
var stackFrames = unit . parse ( CapturedExceptions . IE_10 ) ;
120
121
expect ( stackFrames ) . toBeTruthy ( ) ;
121
122
expect ( stackFrames . length ) . toBe ( 3 ) ;
@@ -124,7 +125,7 @@ describe('ErrorStackParser', function () {
124
125
expect ( stackFrames [ 2 ] ) . toMatchStackFrame ( [ 'bar' , undefined , 'http://path/to/file.js' , 82 , 1 ] ) ;
125
126
} ) ;
126
127
127
- it ( 'should parse IE 11 Error stacks' , function ( ) {
128
+ it ( 'should parse IE 11 Error stacks' , function ( ) {
128
129
var stackFrames = unit . parse ( CapturedExceptions . IE_11 ) ;
129
130
expect ( stackFrames ) . toBeTruthy ( ) ;
130
131
expect ( stackFrames . length ) . toBe ( 3 ) ;
@@ -155,7 +156,7 @@ describe('ErrorStackParser', function () {
155
156
expect ( stackFrames [ 4 ] ) . toMatchStackFrame ( [ undefined , undefined , 'http://localhost:8080/file.js' , 31 , 13 ] ) ;
156
157
} ) ;
157
158
158
- it ( 'should parse Opera 9.27 Error messages' , function ( ) {
159
+ it ( 'should parse Opera 9.27 Error messages' , function ( ) {
159
160
var stackFrames = unit . parse ( CapturedExceptions . OPERA_927 ) ;
160
161
expect ( stackFrames ) . toBeTruthy ( ) ;
161
162
expect ( stackFrames . length ) . toBe ( 3 ) ;
@@ -164,7 +165,7 @@ describe('ErrorStackParser', function () {
164
165
expect ( stackFrames [ 2 ] ) . toMatchStackFrame ( [ undefined , undefined , 'http://path/to/file.js' , 18 ] ) ;
165
166
} ) ;
166
167
167
- it ( 'should parse Opera 10 Error messages' , function ( ) {
168
+ it ( 'should parse Opera 10 Error messages' , function ( ) {
168
169
var stackFrames = unit . parse ( CapturedExceptions . OPERA_10 ) ;
169
170
expect ( stackFrames ) . toBeTruthy ( ) ;
170
171
expect ( stackFrames . length ) . toBe ( 7 ) ;
@@ -177,7 +178,7 @@ describe('ErrorStackParser', function () {
177
178
expect ( stackFrames [ 6 ] ) . toMatchStackFrame ( [ undefined , undefined , 'http://path/to/file.js' , 15 ] ) ;
178
179
} ) ;
179
180
180
- it ( 'should parse Opera 11 Error messages' , function ( ) {
181
+ it ( 'should parse Opera 11 Error messages' , function ( ) {
181
182
var stackFrames = unit . parse ( CapturedExceptions . OPERA_11 ) ;
182
183
expect ( stackFrames ) . toBeTruthy ( ) ;
183
184
expect ( stackFrames . length ) . toBe ( 4 ) ;
@@ -187,7 +188,7 @@ describe('ErrorStackParser', function () {
187
188
expect ( stackFrames [ 3 ] ) . toMatchStackFrame ( [ undefined , undefined , 'http://path/to/file.js' , 15 ] ) ;
188
189
} ) ;
189
190
190
- it ( 'should parse Opera 25 Error stacks' , function ( ) {
191
+ it ( 'should parse Opera 25 Error stacks' , function ( ) {
191
192
var stackFrames = unit . parse ( CapturedExceptions . OPERA_25 ) ;
192
193
expect ( stackFrames ) . toBeTruthy ( ) ;
193
194
expect ( stackFrames . length ) . toBe ( 3 ) ;
@@ -196,11 +197,11 @@ describe('ErrorStackParser', function () {
196
197
expect ( stackFrames [ 2 ] ) . toMatchStackFrame ( [ 'bar' , undefined , 'http://path/to/file.js' , 108 , 168 ] ) ;
197
198
} ) ;
198
199
199
- it ( 'should handle newlines in Error stack messages' , function ( ) {
200
+ it ( 'should handle newlines in Error stack messages' , function ( ) {
200
201
var stackFrames = unit . parse ( {
201
- stack : " Error: Problem at this\nlocation. Error code:1234\n" +
202
- " at http://path/to/file.js:47:22\n" +
203
- " at foo (http://path/to/file.js:52:15)"
202
+ stack : ' Error: Problem at this\nlocation. Error code:1234\n' +
203
+ ' at http://path/to/file.js:47:22\n' +
204
+ ' at foo (http://path/to/file.js:52:15)'
204
205
} ) ;
205
206
206
207
expect ( stackFrames . length ) . toBe ( 2 ) ;
0 commit comments