0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/packages/logger/test/createLogger.spec.ts

20 lines
562 B
TypeScript

import { Writable } from 'stream';
import { createLogger } from '../src';
describe('logger test', () => {
describe('json format', () => {
test('should write json to a stream', () => {
const stream = new Writable({
write(chunk, encoding, callback) {
expect(JSON.parse(chunk.toString())).toEqual(
expect.objectContaining({ level: 30, msg: 'test' })
);
callback();
},
});
const logger = createLogger({ level: 'http' }, stream, 'json');
logger.info('test');
});
});
});