@@ -126,19 +126,19 @@ const unixTests = [
126
126
const strictModeTests = [
127
127
{
128
128
send : 'ref = 1' ,
129
- expect : [ 'Thrown:' , / ^ R e f e r e n c e E r r o r : \s / ]
129
+ expect : [ / ^ U n c a u g h t R e f e r e n c e E r r o r : \s / ]
130
130
}
131
131
] ;
132
132
133
133
const errorTests = [
134
134
// Uncaught error throws and prints out
135
135
{
136
136
send : 'throw new Error(\'test error\');' ,
137
- expect : [ 'Thrown:' , ' Error: test error']
137
+ expect : [ 'Uncaught Error: test error' ]
138
138
} ,
139
139
{
140
140
send : "throw { foo: 'bar' };" ,
141
- expect : "Thrown: { foo: 'bar' }"
141
+ expect : "Uncaught { foo: 'bar' }"
142
142
} ,
143
143
// Common syntax error is treated as multiline command
144
144
{
@@ -153,7 +153,7 @@ const errorTests = [
153
153
// But passing the same string to eval() should throw
154
154
{
155
155
send : 'eval("function test_func() {")' ,
156
- expect : [ 'Thrown:' , / ^ S y n t a x E r r o r : / ]
156
+ expect : [ / ^ U n c a u g h t S y n t a x E r r o r : / ]
157
157
} ,
158
158
// Can handle multiline template literals
159
159
{
@@ -210,89 +210,84 @@ const errorTests = [
210
210
// should throw
211
211
{
212
212
send : 'JSON.parse(\'{invalid: \\\'json\\\'}\');' ,
213
- expect : [ 'Thrown:' , / ^ S y n t a x E r r o r : / ]
213
+ expect : [ / ^ U n c a u g h t S y n t a x E r r o r : / ]
214
214
} ,
215
215
// End of input to JSON.parse error is special case of syntax error,
216
216
// should throw
217
217
{
218
218
send : 'JSON.parse(\'066\');' ,
219
- expect : [ 'Thrown:' , / ^ S y n t a x E r r o r : / ]
219
+ expect : [ / ^ U n c a u g h t S y n t a x E r r o r : / ]
220
220
} ,
221
221
// should throw
222
222
{
223
223
send : 'JSON.parse(\'{\');' ,
224
- expect : [ 'Thrown:' , / ^ S y n t a x E r r o r : / ]
224
+ expect : [ / ^ U n c a u g h t S y n t a x E r r o r : / ]
225
225
} ,
226
226
// invalid RegExps are a special case of syntax error,
227
227
// should throw
228
228
{
229
229
send : '/(/;' ,
230
- expect : [ 'Thrown:' , / ^ S y n t a x E r r o r : / ]
230
+ expect : [ / ^ U n c a u g h t S y n t a x E r r o r : / ]
231
231
} ,
232
232
// invalid RegExp modifiers are a special case of syntax error,
233
233
// should throw (GH-4012)
234
234
{
235
235
send : 'new RegExp("foo", "wrong modifier");' ,
236
- expect : [ 'Thrown:' , / ^ S y n t a x E r r o r : / ]
236
+ expect : [ / ^ U n c a u g h t S y n t a x E r r o r : / ]
237
237
} ,
238
238
// Strict mode syntax errors should be caught (GH-5178)
239
239
{
240
240
send : '(function() { "use strict"; return 0755; })()' ,
241
241
expect : [
242
- 'Thrown:' ,
243
242
kSource ,
244
243
kArrow ,
245
244
'' ,
246
- / ^ S y n t a x E r r o r : /
245
+ / ^ U n c a u g h t S y n t a x E r r o r : /
247
246
]
248
247
} ,
249
248
{
250
249
send : '(function(a, a, b) { "use strict"; return a + b + c; })()' ,
251
250
expect : [
252
- 'Thrown:' ,
253
251
kSource ,
254
252
kArrow ,
255
253
'' ,
256
- / ^ S y n t a x E r r o r : /
254
+ / ^ U n c a u g h t S y n t a x E r r o r : /
257
255
]
258
256
} ,
259
257
{
260
258
send : '(function() { "use strict"; with (this) {} })()' ,
261
259
expect : [
262
- 'Thrown:' ,
263
260
kSource ,
264
261
kArrow ,
265
262
'' ,
266
- / ^ S y n t a x E r r o r : /
263
+ / ^ U n c a u g h t S y n t a x E r r o r : /
267
264
]
268
265
} ,
269
266
{
270
267
send : '(function() { "use strict"; var x; delete x; })()' ,
271
268
expect : [
272
- 'Thrown:' ,
273
269
kSource ,
274
270
kArrow ,
275
271
'' ,
276
- / ^ S y n t a x E r r o r : /
272
+ / ^ U n c a u g h t S y n t a x E r r o r : /
277
273
]
278
274
} ,
279
275
{
280
276
send : '(function() { "use strict"; eval = 17; })()' ,
281
277
expect : [
282
- 'Thrown:' ,
283
278
kSource ,
284
279
kArrow ,
285
280
'' ,
286
- / ^ S y n t a x E r r o r : /
281
+ / ^ U n c a u g h t S y n t a x E r r o r : /
287
282
]
288
283
} ,
289
284
{
290
285
send : '(function() { "use strict"; if (true) function f() { } })()' ,
291
286
expect : [
292
- 'Thrown:' ,
293
287
kSource ,
294
288
kArrow ,
295
289
'' ,
290
+ 'Uncaught:' ,
296
291
/ ^ S y n t a x E r r o r : /
297
292
]
298
293
} ,
@@ -413,11 +408,10 @@ const errorTests = [
413
408
{
414
409
send : '[] \\' ,
415
410
expect : [
416
- 'Thrown:' ,
417
411
kSource ,
418
412
kArrow ,
419
413
'' ,
420
- / ^ S y n t a x E r r o r : /
414
+ / ^ U n c a u g h t S y n t a x E r r o r : /
421
415
]
422
416
} ,
423
417
// Do not fail when a String is created with line continuation
@@ -548,8 +542,7 @@ const errorTests = [
548
542
{
549
543
send : 'require("internal/repl")' ,
550
544
expect : [
551
- 'Thrown:' ,
552
- / ^ E r r o r : C a n n o t f i n d m o d u l e ' i n t e r n a l \/ r e p l ' / ,
545
+ / ^ U n c a u g h t E r r o r : C a n n o t f i n d m o d u l e ' i n t e r n a l \/ r e p l ' / ,
553
546
/ ^ R e q u i r e s t a c k : / ,
554
547
/ ^ - < r e p l > / ,
555
548
/ ^ a t .* / ,
@@ -587,11 +580,10 @@ const errorTests = [
587
580
{
588
581
send : 'a = 3.5e' ,
589
582
expect : [
590
- 'Thrown:' ,
591
583
kSource ,
592
584
kArrow ,
593
585
'' ,
594
- / ^ S y n t a x E r r o r : /
586
+ / ^ U n c a u g h t S y n t a x E r r o r : /
595
587
]
596
588
} ,
597
589
// Mitigate https://github.com/nodejs/node/issues/548
@@ -607,22 +599,20 @@ const errorTests = [
607
599
{
608
600
send : 'a = 3.5e' ,
609
601
expect : [
610
- 'Thrown:' ,
611
602
kSource ,
612
603
kArrow ,
613
604
'' ,
614
- / ^ S y n t a x E r r o r : /
605
+ / ^ U n c a u g h t S y n t a x E r r o r : /
615
606
]
616
607
} ,
617
608
// Avoid emitting stack trace
618
609
{
619
610
send : 'a = 3.5e' ,
620
611
expect : [
621
- 'Thrown:' ,
622
612
kSource ,
623
613
kArrow ,
624
614
'' ,
625
- / ^ S y n t a x E r r o r : /
615
+ / ^ U n c a u g h t S y n t a x E r r o r : /
626
616
]
627
617
} ,
628
618
@@ -687,11 +677,10 @@ const errorTests = [
687
677
{
688
678
send : '...[]' ,
689
679
expect : [
690
- 'Thrown:' ,
691
680
kSource ,
692
681
kArrow ,
693
682
'' ,
694
- / ^ S y n t a x E r r o r : /
683
+ / ^ U n c a u g h t S y n t a x E r r o r : /
695
684
]
696
685
} ,
697
686
// Bring back the repl to prompt
@@ -702,31 +691,28 @@ const errorTests = [
702
691
{
703
692
send : 'console.log("Missing comma in arg list" process.version)' ,
704
693
expect : [
705
- 'Thrown:' ,
706
694
kSource ,
707
695
kArrow ,
708
696
'' ,
709
- / ^ S y n t a x E r r o r : /
697
+ / ^ U n c a u g h t S y n t a x E r r o r : /
710
698
]
711
699
} ,
712
700
{
713
701
send : 'x = {\nfield\n{' ,
714
702
expect : [
715
- '... ... Thrown:' ,
716
- '{' ,
703
+ '... ... {' ,
717
704
kArrow ,
718
705
'' ,
719
- / ^ S y n t a x E r r o r : /
706
+ / ^ U n c a u g h t S y n t a x E r r o r : /
720
707
]
721
708
} ,
722
709
{
723
710
send : '(2 + 3))' ,
724
711
expect : [
725
- 'Thrown:' ,
726
712
kSource ,
727
713
kArrow ,
728
714
'' ,
729
- / ^ S y n t a x E r r o r : /
715
+ / ^ U n c a u g h t S y n t a x E r r o r : /
730
716
]
731
717
} ,
732
718
{
@@ -740,11 +726,10 @@ const errorTests = [
740
726
{
741
727
send : '} else {' ,
742
728
expect : [
743
- 'Thrown:' ,
744
729
kSource ,
745
730
kArrow ,
746
731
'' ,
747
- / ^ S y n t a x E r r o r : /
732
+ / ^ U n c a u g h t S y n t a x E r r o r : /
748
733
]
749
734
} ,
750
735
] ;
0 commit comments