AngularJS Jasmine Test Fails: no se pudo crear una instancia del módulo
Mi aplicación angular funcionó muy bien y también mis pruebas, usando karma y jazmín, hasta que agregué una dependencia enui.bootstrap
. Ahora la aplicación todavía funciona como se esperaba, pero no puedo ejecutar mis pruebas. Esto es lo que tengo:
app.js - dependencia añadida enui.bootstrap
angular.module('myApp', ['ngResource', 'ngRoute', 'ui.bootstrap']).config(function(...) {...});
service.js
angular.module('myApp').service('myService', function () {})
controller.js
angular.module('myApp').controller('MyController', function ($scope, $http, myService) {})
tests / main.js
describe('Controller: MyController', function () {
var MyController, scope;
// load the controller's module
beforeEach(function(){
module('myApp');
inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
MyController = $controller('MyController', {
$scope:scope
});
});
});
it('should do something', function () {
expect(scope.myOptions.length).toBe(5);
});
});
Y mi prueba, que ejecuto usando gruñido y krama, falla debido a:
Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module ui.bootstrap due to:
Error: [$injector:nomod] Module 'ui.bootstrap' is not available! You either misspelled the module name or forgot
¿Qué me he perdido? La aplicación se ejecuta sin problemas, solo falla la prueba.