Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected token '>' Using Array.some() With Karma and PhantomJS

I am getting the following error:

PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR
   SyntaxError: Unexpected token '>'
   at myAngularControllerPath.js:9

Navigating to that file I find that I am using the Array.some() function like so:

return list.some(x => isListItemGood(x));

When I run Karma with Chrome specified in the karma.conf.js file I do not get this error.

According to http://kangax.github.io/compat-table/es5/ , PhantomJS support all 10 new array features of ES5 and Array.some() was introduced in ES5 according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some. I installed PhantomJS using 'npm install --save-dev karma-phantomjs-launcher' which has 2.1.7 listed as the PhantomJS version in its dependencies.

Thank you for any and all help!

like image 810
IfTrue Avatar asked Dec 15 '22 04:12

IfTrue


1 Answers

"Arrow functions" are not supported by PhantomJS 2.x

PhantomJS only supports a small subset of ES6.

like image 161
Artjom B. Avatar answered Dec 16 '22 16:12

Artjom B.