Setup karma unit tests with pouchdb
This is a common error: PhantomJS has not implemented Function.prototype.bind (here's the bug), so you need the es5-shim.
Or you can get by by just shimming Function.prototype.bind instead of including the whole es5-shim library. Here's an example (taken from here):
(function () { 'use strict'; // minimal polyfill for phantomjs; in the future, we should do ES5_SHIM=true like pouchdb 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; }; }})();
The issue is fixed in PhantomJS 2+. So an update of the Phantom node modules should do it.
Tested with the following versions of test-related modules in package.json
"karma": "0.13.21","karma-jasmine": "0.3.7","karma-phantomjs-launcher": "1.0.0","phantomjs-prebuilt": "2.1.3",