I always give up on testing because I find it is more work than actually writing code that works well, but I'm working on a project I hope to open-source, so am committed to writing tests this time.
I have this angular app, and when I define it I include the dependencies
var app = angular.module('app', [ 'ngResource', 'ngSanitize', 'ngRoute', 'ui.ace' ]);
When I try to test a controller, I start with
beforeEach(angular.mock.module('app')); beforeEach(angular.mock.inject(function($rootScope,$controller){ scope = $rootScope.$new(); $controller('FileSystemCtrl',{$scope:scope}); }) );
When I run jasmine, I get
Failed to instantiate module app due to: Failed to instantiate module ui.ace due to: Module 'ui.ace' is not available!
I don't want to have to list all the dependencies every time I mock or instantiate 'app' in a test, as that would mean when I add a new dependency, I'd have to go back and change all the already existing test.
This seems very inefficient to me. Can somebody explain why I'm getting this error, and how to get around it?