mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-24 21:15:51 +01:00
fix: do not throw multiple logger deprecation warning if using default logger config (#2446)
This commit is contained in:
parent
90818700a3
commit
2c594910d8
5
.changeset/shaggy-carrots-unite.md
Normal file
5
.changeset/shaggy-carrots-unite.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@verdaccio/logger': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
do not show deprecation warning on default logger config
|
@ -98,7 +98,7 @@ export type LoggerConfigItem = {
|
|||||||
|
|
||||||
export type LoggerConfig = LoggerConfigItem[];
|
export type LoggerConfig = LoggerConfigItem[];
|
||||||
|
|
||||||
export function setup(options: LoggerConfig | LoggerConfigItem = [DEFAULT_LOGGER_CONF]) {
|
export function setup(options: LoggerConfig | LoggerConfigItem = DEFAULT_LOGGER_CONF) {
|
||||||
debug('setup logger');
|
debug('setup logger');
|
||||||
const isLegacyConf = Array.isArray(options);
|
const isLegacyConf = Array.isArray(options);
|
||||||
if (isLegacyConf) {
|
if (isLegacyConf) {
|
||||||
|
@ -13,4 +13,29 @@ describe('logger', () => {
|
|||||||
// FIXME: check expect
|
// FIXME: check expect
|
||||||
// expect(spyOn).toHaveBeenCalledTimes(2);
|
// expect(spyOn).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('throw deprecation warning if multiple loggers configured', () => {
|
||||||
|
const spy = jest.spyOn(process, 'emitWarning');
|
||||||
|
setup([
|
||||||
|
{
|
||||||
|
level: 'info',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
level: 'http',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
expect(spy).toHaveBeenCalledWith(
|
||||||
|
'deprecate: multiple logger configuration is deprecated, please check the migration guide.'
|
||||||
|
);
|
||||||
|
spy.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('regression: do not throw deprecation warning if no logger config is provided', () => {
|
||||||
|
const spy = jest.spyOn(process, 'emitWarning');
|
||||||
|
setup();
|
||||||
|
expect(spy).not.toHaveBeenCalledWith(
|
||||||
|
'deprecate: multiple logger configuration is deprecated, please check the migration guide.'
|
||||||
|
);
|
||||||
|
spy.mockRestore();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user