Silence noisy react-intl warning in tests
This commit is contained in:
parent
3fa6185d39
commit
827dc66220
1 changed files with 18 additions and 0 deletions
|
@ -8,6 +8,9 @@ import type { LocaleMessageType, LocaleMessagesType } from '../types/I18N';
|
||||||
import type { LocalizerType } from '../types/Util';
|
import type { LocalizerType } from '../types/Util';
|
||||||
import { strictAssert } from './assert';
|
import { strictAssert } from './assert';
|
||||||
import { Emojify } from '../components/conversation/Emojify';
|
import { Emojify } from '../components/conversation/Emojify';
|
||||||
|
import * as log from '../logging/log';
|
||||||
|
import * as Errors from '../types/errors';
|
||||||
|
import { Environment, getEnvironment } from '../environment';
|
||||||
|
|
||||||
export function isLocaleMessageType(
|
export function isLocaleMessageType(
|
||||||
value: unknown
|
value: unknown
|
||||||
|
@ -52,6 +55,21 @@ export function createCachedIntl(
|
||||||
defaultRichTextElements: {
|
defaultRichTextElements: {
|
||||||
emojify: renderEmojify,
|
emojify: renderEmojify,
|
||||||
},
|
},
|
||||||
|
onError(error) {
|
||||||
|
log.error('intl.onError', Errors.toLogFormat(error));
|
||||||
|
},
|
||||||
|
onWarn(warning) {
|
||||||
|
if (
|
||||||
|
getEnvironment() === Environment.Test &&
|
||||||
|
warning.includes(
|
||||||
|
// This warning is very noisy during tests
|
||||||
|
'"defaultRichTextElements" was specified but "message" was not pre-compiled.'
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.warn('intl.onWarn', warning);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
intlCache
|
intlCache
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue