A Karma shim for the
Intl
for internationalization
npm install intl-shim --save-dev
In your karma.conf.js
file, add intl-shim
to the frameworks
in your config.set
:
config.set({
frameworks: ["intl-shim"],
You may need to also require it in your plugins
array:
plugins: [
require("intl-shim")
]
Now when running karma
, you should not get an error that Intl
cannot be found.
This shim simply attaches the Intl
library to the window so it's available for testing.
If you have issues, it's most likely an issue with anyearnshaw/Intl.js
, issues for the Intl project can be reported here.
Please create a new issue if you find that you have an issue unrelated to Intl
under intl-shim.
Please submit a PR if you have made a modification. PRs will be reviewed within a 72 hour week day period of the initial PR.
This project is built with webpack because the shim.js
is injected into the browser, which we all know doesn't have a "require" and this is an easy way to do that.