File tree Expand file tree Collapse file tree 2 files changed +32
-2
lines changed
Expand file tree Collapse file tree 2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -522,10 +522,10 @@ export class ConsoleLogger implements LoggerService {
522522 breakLength,
523523 } ;
524524
525- if ( this . options . maxArrayLength ) {
525+ if ( typeof this . options . maxArrayLength !== 'undefined' ) {
526526 inspectOptions . maxArrayLength = this . options . maxArrayLength ;
527527 }
528- if ( this . options . maxStringLength ) {
528+ if ( typeof this . options . maxStringLength !== 'undefined' ) {
529529 inspectOptions . maxStringLength = this . options . maxStringLength ;
530530 }
531531
Original file line number Diff line number Diff line change @@ -897,6 +897,36 @@ describe('Logger', () => {
897897 processStdoutWriteSpy . restore ( ) ;
898898 } ) ;
899899
900+ it ( 'should respect maxStringLength when set to 0' , ( ) => {
901+ const consoleLogger = new ConsoleLogger ( {
902+ colors : false ,
903+ compact : false ,
904+ maxStringLength : 0 ,
905+ } ) ;
906+
907+ consoleLogger . log ( { name : 'abcdef' } ) ;
908+
909+ expect ( processStdoutWriteSpy . calledOnce ) . to . be . true ;
910+ expect ( processStdoutWriteSpy . firstCall . firstArg ) . to . include (
911+ "''... 6 more characters" ,
912+ ) ;
913+ } ) ;
914+
915+ it ( 'should respect maxArrayLength when set to 0' , ( ) => {
916+ const consoleLogger = new ConsoleLogger ( {
917+ colors : false ,
918+ compact : false ,
919+ maxArrayLength : 0 ,
920+ } ) ;
921+
922+ consoleLogger . log ( { items : [ 'a' , 'b' , 'c' ] } ) ;
923+
924+ expect ( processStdoutWriteSpy . calledOnce ) . to . be . true ;
925+ expect ( processStdoutWriteSpy . firstCall . firstArg ) . to . include (
926+ '... 3 more items' ,
927+ ) ;
928+ } ) ;
929+
900930 it ( 'should support custom formatter' , ( ) => {
901931 class CustomConsoleLogger extends ConsoleLogger {
902932 protected formatMessage (
You can’t perform that action at this time.
0 commit comments