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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phantomjs fix #347
Phantomjs fix #347
Conversation
I'm not sure this is the right branch, we would love to see this as 0.4.2 possibly. |
I like this! Couldn't you just do |
We also restrict the version of phantom we use to avoid problems with the latest versions. See package.js. |
I'm still confused, I reproduced this using latest release (1.9.2) from http://phantomjs.org/download.html, but in package.json at 0.4-stable I have:
Liberal as it is, I think this would allow any latest version, including even major releases, perhaps there is another file, not package.json in the root of the project? I also couldn't find package.js, but I think that's a typo. |
I'm also running 1.9.2 when I'm seeing this error |
Ah yes, that line has changed a bit since 0.4-stable. Here's the latest version specifier: https://github.com/facebook/react/blob/658f41cb30/package.json#L52 It seems likely that, while the react tests passed when 0.4-stable was tagged, with what was then the latest version of phantomjs, running @zpao do we need a branch fix? I think this PR should do the trick. |
@@ -25,10 +25,11 @@ var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; | |||
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; | |||
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS; | |||
|
|||
var isCustomAttributeRegexp = /^(data|aria)-[a-z_][a-z\d_.\-]*$/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, 👍
So here's the thing, we're going to keep using The fact that Phantom doesn't support this is actually pretty concerning, especially for people using it to test UIs. In fact, it looks like Phantom is roughly equivalent to an early version of Safari 5.1, based on the So the only other option really at that point for us becomes to build the @tomelm I think for your case this means, using es5-shim/sham and shipping it in your assets. Unless you don't want to support the browsers missing it. |
@zpao I wasn't concerned so much with the browsers that don't support as much as I can't seem to get any functional tests to pass that depend on React. I'll see if maybe es5-shim/sham help with that thought. |
Hey guys! I found a hack. This hack got PhantomJS to keep running despite Emphasis on "hack." This is not a real solution. This is just a hack, a workaround. Hopefully it'll be useful for some of you, or at least encourage some more meaningful conversation. :) I added this code at the top of my react.js file: if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof fNOP && oThis
? this
: oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
} Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind Again, this is not a real solution. Hopefully just something so you can get back to the work which you actually wanna be doing. :) Disclaimer from source:
Anyway, I'd love to hear what you guys have to say about it. @zpao and team, thanks so much for the work on React!! |
@dillonforrest thanks for digging into this! We have a similar If you're testing your own React components in PhantomJS, it's up to you to providing a similar polyfill. This pull request ended up getting closed because we don't want to avoid using So I think the current recommendation is to pick your own fallback implementation of |
@benjamn - 👍 @dillonforrest I'm glad you dug into it and understand the problem! My concerns above are still totally valid and have made me reconsider our usage of PhantomJS (updating Phantom would be a big task so switching to SlimerJS is looking pretty attractive). Anyway, glad you're enjoying React! |
I just read https://groups.google.com/forum/#!topic/phantomjs/EiXb4iRU7WA and apparently PhantomJS 2 is on the horizon with an updated webkit, so this might all be temporary problem. |
@zpao I personally agree with your concerns regarding PhantomJS. It also puts friendly pressure on lagging software to catch up. :) And when lagging software improves, everyone is better off. Either way, I'm looking forward to PhantomJS 2! |
+1 on Phantom supporting ECMAScript 5. Right now it's like using IE as your test automation tool. For those looking for alternatives, check out Selenium (wd for node), which uses actual browsers and also translates well to Sauce Labs CI testing, and zombie.js which is headless, so you don't get browser parity but it's very fast and supports ES5. |
Hey,
Phantomjs is failing because apparently it (v1.9.2) doesn't have Function.prototype.bind.
The issue was noticed thanks to @tomelm, who was testing with Poltergeist (RoR gem) reactjs/react-rails#10
It can be reproduced easily if you have phantomjs:
fails with:
and all subsequent errors are a result of this one.
After switching to custom binding function it appears to be working in phantomjs and poltergeist. All tests are passing. I don't think there is any reason for regression testing here.
I just noticed that same thing is happening to JSXTransformer.