title: Scope variables undefined when testing controller with Karma and Jasmine with ng-scenario as framework
body: <p>I've just started to discover angular unit testing mysteries using <code>Karma</code> &amp; <code>Jasmine</code> and I have some problems with <code>controllers</code> tests. I've wrote tests to see if variables are defined: <code>expect(scope.someVariable).toBeDefined()</code>. Everything worked as expected ( every test was successfully ) untill I've added <code>ng-scenario</code> in <code>karma.conf.js</code> file.</p>
  <p>I'm using <code>node</code> to run tests.</p>
  <p><strong>Problem:</strong> After adding <code>ng-scenario</code> in karma configuration file as framework all tests for checking if scope variables are defined are failing. Before adding <code>ng-scenario</code> all tests were successfully. <em><strong>Do you have any ideea why is this happening ?</strong></em></p>
  <p><strong>Karma Conf file:</strong></p>
  <blockquote>
  <pre><code>module.exports = function(config) {
  config.set({
  basePath: '',
  frameworks: ['ng-scenario','jasmine'],
  files: [    'app/plugins/jquery/jquery.js',
    'app/plugins/angular/angular.js',     'app/plugins/angular-scenario/angular-scenario.js',
    'app/plugins/angular-mocks/angular-mocks.js',
    'app/plugins/angular-resource/angular-resource.js',
    'app/plugins/angular-cookies/angular-cookies.js',
    'app/plugins/angular-sanitize/angular-sanitize.js',
    'app/plugins/angular-route/angular-route.js',     'app/plugins/angular-utf8-base64/angular-utf8-base64.js',
    'app/scripts/*.js',
    'app/scripts/**/*.js',
    'test/**/*.js',
  
      'app/views/templates/*.html'
  ],
  
  preprocessors : { 'app/views/templates/*.html': 'html2js'     },
  exclude: ['app/plugins/angular-scenario/angular-scenario.js'],
  port: 8080,
  logLevel: config.LOG_INFO,
  autoWatch: false,
  browsers: ['Chrome'],
  singleRun: false   }); };
  </code></pre>
  </blockquote>
  <p><strong>Controller test:</strong></p>
  <blockquote>
  <pre><code>'use strict'
  
  describe('Controller: MainCtrl', function () {
  
   
    beforeEach(module('qunizGameApp'));
    
    var MainCtrl,scope, configService,feedbackService,authService,notify,resourceService;
  
  
    beforeEach(inject(function ($controller, $rootScope,_configService_,_feedbackService_, _authService_,_notify_, _resourceService_) {
  
       scope = $rootScope.$new();
       MainCtrl = $controller('MainCtrl', {
         $scope: scope,
         configService:_configService_,
         feedbackService:_feedbackService_,
         authService:_authService_,
         notify:_notify_,
         resourceService:_resourceService_
   
       });
       configService=_configService_;
         feedbackService=_feedbackService_;
         authService=_authService_;
         notify=_notify_;
         resourceService=_resourceService_;   }));
   
     it('should be defined -configService', function () {   
        expect(scope.configService).toBeDefined();  
     });   
     it('should be defined - resourceService', function () {   
        expect(scope.resourceService).toBeDefined();   
     });  
     it('should be defined - sidebarVisible', function () {   
        expect(scope.sidebarVisible).toBeDefined();   }); 
     });
  </code></pre>
  </blockquote>
  <p><strong>Proof of working test before including <code>ng-scenario</code>:</strong></p>
  <p><img src="https://i.stack.imgur.com/tC0RM.png" alt="karma is working without ng-scenario framework" /></p>
  <p><strong>Proof of failure test after including <code>ng-scenario</code>:</strong></p>
  <p><img src="https://i.stack.imgur.com/ad3js.png" alt="karma is failing with ng-scenario framework" /></p>
  <p>And a wierd thing is that if I debug the test in my <code>chrome</code> console, variables are defined:</p>
  <p><img src="https://i.stack.imgur.com/s3Run.png" alt="debugging tests" /></p>
  <p><strong>Things read on interned and tried:</strong></p>
  <p>1.I've tried to define variables on scope in <code>beforeEach</code> section as a mock data.</p>
  <p>2.I've tried to inject all other controller dependencies ( with undescored name as paramaters)</p>
  <p>You can see 1 and 2 below</p>
  <blockquote>
  <pre><code>beforeEach(inject(function ($controller, $rootScope,_configService_,_feedbackService_, _authService_,_notify_, _resourceService_) {
  
      scope = $rootScope.$new();
      scope.configService=_configService_;
      scope.authService=_authService_;
      scope.resourceService=_resourceService_;
      scope.sidebarVisible={};
      MainCtrl = $controller('MainCtrl', {
        $scope: scope,
          configService:_configService_,
          feedbackService:_feedbackService_,
          authService:_authService_,
          notify:_notify_,
          resourceService:_resourceService_
      
      });
      configService=_configService_;
      feedbackService=_feedbackService_;
      authService=_authService_;
      notify=_notify_;
      resourceService=_resourceService_;   }));
  </code></pre>
  </blockquote>
  <p>But <code>scope.configService</code>, <code>scope.resourceService</code> and <code>scope.sidebarVisible</code> are still undefined at the moment of test</p>