paulmillr / es6-shim

ECMAScript 6 compatibility shims for legacy JS engines
http://paulmillr.com
MIT License
3.11k stars 389 forks source link

Test failed under PhantomJS as of 0.21.1 #312

Closed niemyjski closed 9 years ago

niemyjski commented 9 years ago

[15:37:56][Step 3/4] Running "karma:all_tests" (karma) task [15:38:00][Step 3/4] PhantomJS 1.9.8 (Windows 8) ERROR [15:38:00][Step 3/4] TypeError: 'undefined' is not a function (evaluating 'Function.call.bind(String.prototype.indexOf)') [15:38:00][Step 3/4] at C:/TeamCity/buildAgent/work/3e6130cb0bb9bb89/src/bower_components/es6-shim/es6-shim.js:83 [15:38:00][Step 3/4] [15:38:00][Step 3/4] Finished in 0.121 secs / 0 secs

This is happening in all of the latest build except 0.21.1. Any ideas?

ljharb commented 9 years ago

Thanks for the report! Can you test whether both Function.call and Function.prototype.call exist in PhantomJS for me?

Phantom is old and weird, and iirc, doesn't even have Function#bind prior to v2.

niemyjski commented 9 years ago

I'm not 100% sure if it's in the latest as there is a ton of activity there: https://github.com/ariya/phantomjs/issues/10522 .. I think a polyfill is needed (LOL)

ljharb commented 9 years ago

:-) If Function#call is present but Function.call is not, then I'll either use the former, or fix the es6-shim to add in Function.call. Let me know :-)

niemyjski commented 9 years ago

I'd just add in Function.call :)

ljharb commented 9 years ago

Ah, I see the problem.

The es6-shim requires the es5-shim, especially when not in a true ES5 environment like PhantomJS. Simply require that first, and the es6-shim should work for you.

niemyjski commented 9 years ago

I'm targeting es5/es6 but only target evergreen browsers. I only needed es6 for startsWith... I'll see if I can bring it in only for the test runner because I'd hate to have to min that too..

domenic commented 9 years ago

only target evergreen browsers.

... PhantomJS ...

O_____O

ljharb commented 9 years ago

Every single version of every single JS engine/browser in existence has both nonzero ES5 and ES6 failures - there doesn't exist an engine that doesn't need both the es5-shim and es6-shim, no matter how evergreen you think you're targeting.

niemyjski commented 9 years ago

@domenic LOL. Yeah.. I thought they were updating it and I wanted something that worked on our CI / cross plat..

Yeah, I'll bring both of them in..