"Can't find variable: Intl" when running Karma unit test with Jasmine
We are writing a unit test using Jasmine for a javascript web application. In the source code, we used an "Intl" object as follows:
service.getTimezone = function() {
return Intl.DateTimeFormat().resolvedOptions().timeZone;
}
The test passed if we use Chrome as the Karma test browser. But when we use PhantomJS, the Karma test failed with the error message: "Can't find variable: Intl in ...".
It looks like PhantomJS doesn't support Intl. Can I get a workaround?
I am having the same issue as well, is there any update by the phantom js team?
@ronakvpanchal Please use karma-intl-shim to fix this issue. Please follow as stated in this StackOvervflow link https://stackoverflow.com/questions/38811094/how-can-i-test-the-rendering-of-an-element-using-the-date-pipe-in-angular-2
Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!