jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

Bind polyfill fails with React.js in PhantomJS #360

Closed geoffharcourt closed 9 years ago

geoffharcourt commented 9 years ago

I thought the support/bind-poly shim wasn't loading properly, but when I checked, it was loading but wasn't helping during testing of React.

The React team recommends this polyfill which looks similar. When I replace the Teaspoon supplied polyfill with this one, the few tests I had that fail in PhantomJS but not in the browser passed without issue.

Here's the Facebook team's recommended polyfill: https://github.com/facebook/react/blob/3dc10749080a460e48bee46d769763ec7191ac76/src/test/phantomjs-shims.js

It's not clear to me if there's a specific reason why the two implementations differ. I'm happy to do a PR if maintainers are open to this change.

mikepack commented 9 years ago

I've updated the recommended polyfill to use phantomjs-shims.js. After reviewing the differences, the code looks a bit more robust. Teaspoon won't ship with phantomjs-shims.js until a new version is cut, but you can use it now by adding it to your project manually (which it sounds like you're already doing).

geoffharcourt commented 9 years ago

Thanks for two very quick updates today! Very excited about version 1.x.

mikepack commented 9 years ago

Thanks for taking the time to review 1.x :smiley: