TL;DR: npm install karma-phantomjs-launcher@latest phantomjs-prebuilt@latest
Updating an old project to Angular 1.5 all my tests broke or that’s what I thought when I got the Error: [$injector:modulerr] Failed to instantiate module ng due to: TypeError: ‘undefined’ is not an object (evaluating ‘Function.prototype.bind.apply’).
phantomjs-prebuilt happens to be a npm wrapper to make PhantomJS available to Node.js developers and until last month it was published as phantomjs, which caused confusion.
So removing our old dependency on
phantomjs and installing the latest versions of launcher and wrapper we are good to go.
$ npm uninstall --save-dev phantomjs $ npm install --save-dev karma-phantomjs-launcher@latest phantomjs-prebuilt@latest
Due to this, last Thursday I woke up wondering if people uses PhantomJS when unit testing AngularJS applications, because I’ve been using it as default ever since the beginning but with no particular reason other than the speed.