@@ -171,7 +171,7 @@ t.test('throws SyntaxError for unexpected end of JSON', (t) => {
171
171
20 : / U n t e r m i n a t e d s t r i n g i n J S O N a t p o s i t i o n \d + / ,
172
172
default : / U n e x p e c t e d e n d o f J S O N i n p u t / ,
173
173
} ,
174
- / w h i l e p a r s i n g " { \\ " f o o : b a r } " /
174
+ / . * w h i l e p a r s i n g " { \\ " f o o : b a r } " /
175
175
) ,
176
176
code : 'EJSONPARSE' ,
177
177
position : getLatestMatchingNode ( { 20 : 11 , default : 10 } ) ,
@@ -207,7 +207,7 @@ t.test('SyntaxError with less context (limited start)', (t) => {
207
207
20 : 'Unterminated string in JSON at position 9' ,
208
208
default : 'Unexpected end of JSON input' ,
209
209
} ,
210
- ' while parsing near "...' ,
210
+ / . * w h i l e p a r s i n g n e a r " \. \. \. / ,
211
211
{
212
212
20 : '210' ,
213
213
default : '3210' ,
@@ -230,7 +230,7 @@ t.test('SyntaxError with less context (limited end)', (t) => {
230
230
20 : ', "abcde" is not valid JSON' ,
231
231
default : ' in JSON at position 0' ,
232
232
} ,
233
- ' while parsing ' ,
233
+ / . * w h i l e p a r s i n g . * / ,
234
234
{
235
235
20 : "'abcd'" ,
236
236
default : 'near "ab..."' ,
@@ -247,9 +247,12 @@ t.test('SyntaxError with less context (limited end)', (t) => {
247
247
t . test ( 'throws for end of input' , ( t ) => {
248
248
const data = '{"a":1,""'
249
249
jsonThrows ( t , data , 2 , {
250
- message : expectMessage ( 'Unexpected end of JSON input while parsing' ) ,
250
+ message : expectMessage ( {
251
+ 22 : `Expected ':' after property name in JSON at` ,
252
+ default : 'Unexpected end of JSON input while parsing' ,
253
+ } ) ,
251
254
code : 'EJSONPARSE' ,
252
- position : 8 ,
255
+ position : getLatestMatchingNode ( { 22 : 9 , default : 8 } ) ,
253
256
name : 'JSONParseError' ,
254
257
systemError : SyntaxError ,
255
258
} )
0 commit comments