@@ -8,7 +8,7 @@ test('creates basic log lines with level', (t) => {
88 const input = JSON . stringify ( {
99 level : 30 ,
1010 } ) ;
11- const output = prettify ( ) ( input ) ?? '' ;
11+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ?? '' ;
1212 t . true ( hasAnsi ( output ) ) ;
1313 t . snapshot ( output ) ;
1414} ) ;
@@ -18,7 +18,7 @@ test('creates basic log lines with string level', (t) => {
1818 level : 'info' ,
1919 msg : 'hello' ,
2020 } ) ;
21- const output = prettify ( ) ( input ) ;
21+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ;
2222 t . snapshot ( output ) ;
2323} ) ;
2424
@@ -27,7 +27,7 @@ test('creates basic log lines with level, message, and time', (t) => {
2727 level : 30 ,
2828 message : 'hello' ,
2929 } ) ;
30- const output = prettify ( ) ( input ) ;
30+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ;
3131 t . snapshot ( output ) ;
3232} ) ;
3333
@@ -39,7 +39,7 @@ test('creates basic log lines with level, message, and time, and res.statusCode'
3939 statusCode : 200 ,
4040 } ,
4141 } ) ;
42- const output = prettify ( ) ( input ) ;
42+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ;
4343 t . snapshot ( output ) ;
4444} ) ;
4545
@@ -55,7 +55,7 @@ test('creates basic log lines with level, message, and time, and req.method', (t
5555 statusCode : 200 ,
5656 } ,
5757 } ) ;
58- const output = prettify ( ) ( input ) ;
58+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ;
5959 t . snapshot ( output ) ;
6060} ) ;
6161
@@ -76,7 +76,7 @@ test('full log line with all time and no extra time', (t) => {
7676 id : '123' ,
7777 responsedate : 100 ,
7878 } ) ;
79- const output = prettify ( ) ( input ) ;
79+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ;
8080 t . snapshot ( output ) ;
8181} ) ;
8282
@@ -97,7 +97,7 @@ test('full log line with all time and extra time', (t) => {
9797 responsedate : 100 ,
9898 extra : 'time' ,
9999 } ) ;
100- const output = prettify ( ) ( input ) ;
100+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ;
101101 t . snapshot ( output ) ;
102102} ) ;
103103
@@ -126,7 +126,7 @@ test('full log line with all time and extra time multiline', (t) => {
126126 extra : 'time' ,
127127 } ,
128128 } ) ;
129- const output = prettify ( ) ( input ) ;
129+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ;
130130 t . snapshot ( output ) ;
131131} ) ;
132132
@@ -137,8 +137,12 @@ test('custom time format', (t) => {
137137 time,
138138 msg : 'hello' ,
139139 } ) ;
140- const defaultOutput = prettify ( ) ( input ) ;
141- const output = prettify ( { timeFormat : 'yyyy-MM-dd HH:mm:ss' } ) ( input ) ;
140+ const defaultOutput = prettify ( { colors : true , unicode : true } ) ( input ) ;
141+ const output = prettify ( {
142+ timeFormat : 'yyyy-MM-dd HH:mm:ss' ,
143+ colors : true ,
144+ unicode : true ,
145+ } ) ( input ) ;
142146 const formattedTime = format ( time , 'yyyy-MM-dd HH:mm:ss' ) ;
143147 t . false ( defaultOutput . includes ( formattedTime ) ) ;
144148 t . true ( output . includes ( `[${ formattedTime } ]` ) ) ;
@@ -149,12 +153,14 @@ test('custom message key', (t) => {
149153 level : 30 ,
150154 msg : 'hello' ,
151155 } ) ;
152- const outputDefault = prettify ( ) ( inputDefault ) ;
156+ const outputDefault = prettify ( { colors : true , unicode : true } ) ( inputDefault ) ;
153157 const input = JSON . stringify ( {
154158 level : 30 ,
155159 message : 'hello' ,
156160 } ) ;
157- const output = prettify ( { messageKey : 'message' } ) ( input ) ;
161+ const output = prettify ( { messageKey : 'message' , colors : true , unicode : true } ) (
162+ input ,
163+ ) ;
158164 t . is ( outputDefault , output ) ;
159165} ) ;
160166
@@ -164,12 +170,12 @@ test('err key', (t) => {
164170 level : 50 ,
165171 err : error ,
166172 } ) ;
167- const outputDefault = prettify ( ) ( inputDefault ) ;
173+ const outputDefault = prettify ( { colors : true , unicode : true } ) ( inputDefault ) ;
168174 const input = JSON . stringify ( {
169175 level : 50 ,
170176 error,
171177 } ) ;
172- const output = prettify ( ) ( input ) ;
178+ const output = prettify ( { colors : true , unicode : true } ) ( input ) ;
173179 t . is ( outputDefault , output ) ;
174180} ) ;
175181
@@ -179,12 +185,14 @@ test('custom time key', (t) => {
179185 level : 50 ,
180186 time,
181187 } ) ;
182- const outputDefault = prettify ( ) ( inputDefault ) ;
188+ const outputDefault = prettify ( { colors : true , unicode : true } ) ( inputDefault ) ;
183189 const input = JSON . stringify ( {
184190 level : 50 ,
185191 timestamp : time ,
186192 } ) ;
187- const output = prettify ( { timeKey : 'timestamp' } ) ( input ) ;
193+ const output = prettify ( { timeKey : 'timestamp' , colors : true , unicode : true } ) (
194+ input ,
195+ ) ;
188196 t . is ( outputDefault , output ) ;
189197} ) ;
190198
@@ -202,10 +210,12 @@ test('custom formatters are merged in the same order as default', (t) => {
202210 } ,
203211 customField : 'customValue' ,
204212 } ) ;
205- const defaultOutput = prettify ( ) ( input ) ;
213+ const defaultOutput = prettify ( { colors : true , unicode : true } ) ( input ) ;
206214 t . snapshot ( defaultOutput ) ;
207215 const output = prettify ( {
208216 format : { msg : ( msg ) => `!!!${ msg } !!!` , name : ( name ) => `!!!${ name } !!!` } ,
217+ colors : true ,
218+ unicode : true ,
209219 } ) ( input ) ;
210220 t . snapshot ( output ) ;
211221 t . true ( output . startsWith ( '!!!test!!!' ) ) ;
@@ -220,8 +230,10 @@ test('creates extra log as single line', (t) => {
220230 c : 'd' ,
221231 } ,
222232 } ) ;
223- const output = prettify ( { singleLine : true } ) ( input ) ;
224- const defaultOutput = prettify ( ) ( input ) ;
233+ const output = prettify ( { singleLine : true , colors : true , unicode : true } ) (
234+ input ,
235+ ) ;
236+ const defaultOutput = prettify ( { colors : true , unicode : true } ) ( input ) ;
225237 t . snapshot ( output ) ;
226238 t . true ( defaultOutput . trim ( ) . includes ( '\n' ) ) ;
227239 t . false ( output . trim ( ) . includes ( '\n' ) ) ;
0 commit comments