lathonez/clicker

Phantom browser: Can't find variable: Map

ws-hofshteyn opened this issue · 1 comments

Hey! I needed to launch test in docker container and I needed to set up PhantomJS instead Chrome.

I set up karma-phantomjs-launcher, include it in karma.conf.js into the plugin list array, point browser [PhantomJS] as well. And I had an error that looked like this (all tests worked with Chrome well):

PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR ReferenceError: Can't find variable: Map at webpack:///~/@angular/core/@angular/core.es5.js:1502:0 <- src/test.ts:1781

So after research I found that I need to implement parts of es-6 to the test.ts file before import zone.js.

import 'core-js/es6'; import 'core-js/es7/reflect';

And my tests works perfect!

Thanks a lot for the info. I don't use Phantom any more, even in docker or CI, too many issues like this!

However I know some people are forced to use it - so this is definitely useful for them.

This would probably useful as a PR or an issue against ng-cli, as I imagine it is a problem there if we are finding it here.

Thanks,

Stephen