webpack-contrib / i18n-webpack-plugin

[DEPRECATED] Embed localization into your bundle
MIT License
318 stars 74 forks source link

Can't find variable: __, when run Unit Test scripts #19

Closed shuson closed 7 years ago

shuson commented 8 years ago

Hi, I applied i18n plugin of webpack to my code, which will wrap String variables as __("Hello World"), the problem occurs when run Unit Test/

It says __ cannot be found.

Any idea? To mock it or load from somewhere else

nosovsh commented 8 years ago

I have such mock in my test_helpers.js:

global.__ = str => str;
EcutDavid commented 7 years ago

@shuson as @nosovsh mentioned, we have to add the shim by ourselves if you are not using webpack and same webpack configuration 😃