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

using chai-as-promised caused error when run with grunt-mocha #95

Closed
rweng opened this Issue Nov 22, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@rweng

rweng commented Nov 22, 2013

Hi,

I just added chai-as-promised to a project of mine. The tests run fine in real browsers, but not with phantom js. I get

TypeError: 'undefined' is not a function (evaluating 'promise.then.bind(promise)')
      at file:///Users/robin/Code/project/node_modules/chai-as-promised/lib/chai-as-promised.js:25
      at doAsserterAsyncAndAddThen (file:///Users/robin/Code/project/node_modules/chai-as-promised/lib/chai-as-promised.js:310)
      at file:///Users/robin/Code/lproject/node_modules/chai-as-promised/lib/chai-as-promised.js:283
      at file:///Users/robin/Code/project/node_modules/chai/chai.js:4462

Any spontaneous ideas why that could be?

@kmiyashiro

This comment has been minimized.

Owner

kmiyashiro commented Nov 22, 2013

No idea, I'm not familiar with chai-as-promised. I'm guessing promise is undefined? But the way it gets passed the promise is probably the root of the problem. I'd have to know more about your setup to investigate further, but you can try setting log to true and doing some console.logs to see what's going on.

@rweng

This comment has been minimized.

rweng commented Nov 25, 2013

Turns out, Function.prototype.bind is undefined. See ariya/phantomjs#10522.

Adding the polyfill at the beginning of my runner.html worked for me.

@kmiyashiro

This comment has been minimized.

Owner

kmiyashiro commented Nov 25, 2013

Closing out as it's a phantom issue

@kmiyashiro kmiyashiro closed this Nov 25, 2013

@meshfields

This comment has been minimized.

meshfields commented Apr 8, 2015

You might find this interesting, it provides the polyfill: https://github.com/princed/karma-chai-plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment