This is from the karma.conf.js file:
module.exports = function (config) {
config.set({
frameworks: ['mocha', 'chai'],
files: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'public/ng-app/module.js',
'public/ng-app/**/*.js',
'test/ng/**/*.spec.js'
],
...
I am trying to use the beforeEach function with inject like this:
describe('my.test', function () {
beforeEach(module('app'));
var MyService;
beforeEach(inject(function (_MyService_) {
MyService = _MyService_;
}));
describe('#send', function () {
it('exists', function () {
expect(MyService.save).to.exist;
});
});
});
but the beforeEach(inject(function (...)...); part of the code causes this error when I try to run the tests:
PhantomJS 1.9.8 (Windows 8 0.0.0) my.test "before each" hook: workFn for "exists" FAILED
Error: [$injector:modulerr] Failed to instantiate module ng due to:
TypeError: 'undefined' is not an object (evaluating 'Function.prototype.bind.apply')
I can't figure out what the problem is. Does someone has any idea? Thanks.