AngularJS Jasmine Test Fails: Failed to instantiate module AngularJS Jasmine Test Fails: Failed to instantiate module angularjs angularjs

AngularJS Jasmine Test Fails: Failed to instantiate module


In karma.conf.js there is a list of files that karma loads before test execution:

// list of files / patterns to load in the browserfiles: [  'bower_components/angular/angular.js',  'bower_components/angular-mocks/angular-mocks.js',  ...]

Add bootstrap-ui.js there.


Inject your dependencies

beforeEach(function(){   angular.module('ui.bootstrap',[]);});


I had the same problem. Just solved it. Somehow putting the module(myApp); function call inside a the function you provide to beforeEach() doesn't work just try this:

Extract the module call into its own beforeEach():

beforeEach(module('myApp'));

And use another beforeEach() for the function you use.