Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

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

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

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

rweng opened this issue Nov 22, 2013 · 4 comments

Comments

@rweng
Copy link

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

Closing out as it's a phantom issue

@wethinkagile
Copy link

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

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants