File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 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';
99
1010import {
1111 type AuthMechanism ,
12+ Double ,
1213 HostAddress ,
1314 Long ,
1415 MongoClient ,
@@ -475,8 +476,13 @@ export class TestConfiguration {
475476 if ( types . isMap ( value ) ) return { Map : Array . from ( value . entries ( ) ) } ;
476477 if ( types . isSet ( value ) ) return { Set : Array . from ( value . values ( ) ) } ;
477478 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 ( ) } ;
479480 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+ }
480486 if ( Buffer . isBuffer ( value ) )
481487 return { [ value . constructor . name ] : Buffer . prototype . base64Slice . call ( value ) } ;
482488 if ( value === undefined ) return { undefined : 'key was set but equal to undefined' } ;
You can’t perform that action at this time.
0 commit comments