Search code examples
javascriptangularjslambdajasminephantomjs

Phantom js doesn't support Arrow function ( => )


I am working on unit testing of Angular app using Jasmine. Everything was working fine on the Chrome until i started using PhantomJs for the headless browser testing or test output on the console.

After 2 days, I found that PhantomJs doesn't support lambda expression. There isn't any problem with the unit tests but it was with lambda expression and PhantomJs.

I am using -

  1. AngularJs - 1.6.6

  2. Jasmine - 2.9.1

  3. PhantomJs - 2.1.1

Can anyone help me with this?

Thank you in advance.


Solution

  • PhantomJs doesn't support arrow functions yet. In fact, it supports very little of ES2015. See this comment from pixiuPL (the maintainer) from this issue in their repo:

    Introducing ECMA will require nearly-complete rewrite and - keeping in m8ind I seem to be the only active dev of PJS now - will need to wait till other - more urgent - issues are solved.

    In the meantime, if you feel skilled enough - feel free to start working on it, but on the separate branch.