"Can't find variable: Intl" when running Karma unit test with Jasmine #14729

Open
rzhao-work opened this Issue Jan 2, 2017 · 0 comments

Projects

None yet

1 participant

@rzhao-work

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?

@rzhao-work rzhao-work changed the title from "Can't find variable: Intl" when running Karma test with Jasmine to "Can't find variable: Intl" when running Karma unit test with Jasmine Jan 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment