Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 14eb91b

Browse files
author
Michal Vlasák
committed
Add test of silent level
1 parent 9f3f7fb commit 14eb91b

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/tests/index.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,24 @@ test('logger version is logged', () => {
205205
logger.fatal('Hello');
206206
expect(loggerWrites).toBeCalled();
207207
});
208+
209+
test('silent stream does not write', () => {
210+
const loggerWrites = jest.fn();
211+
const logger = loggerFactory({
212+
streams: [
213+
{
214+
stream: new Writable({
215+
write: (chunk, encoding, next) => {
216+
const json = JSON.parse(chunk);
217+
loggerWrites();
218+
next();
219+
},
220+
}),
221+
level: 'silent',
222+
},
223+
],
224+
});
225+
226+
logger.fatal('Hello');
227+
expect(loggerWrites).not.toBeCalled();
228+
});

0 commit comments

Comments
 (0)