@@ -44,7 +44,7 @@ Done.`),
4444 expect (
4545 decodeLenientJson ( `{
4646 // Comments are valid in settings files.
47- "enabled": true,
47+ "enabled": /* See "https://example.com/config" // still in the block */ true,
4848 "values": [1, 2,],
4949 }` ) ,
5050 ) . toEqual ( {
@@ -55,29 +55,11 @@ Done.`),
5555
5656 it ( "rejects malformed JSON after lenient preprocessing" , ( ) => {
5757 expect ( ( ) => decodeLenientJson ( '{ "enabled": true,, }' ) ) . toThrow ( ) ;
58+ expect ( ( ) => decodeLenientJson ( "[1/* https://example.com */2]" ) ) . toThrow ( ) ;
5859 } ) ;
5960
60- it . each ( [
61- "[1/* https://example.com */2]" ,
62- "[1/* https://example.com */.5]" ,
63- "[tr/* https://example.com */ue]" ,
64- ] ) ( "rejects tokens separated by a block comment in %s" , ( input ) => {
65- expect ( ( ) => decodeLenientJson ( input ) ) . toThrow ( ) ;
66- } ) ;
67-
68- it ( "preserves comment markers inside string values" , ( ) => {
61+ it ( "preserves comment markers and commas before brackets inside string values" , ( ) => {
6962 expect ( decodeLenientJson ( '"1/* https://example.com */2"' ) ) . toBe ( "1/* https://example.com */2" ) ;
70- } ) ;
71-
72- it . each ( [
73- '{ /* See https://example.com/config */ "enabled": true }' ,
74- '{ "enabled": /* // this is still a block comment */ true }' ,
75- '{ "enabled": true /* a "quoted" note with // markers */ }' ,
76- ] ) ( "preserves block comment boundaries in %s" , ( input ) => {
77- expect ( decodeLenientJson ( input ) ) . toEqual ( { enabled : true } ) ;
78- } ) ;
79-
80- it ( "preserves commas before brackets inside string values" , ( ) => {
8163 expect ( decodeLenientJson ( '{"note":"a,]"}' ) ) . toEqual ( { note : "a,]" } ) ;
8264 expect ( decodeLenientJson ( '{"list":["x,}"]}' ) ) . toEqual ( { list : [ "x,}" ] } ) ;
8365 expect ( decodeLenientJson ( '{"values":[1, 2,],}' ) ) . toEqual ( { values : [ 1 , 2 ] } ) ;
0 commit comments