title: Karma tests does not seem to load my Angularjs controller
body: <p>I run my angular tests with karma, my application is running fine in browser, but tests fails and I am suspecting wrong settings.</p>
  
  <p>Here are the controllers and tests :</p>
  
  <pre><code>// app/scripts/controllers/main.js
  
  'use strict';
  
  angular.module('GloubiBoulgaClientApp')
    .controller('MainCtrl', function ($scope) {
  
    }); 
  </code></pre>
  
  <p>Here is the test file :</p>
  
  <pre><code>'use strict';
  
  describe('Controller: MainCtrl', function () {
  
    // load the controller's module
    beforeEach(module('GloubiBoulgaClientApp'));
  
    var MainCtrl,
      scope;  
  
    // Initialize the controller and a mock scope
    beforeEach(inject(function ($controller, $rootScope) {
      scope = $rootScope.$new();
      MainCtrl = $controller('MainCtrl', {
        $scope: scope
      });
    }));  
  
    it('should attach a list of awesomeThings to the scope', function () {
      expect(true).toBe(true);
    });
  });
  </code></pre>
  
  <p>The karma conf</p>
  
  <pre><code>module.exports = function(config) {
    config.set({
      // base path, that will be used to resolve files and exclude
      basePath: '', 
  
      // testing framework to use (jasmine/mocha/qunit/...)
      frameworks: ['jasmine'],
  
      // list of files / patterns to load in the browser
      files: [
        'app/bower_components/angular/angular.js',
        'app/bower_components/angular-mocks/angular-mocks.js',
        'app/bower_components/angular-resource/angular-resource.js',
        'app/bower_components/angular-cookies/angular-cookies.js',
        'app/bower_components/angular-sanitize/angular-sanitize.js',
        'app/scripts/*.js',
        'app/scripts/**/*.js',
        'test/mock/**/*.js',
        'test/spec/**/*.js'
      ],  
  
      // list of files / patterns to exclude
      exclude: [], 
  
      // web server port
      port: 8080,
  
      // level of logging
      // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
      logLevel: config.LOG_INFO,
      // enable / disable watching file and executing tests whenever any file changes
      autoWatch: true,
  
  
      // Start these browsers, currently available:
      // - Chrome
      // - ChromeCanary
      // - Firefox
      // - Opera
      // - Safari (only Mac)
      // - PhantomJS
      // - IE (only Windows)
      browsers: ['PhantomJS'],
  
  
      // Continuous Integration mode
      // if true, it capture browsers, run tests and exit
      singleRun: false
    });
  };
  </code></pre>
  
  <p>The error ouput</p>
  
  <pre><code> PhantomJS 1.9.2 (Linux) Controller: MainCtrl should attach a list of awesomeThings to the scope FAILED
           Error: [ng:areq] Argument 'MainCtrl' is not a function, got undefined
           http://errors.angularjs.org/1.2.8-build.2094+sha.b6c42d5/ng/areq?p0=MainCtrl&amp;p1=not%20a%20function%2C%20got% 2
   0undefined
               at assertArg (--obfuscated-path--GloubiBoulga/GloubiBoulgaClient/app/bower_components/angular/angula
   r.js:1362)
               at assertArgFn (--obfuscated-path--GloubiBoulga/GloubiBoulgaClient/app/bower_components/angular/angu
   lar.js:1373)
               at --obfuscated-path--GloubiBoulga/GloubiBoulgaClient/app/bower_components/angular/angular.js:6763
               at --obfuscated-path--GloubiBoulga/GloubiBoulgaClient/test/spec/controllers/main.js:15
               at invoke (--obfuscated-path--GloubiBoulga/GloubiBoulgaClient/app/bower_components/angular/angular.j
   s:3704)
               at workFn (--obfuscated-path--GloubiBoulga/GloubiBoulgaClient/app/bower_components/angular-mocks/angular -mocks.js:2120)
  </code></pre>
  
  <p>I am wondering why this happen, I tried to find some documentation about the karma initialization with angularjs. But the most documentation I found is only dummy tutorial that are repeating the same pattern ( like the dummy todo list, but with phones ... )</p>
  
  <p>It seem that $controllerProvide.register fails to resolve my controllers name.
  But Directives tests are working correctly ...</p>
  
  <p>Thanks for your attention.</p>
  
  <p>Edit Notes : I replaced the controller PersonCtrl by MainCtrl in this thread because It was confusing people about where to look. Now MainCtrl is the simpliest failing example I found.</p>
  
  <p><strong>This issue is only affecting my controllers, ( all of them ), but tests for Services and  Directives are working as expected</strong></p>