mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
21 lines
562 B
TypeScript
21 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');
|
||
|
});
|
||
|
});
|
||
|
});
|