title: Require / Angular / Karma / ui-router - Error: Could not resolve 'landing' from state ''
body: <p>I've seen this symptom posted for other issues, and the closest that I have come to my issue is this Ionic issue: </p>
  
  <p><a href="https://stackoverflow.com/questions/28265230/could-not-resolve-from-state">Could not resolve &#39;...&#39; from state &#39;&#39;</a></p>
  
  <p><strong>PhantomJS 1.9.8 (Mac OS X 0.0.0) Controller: ContainerCtrl test FAILED
      Error: Could not resolve 'landing' from state ''</strong></p>
  
  <p>I am new to Karma testing for Angular, and having a hard time debugging a scope issue.</p>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>.config(function($stateProvider, $urlRouterProvider) {
    // For any unmatched url, redirect to landing
    $urlRouterProvider.otherwise("/");
  
    // Now set up the states
    $stateProvider
      .state('guide', {
        url: "/guide",
        templateUrl: "views/guide.html",
        controller: 'SurveyController as main'
      })
      .state('stop', {
        url: "/stop",
        templateUrl: "views/stop.html",
        controller: 'StopCtrl as stop'
      })
      .state('landing', {
        url: "/",
        templateUrl: "views/landing.html",
        controller: 'AboutCtrl as about'
      });
  });
  </code></pre>
  
  <p><strong>containerSpec.js</strong></p>
  
  <pre><code>define(['angular', 'angular-mocks', 'app'], function(angular, mocks, app) {
  'use strict';
  
   describe('Controller: ContainerCtrl', function () {
  
    var ContainerCtrl, $state;
  
    beforeEach(angular.mock.module('app.controllers.ContainerCtrl', 'ui.router'));
  
  
      beforeEach(angular.mock.inject(function($rootScope, $controller, _$state_) {
       //create an empty scope
       ContainerCtrl = $rootScope.$new();
       $state = _$state_;
       //declare the controller and inject our empty scope
       $controller('ContainerCtrl', { $scope : ContainerCtrl });
  
      }));
  
    });
  });
  </code></pre>
  
  <p><strong>container.js</strong></p>
  
  <pre><code>define([
      'angular',
      'services/dataservice'], function (
          angular,
          dataService // jshint ignore:line
          ) {
  'use strict';
  
  angular.module('oslerApp.controllers.ContainerCtrl', [])
      .controller('ContainerCtrl', [
              '$scope',
              '$rootScope',
              '$state',
                  function(
                      $scope,
                      $rootScope,
                      $state) {
  
              $state.go('landing');
  
      }]);
  </code></pre>
  
  <p>});</p>
  
  <p>UPDATE:
  Changing to logLevel: config.LOG_DEBUG, I see that the load order of the Spec file is in advance of the app.js, and ui.router file. </p>
  
  <pre><code>INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket B-PFcQHXMLMqx8cOoznu with id 19321969
  DEBUG [launcher]: PhantomJS (id 19321969) captured in 4.068 secs
  DEBUG [web-server]: serving: /deploy/node_modules/karma/static/context.html
  DEBUG [web-server]: serving (cached): /deploy/node_modules/requirejs/require.js
  DEBUG [web-server]: serving (cached): /deploy/node_modules/karma-requirejs/lib/adapter.js
  DEBUG [web-server]: serving (cached): /deploy/test/test-main.js
  DEBUG [web-server]: serving (cached): /deploy/bower_components/jquery/dist/jquery.js
  DEBUG [web-server]: serving (cached): /deploy/node_modules/karma-jasmine/lib/jasmine.js
  DEBUG [web-server]: serving (cached): /deploy/node_modules/karma-jasmine/lib/boot.js
  DEBUG [web-server]: serving (cached): /deploy/node_modules/karma-jasmine/lib/adapter.js
  DEBUG [web-server]: serving (cached): /deploy/bower_components/angular/angular.js
  DEBUG [web-server]: serving (cached): /deploy/test/spec/controllers/containerSpec.js
  DEBUG [web-server]: serving (cached): /deploy/test/spec/services/dataserviceSpec.js
  DEBUG [web-server]: serving (cached): /deploy/app/scripts/app.js
  DEBUG [web-server]: serving (cached): /deploy/bower_components/angular-ui-router/release/angular-ui-router.js
  DEBUG [web-server]: serving (cached): /deploy/app/scripts/services/dataservice.js
  DEBUG [web-server]: serving (cached): /deploy/app/scripts/controllers/container.js
  </code></pre>