- install
yarn add intl --dev
- setup
// config/jest/setupTests.js
import '@testing-library/react/cleanup-after-each';
import IntlPolyfill from 'intl';
const setupTest = () => {
// https://formatjs.io/guides/runtime-environments/#server
if (global.Intl) {
Intl.NumberFormat = IntlPolyfill.NumberFormat;
Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
} else {
global.Intl = IntlPolyfill;
}
};
setupTest();