@@ -780,6 +780,47 @@ describe("Logger: settings", () => {
780780 expect ( stdStringGroups2 ?. [ 3 ] ) . toBe ( "[xxx]" ) ;
781781 } ) ;
782782
783+ test ( "init logger(type=json): empty maskValuesOfKeys" , ( ) : void => {
784+ const stdArray : string [ ] = [ ] ;
785+ const std : { write : ( line : string ) => void } = {
786+ write : ( line : string ) => {
787+ stdArray . push ( line ) ;
788+ } ,
789+ } ;
790+ const logger : Logger = new Logger ( {
791+ type : "json" ,
792+ maskValuesOfKeys : [ ] ,
793+ stdOut : std ,
794+ stdErr : std ,
795+ } ) ;
796+ let verySecretiveCircularObject = {
797+ password : "swordfish" ,
798+ Authorization : 1234567 ,
799+ stringPwd : "swordfish" ,
800+ nested : {
801+ regularString : "I am just a regular string." ,
802+ otherString : "pass1234.567" ,
803+ } ,
804+ } ;
805+ verySecretiveCircularObject . nested [
806+ "circular"
807+ ] = verySecretiveCircularObject ;
808+
809+ const { argumentsArray } = logger . info ( verySecretiveCircularObject ) ;
810+ expect ( argumentsArray [ 0 ] ) . toBe ( verySecretiveCircularObject ) ;
811+
812+ stdArray . length = 0 ;
813+ const undefinedMaskValuesLogger : Logger = new Logger ( {
814+ type : "json" ,
815+ maskValuesOfKeys : undefined ,
816+ stdOut : std ,
817+ stdErr : std ,
818+ } ) ;
819+
820+ const { argumentsArray : undefinedMaskValuesArgArray } = undefinedMaskValuesLogger . info ( verySecretiveCircularObject ) ;
821+ expect ( undefinedMaskValuesArgArray [ 0 ] ) . toBe ( verySecretiveCircularObject ) ;
822+ } ) ;
823+
783824 test ( "init logger(type=pretty): maskAnyRegEx" , ( ) : void => {
784825 const stdArray : string [ ] = [ ] ;
785826 const std : { write : ( line : string ) => void } = {
0 commit comments