diff --git a/src/runtime/stores/formatters.ts b/src/runtime/stores/formatters.ts index 328d3c3..8edb957 100644 --- a/src/runtime/stores/formatters.ts +++ b/src/runtime/stores/formatters.ts @@ -56,7 +56,7 @@ const formatMessage: MessageFormatter = (id, options = {}) => { message = defaultValue || id; } else if (typeof message !== 'string') { - console.error( + console.warn( `[svelte-i18n] Message with id "${id}" must be of type "string", found: "${typeof message}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`, ); diff --git a/test/runtime/stores/formatters.test.ts b/test/runtime/stores/formatters.test.ts index 3462407..1c8f36d 100644 --- a/test/runtime/stores/formatters.test.ts +++ b/test/runtime/stores/formatters.test.ts @@ -106,16 +106,16 @@ describe('format message', () => { }); it('errors out when value found is not string', () => { - const { error } = global.console; + const { warn } = global.console; - jest.spyOn(global.console, 'error').mockImplementation(); + jest.spyOn(global.console, 'warn').mockImplementation(); expect(typeof formatMessage('form')).toBe('object'); - expect(console.error).toBeCalledWith( + expect(console.warn).toBeCalledWith( `[svelte-i18n] Message with id "form" must be of type "string", found: "object". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`, ); - global.console.error = error; + global.console.warn = warn; }); it('warn on missing messages', () => {