0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00
verdaccio/packages/logger/logger-commons/test/createLogger.spec.ts
renovate[bot] 51e571a1ba
chore(deps): update dependency @crowdin/cli to v4.4.1 (master) (#4979)
* chore(deps): update dependency @crowdin/cli to v4.4.1

* clean up

* test

* missing package migrate

* clean up

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Juan Picado <juanpicado19@gmail.com>
2024-12-07 22:35:48 +01:00

22 lines
642 B
TypeScript

import pino from 'pino';
import { Writable } from 'stream';
import { describe, expect, test } from 'vitest';
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', pino);
logger.info('test');
});
});
});