@@ -107,7 +107,13 @@ function compareStdout(done, sourceMap, source, expected) {
107
107
'//@ sourceMappingURL=.generated.js.map' ) ;
108
108
child_process . exec ( 'node ./.generated' , function ( error , stdout , stderr ) {
109
109
try {
110
- compareLines ( ( stdout + stderr ) . trim ( ) . split ( '\n' ) , expected ) ;
110
+ compareLines (
111
+ ( stdout + stderr )
112
+ . trim ( )
113
+ . split ( '\n' )
114
+ . filter ( function ( line ) { return line !== '' } ) , // Empty lines are not relevant.
115
+ expected
116
+ ) ;
111
117
} catch ( e ) {
112
118
return done ( e ) ;
113
119
}
@@ -162,7 +168,10 @@ it('eval', function() {
162
168
'eval("throw new Error(\'test\')");'
163
169
] , [
164
170
'Error: test' ,
165
- / ^ a t O b j e c t \. e v a l \( e v a l a t < a n o n y m o u s > \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) / ,
171
+
172
+ // Before Node 4, `Object.eval`, after just `eval`.
173
+ / ^ a t (?: O b j e c t \. ) ? e v a l \( e v a l a t < a n o n y m o u s > \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) / ,
174
+
166
175
/ ^ a t O b j e c t \. e x p o r t s \. t e s t \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) $ /
167
176
] ) ;
168
177
} ) ;
@@ -172,8 +181,8 @@ it('eval inside eval', function() {
172
181
'eval("eval(\'throw new Error(\\"test\\")\')");'
173
182
] , [
174
183
'Error: test' ,
175
- / ^ a t O b j e c t \. e v a l \( e v a l a t < a n o n y m o u s > \( e v a l a t < a n o n y m o u s > \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) / ,
176
- / ^ a t O b j e c t \. e v a l \( e v a l a t < a n o n y m o u s > \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) / ,
184
+ / ^ a t (?: O b j e c t \. ) ? e v a l \( e v a l a t < a n o n y m o u s > \( e v a l a t < a n o n y m o u s > \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) / ,
185
+ / ^ a t (?: O b j e c t \. ) ? e v a l \( e v a l a t < a n o n y m o u s > \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) / ,
177
186
/ ^ a t O b j e c t \. e x p o r t s \. t e s t \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) $ /
178
187
] ) ;
179
188
} ) ;
@@ -197,7 +206,7 @@ it('eval with sourceURL', function() {
197
206
'eval("throw new Error(\'test\')//@ sourceURL=sourceURL.js");'
198
207
] , [
199
208
'Error: test' ,
200
- ' at Object. eval (sourceURL.js:1:7)' ,
209
+ / ^ a t (?: O b j e c t \. ) ? e v a l \ (s o u r c e U R L \ .j s : 1 : 7 \) $ / ,
201
210
/ ^ a t O b j e c t \. e x p o r t s \. t e s t \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) $ /
202
211
] ) ;
203
212
} ) ;
@@ -207,8 +216,8 @@ it('eval with sourceURL inside eval', function() {
207
216
'eval("eval(\'throw new Error(\\"test\\")//@ sourceURL=sourceURL.js\')");'
208
217
] , [
209
218
'Error: test' ,
210
- ' at Object. eval (sourceURL.js:1:7)' ,
211
- / ^ a t O b j e c t \. e v a l \( e v a l a t < a n o n y m o u s > \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) / ,
219
+ / ^ a t (?: O b j e c t \. ) ? e v a l \ (s o u r c e U R L \ .j s : 1 : 7 \) $ / ,
220
+ / ^ a t (?: O b j e c t \. ) ? e v a l \( e v a l a t < a n o n y m o u s > \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) / ,
212
221
/ ^ a t O b j e c t \. e x p o r t s \. t e s t \( .* \/ l i n e 1 \. j s : 1 0 0 1 : 1 0 1 \) $ /
213
222
] ) ;
214
223
} ) ;
@@ -300,7 +309,11 @@ it('handleUncaughtExceptions is false', function(done) {
300
309
] , [
301
310
/ \/ .g e n e r a t e d .j s : 2 $ / ,
302
311
'function foo() { throw new Error("this is the error"); }' ,
303
- ' ^' ,
312
+
313
+ // Before Node 4, the arrow points on the `new`, after on the
314
+ // `throw`.
315
+ / ^ (?: ) ? \^ $ / ,
316
+
304
317
'Error: this is the error' ,
305
318
/ ^ a t f o o \( .* \/ .o r i g i n a l \. j s : 1 : 1 \) $ /
306
319
] ) ;
@@ -315,7 +328,7 @@ it('default options with empty source map', function(done) {
315
328
] , [
316
329
/ \/ .g e n e r a t e d .j s : 2 $ / ,
317
330
'function foo() { throw new Error("this is the error"); }' ,
318
- ' ^' ,
331
+ / ^ (?: ) ? \^ $ / ,
319
332
'Error: this is the error' ,
320
333
/ ^ a t f o o \( .* \/ .g e n e r a t e d .j s : 2 : 2 4 \) $ /
321
334
] ) ;
@@ -330,7 +343,7 @@ it('default options with source map with gap', function(done) {
330
343
] , [
331
344
/ \/ .g e n e r a t e d .j s : 2 $ / ,
332
345
'function foo() { throw new Error("this is the error"); }' ,
333
- ' ^' ,
346
+ / ^ (?: ) ? \^ $ / ,
334
347
'Error: this is the error' ,
335
348
/ ^ a t f o o \( .* \/ .g e n e r a t e d .j s : 2 : 2 4 \) $ /
336
349
] ) ;
0 commit comments