File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import * as url from 'url';
9
9
10
10
import {
11
11
type AuthMechanism ,
12
+ Double ,
12
13
HostAddress ,
13
14
Long ,
14
15
MongoClient ,
@@ -475,8 +476,13 @@ export class TestConfiguration {
475
476
if ( types . isMap ( value ) ) return { Map : Array . from ( value . entries ( ) ) } ;
476
477
if ( types . isSet ( value ) ) return { Set : Array . from ( value . values ( ) ) } ;
477
478
if ( types . isNativeError ( value ) ) return { [ value . name ] : util . inspect ( value ) } ;
478
- if ( typeof value === 'bigint' ) return new Long ( value ) . toExtendedJSON ( ) ;
479
+ if ( typeof value === 'bigint' ) return { bigint : new Long ( value ) . toExtendedJSON ( ) } ;
479
480
if ( typeof value === 'symbol' ) return `Symbol(${ value . description } )` ;
481
+ if ( typeof value === 'number' ) {
482
+ if ( Number . isNaN ( value ) || ! Number . isFinite ( value ) || Object . is ( value , - 0 ) )
483
+ // @ts -expect-error: toExtendedJSON internal on double but not on long
484
+ return { number : new Double ( value ) . toExtendedJSON ( ) } ;
485
+ }
480
486
if ( Buffer . isBuffer ( value ) )
481
487
return { [ value . constructor . name ] : Buffer . prototype . base64Slice . call ( value ) } ;
482
488
if ( value === undefined ) return { undefined : 'key was set but equal to undefined' } ;
You can’t perform that action at this time.
0 commit comments