Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: Can't find variable: Promise #12401

Closed
liliakai opened this issue Jul 25, 2014 · 45 comments
Closed

ReferenceError: Can't find variable: Promise #12401

liliakai opened this issue Jul 25, 2014 · 45 comments
Assignees

Comments

@liliakai
Copy link

@liliakai liliakai commented Jul 25, 2014

I'm using mocha-phantomjs 3.5.0 (phantomjs 1.9.7). My mocha tests pass in Chrome but phantom gives the error above.

馃懟

@JamesMGreene
Copy link
Collaborator

@JamesMGreene JamesMGreene commented Jul 25, 2014

Native Promises are an extremely recent addition (I'm not even sure if it's officially standard yet), so this is not surprising whatsoever. Are there native Promises in your code/tests, or is the error coming from mocha-phantomjs?

@liliakai
Copy link
Author

@liliakai liliakai commented Jul 25, 2014

They're in my code. Any plan to add support in the near future? Or do you know of any other headless browsers that have implemented them? I suppose I'll have to shim them into my test page otherwise.

Also, (and this is a separate issue, but) same question regarding support for Array-like objects in Function.prototype.apply.

@piuccio
Copy link

@piuccio piuccio commented Nov 18, 2014

+1 馃槃

@Gowiem
Copy link

@Gowiem Gowiem commented Dec 9, 2014

+1

2 similar comments
@gergely-ujvari
Copy link

@gergely-ujvari gergely-ujvari commented Dec 10, 2014

+1

@Aurifier
Copy link

@Aurifier Aurifier commented Dec 18, 2014

馃憤

@zzarcon
Copy link

@zzarcon zzarcon commented Jan 5, 2015

@JamesMGreene some update about this? :)

@zzarcon
Copy link

@zzarcon zzarcon commented Jan 5, 2015

I ended using a simple workaround; adding this Promise Polyfill at the beginning of the tests, hope be util for you!

@JamesMGreene
Copy link
Collaborator

@JamesMGreene JamesMGreene commented Jan 5, 2015

Although the current master isn't quite where we hoped it would be, we are planning to release it as v2.0.0 on January 23rd (?) and work out the remaining kinks from there once we can all shift focus to v2.x.

@JamesMGreene
Copy link
Collaborator

@JamesMGreene JamesMGreene commented Jan 5, 2015

That said: I have not verified that the native Promise API is implemented in master.

@vitallium
Copy link
Collaborator

@vitallium vitallium commented Jan 5, 2015

PhantomJS 2 doesn't have native Promise API.

@fredck
Copy link

@fredck fredck commented Feb 20, 2015

+1

Promise is available natively in all modern browsers except IEs (IE12 has it)... it's a must have!

@MrJH
Copy link

@MrJH MrJH commented Feb 25, 2015

+1

@masi
Copy link

@masi masi commented Mar 21, 2015

Node has Promises, ECMA6 will have them and notably SilmerJS has them already. The SlimerJS devs had the idea to make webpage.open to return a Promise which is IMHO a great improvement to the API.

@mockdeep
Copy link

@mockdeep mockdeep commented Jun 19, 2015

Just ran into this. I'll give the polyfill a try.

@masi
Copy link

@masi masi commented Jun 20, 2015

Shims (polyfills) for promises work well.

@danawoodman
Copy link

@danawoodman danawoodman commented Jul 24, 2015

Any progress on this?

@kawing-chiu
Copy link

@kawing-chiu kawing-chiu commented Jul 26, 2015

Using es6-promise polyfill works for me. But the polyfill must be put into the page's js code, not to the phantomjs script.

justin808 added a commit to shakacode/react-webpack-rails-tutorial that referenced this issue Aug 6, 2015
* For the phantomjs issue: ariya/phantomjs#12401
* Still getting a warning
  iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error:
    at :4602
justin808 added a commit to shakacode/react-webpack-rails-tutorial that referenced this issue Aug 22, 2015
* For the phantomjs issue: ariya/phantomjs#12401
* Still getting a warning
  iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error:
    at :4602
@dbaba
Copy link

@dbaba dbaba commented Sep 30, 2015

+1
es6-promise works for me as well as polyfill though (PhantomJS 2.0.0).

@hbrysiewicz
Copy link

@hbrysiewicz hbrysiewicz commented Dec 15, 2015

+1

1 similar comment
@dteleguin
Copy link

@dteleguin dteleguin commented Feb 9, 2016

+1

@floverdevel
Copy link

@floverdevel floverdevel commented Feb 10, 2016

We had the same problem and choose to inject Babel into our test suite for now.
Our unit tests runs on node.js with jasmine and are therefor ok with Promise.
But our cucumber tests runs into phantom.js and we injected Babel libray to polyfill Promise.

https://babeljs.io/ works great, but maybe to have 芦native support禄 of ES6 feature would be even better :)

@jimmywarting
Copy link

@jimmywarting jimmywarting commented Feb 10, 2016

@floverdevel That is what i have been doing. Would agree that it would be cool to have native support. but there is things that not even a precompiler can solve... like if the website i'm navigate to uses arrow function, generators and what not.
That is why i'm considering switching to SlimerJS to use an up to date Gecko browser. Seems to me that phantomjs is falling behind on the webkits release cycle's 馃憥

Would love phantomjs if it used Blinks engine and had auto update as well. Having to wait for a third party to update their product and update their dependency is urck.
It's like this with samsung phones. Just buy Google's Nexa phone and you know you will be the first to receive an update. Don't have to wait for samsung to wait for next android version so they can update the consumer's phone 3-8 month later or even at all. Instead they just stop maintaining it and announce a new phone called Samsung Galaxy s203 special gold edition v2.0

@floverdevel
Copy link

@floverdevel floverdevel commented Feb 10, 2016

@jimmywarting i love the comparison with Samsung and the Android update :P

@sickDevelopers
Copy link

@sickDevelopers sickDevelopers commented Feb 12, 2016

+1

1 similar comment
@msn0
Copy link

@msn0 msn0 commented Feb 27, 2016

+1

@inaccessible
Copy link

@inaccessible inaccessible commented Mar 23, 2016

+1

4 similar comments
@AChris07
Copy link

@AChris07 AChris07 commented Mar 31, 2016

+1

@sygn
Copy link

@sygn sygn commented Apr 1, 2016

+1

@msn0
Copy link

@msn0 msn0 commented Apr 1, 2016

+1

@Radiergummi
Copy link

@Radiergummi Radiergummi commented Apr 5, 2016

+1

@jimmywarting
Copy link

@jimmywarting jimmywarting commented Apr 5, 2016

Can you stop writing +1 so we don't get useless notifications all the time
Github have introduced reactions. use that instead.

screen shot 2016-04-05 at 15 59 06

@vitallium vitallium added the Webkit label Apr 11, 2016
@vitallium vitallium added this to the FutureRelease milestone Apr 11, 2016
@vitallium vitallium self-assigned this Apr 11, 2016
@nmors
Copy link

@nmors nmors commented Apr 13, 2016

Running into this issue also. including https://raw.githubusercontent.com/stefanpenner/es6-promise/master/dist/es6-promise.min.js does the job. Would be great to support es6 in pjs though..

@SourceCode
Copy link

@SourceCode SourceCode commented Apr 22, 2016

I have an open issue on StackOverflow regarding promise support in PhantomJS and CasperJS. We ended up moving to SlimerJS until the support for native promises is added to PhantomJS. The issue is here: http://stackoverflow.com/questions/36603470/casperjs-phantomjs-es6-promise-polyfill for others facing this same issue. No resolution has been posted on how to handle this in the client and I was unable to inject anything into phantom that would handle the support for whatever reason. If someone has a resolution it would be greatly appreciated otherwise I look forward to the native promise support in Phantom when it becomes available. Thank you for the hard work!

@filipalacerda
Copy link

@filipalacerda filipalacerda commented Jun 17, 2016

Either es6-promise and promise-polyfill do the trick!
Thank you @dbaba, @zzarcon and @kawing-chiu for the suggestions!

Just need to include one of them in karma.conf.js in files option

es6-promise:
files: ['./node_modules/es6-promise/dist/es6-promise.js']

promise-polyfill:
files: ['./node_modules/promise-polyfill/promise.js']

@ariya
Copy link
Owner

@ariya ariya commented Aug 25, 2016

Please track ES6 support in #14506. Thank you!

@ariya ariya closed this Aug 25, 2016
@baipgydx729
Copy link

@baipgydx729 baipgydx729 commented Sep 7, 2016

+1

@NeilJ247
Copy link

@NeilJ247 NeilJ247 commented Jan 3, 2017

@dbaba how did you go about adding the Promise polyfill? Are you adding it to original source webpage or injecting it somehow using PhantomJS?

Thanks in advance.

@Zoheb-hassan
Copy link

@Zoheb-hassan Zoheb-hassan commented Jul 20, 2017

There's a phantomjs polyfill that can downloaded via the npm manager, https://www.npmjs.com/package/phantomjs-polyfill this helps resolve the promise error you will encounter

@Somebi
Copy link

@Somebi Somebi commented Sep 24, 2017

+1 :D Get ES6 support faster ffs.

@annelledj
Copy link

@annelledj annelledj commented Nov 6, 2017

The following in karma.conf.js did not work for me, @filipalacerda
files: ['./node_modules/es6-promise/dist/es6-promise.js']

I had to change it to this to get it to work :)
files: ['./node_modules/es6-promise/dist/es6-promise.auto.js']

rosesini added a commit to rosesini/react-ruby that referenced this issue Nov 14, 2017
* For the phantomjs issue: ariya/phantomjs#12401
* Still getting a warning
  iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error:
    at :4602
chipbell4 added a commit to pbs/Canvas-Drawing-Tool that referenced this issue Nov 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can鈥檛 perform that action at this time.