Javascript Internationalization API is not supported by PhantomJS Javascript Internationalization API is not supported by PhantomJS angularjs angularjs

Javascript Internationalization API is not supported by PhantomJS


Not sure if you're using Karma or not, but here's what I had to do to fix the same issue.

  1. npm install karma-intl-shim --save-dev

    This will also install the polyfill library Intl;

  2. Add 'intl-shim' to the frameworks collection in karma.conf.js:

    ...frameworks: ['intl-shim'],
  3. Add the locale file you wish to test with in karma.conf.js, for example 'en-US':

    ...files: [      './node_modules/Intl/locale-data/jsonp/en-US.js',...


1- Is my assumption correct that PhantomJS v1.9.2 does not support ECMAScript internationalization API? Is there anyway to confirm that?

It looks like PhantomJS is based on WebKit, so it does not support the new ECMAScript internationalization API.

Even for Chrome, the API made it into V8 only recently, it is still in beeding_edge, not in main:See http://code.google.com/p/v8/source/browse/branches/bleeding_edge/src/, the i18n files (.cc, .h, .js). This means after the split from WebKit.

Here is the current status for i18n support:http://mihai-nita.net/2013/07/28/javascript-internationalization-api/

2- How can I approach resolving this issue? I need to run my tests through maven and I will have more tests hitting my localizationService API one way or the other.

If I would be the maintainer of PhantomJS I would consider going with the Google branch of WebKit, before it they diverge too much and make it too hard to catch-up.Chrome has more of the market than Safari (not and invitation for flame wars, just a personal opinion without any weight :-)

I am not familiar with PhantomJS, and I don't know what it offers, but if you can separate the JavaScript tests to run on v8 you might try using it for testing from command line.Building beeding_edge was painless, and I did it on Win, Mac OS X, and Linux without any problems.