Struggling to get unit testing set up in Jasmine/Karma. I have a controller with a service dependency, and that service has another service dependency. I am not organizing my modules by type (Directives, Services, etc), but rather by feature (layout, summaryView, etc).

Here's the architecture:

angular.module('myApp', ['ngResource', 'myApp.base', 'myApp.layout','myApp.common']);
angular.module('myApp.base', ['myApp.common']);
angular.module('myApp.common',[]);
angular.module('myApp.layout',['myApp.common']);

Controller:

angular.module('myApp.layout')
    .controller('LayoutCtrl', ['$scope', '$rootScope', '$timeout', 'layoutService', 'urlService', 'BaseService',
        function ($scope, $rootScope, $timeout, layoutService, urlService, BaseService) {
            //controller code here
    });

Layout Service:

 angular.module('myApp.layout')
    .service('layoutService', ['$http', '$resource', '$rootScope', '$location', '$route', 'errorHandlingService', 'utilService',
        function ($http, $resource, $rootScope, $location, $route, errorHandlingService, utilService) {
            //service code here
    });

From what I understand, if I simply include beforeEach(module('myApp.layout'));, I should have access to my controllers, services, filters, and directives in my layout module.

Instead, the following code fails:

describe('Layout Controller', function() {
  var ctrl, scope, service;

  beforeEach(module('myApp'));
  beforeEach(module('myApp.layout'));
  beforeEach(inject(function($controller, $rootScope, layoutService) {

      scope = $rootScope.$new();
      service = layoutService;
      //Create the controller with the new scope
      ctrl = $controller('LayoutCtrl', {$scope: scope, layoutService: service});
      dump(scope);
    }));
    it('should exist', function() {
        expect(ctrl).toBeDefined();
    
Edit
Report