@@ -20,7 +20,7 @@ t.test('parses JSON', t => {
20
20
} ) . map ( ( [ name , obj ] ) => [ name , JSON . stringify ( obj ) ] )
21
21
t . plan ( cases . length )
22
22
for ( const [ name , data ] of cases ) {
23
- t . deepEqual ( parseJson ( data ) , JSON . parse ( data ) , name )
23
+ t . same ( parseJson ( data ) , JSON . parse ( data ) , name )
24
24
}
25
25
} )
26
26
@@ -75,8 +75,8 @@ t.test('parses JSON if it is a Buffer, removing BOM bytes', t => {
75
75
} )
76
76
const data = Buffer . from ( str )
77
77
const bom = Buffer . concat ( [ Buffer . from ( [ 0xEF , 0xBB , 0xBF ] ) , data ] )
78
- t . deepEqual ( parseJson ( data ) , JSON . parse ( str ) )
79
- t . deepEqual ( parseJson ( bom ) , JSON . parse ( str ) , 'strips the byte order marker' )
78
+ t . same ( parseJson ( data ) , JSON . parse ( str ) )
79
+ t . same ( parseJson ( bom ) , JSON . parse ( str ) , 'strips the byte order marker' )
80
80
t . end ( )
81
81
} )
82
82
@@ -119,7 +119,7 @@ t.test('throws SyntaxError for unexpected end of JSON', t => {
119
119
t . throws (
120
120
( ) => parseJson ( data ) ,
121
121
{
122
- message : 'Unexpected end of JSON input while parsing "{\\\\ "foo: bar}"' ,
122
+ message : 'Unexpected end of JSON input while parsing "{\\"foo: bar}"' ,
123
123
code : 'EJSONPARSE' ,
124
124
position : 10 ,
125
125
name : 'JSONParseError' ,
@@ -163,7 +163,7 @@ t.test('SyntaxError with less context (limited end)', t => {
163
163
t . throws (
164
164
( ) => parseJson ( data , null , 2 ) ,
165
165
{
166
- message : 'Unexpected token "a" \\ (0x61\\ ) in JSON at position 0 while parsing near "ab..."' ,
166
+ message : 'Unexpected token "a" (0x61) in JSON at position 0 while parsing near "ab..."' ,
167
167
code : 'EJSONPARSE' ,
168
168
position : 0 ,
169
169
name : 'JSONParseError' ,
@@ -209,7 +209,7 @@ t.test('handles empty string helpfully', t => {
209
209
} )
210
210
211
211
t . test ( 'json parse error class' , t => {
212
- t . isa ( parseJson . JSONParseError , 'function' )
212
+ t . type ( parseJson . JSONParseError , 'function' )
213
213
// we already checked all the various index checking logic above
214
214
const poop = new Error ( 'poop' )
215
215
const fooShouldNotShowUpInStackTrace = ( ) => {
@@ -242,10 +242,10 @@ t.test('parse without exception', t => {
242
242
t . equal ( parseJson . noExceptions ( bad ) , undefined , 'does not throw' )
243
243
const obj = { this : 'is json' }
244
244
const good = JSON . stringify ( obj )
245
- t . deepEqual ( parseJson . noExceptions ( good ) , obj , 'parses json string' )
245
+ t . same ( parseJson . noExceptions ( good ) , obj , 'parses json string' )
246
246
const buf = Buffer . from ( good )
247
- t . deepEqual ( parseJson . noExceptions ( buf ) , obj , 'parses json buffer' )
247
+ t . same ( parseJson . noExceptions ( buf ) , obj , 'parses json buffer' )
248
248
const bom = Buffer . concat ( [ Buffer . from ( [ 0xEF , 0xBB , 0xBF ] ) , buf ] )
249
- t . deepEqual ( parseJson . noExceptions ( bom ) , obj , 'parses json buffer with bom' )
249
+ t . same ( parseJson . noExceptions ( bom ) , obj , 'parses json buffer with bom' )
250
250
t . end ( )
251
251
} )
0 commit comments