title: Jasmine inject function fails when using fat arrow functions
body: <p>I'm just starting to unit test my app, and have successfully gotten one test suite to run, yeah!  I moved on to start testing a second controller, and as soon as the test runner (karma) hits an <code>inject</code> block, the test fails.  Comment it out, and the tests pass again.  Can't for the life of me figure out what might be going on.  Very basic karma config:</p>
  
  
  
  <p><a href="https://gist.github.com/ggoforth/82510af339370a4dca32ad4c0c4b0563" rel="nofollow">https://gist.github.com/ggoforth/82510af339370a4dca32ad4c0c4b0563</a></p>
  
  <p>The controller looks like:</p>
  
  <pre><code>angular.module('somemodule')
    .controller('SomeCtrl', SomeCtrl);
  
  function SomeCtrl($rootScope, Notification) {
    $rootScope.$on('someapp.apiLimitExceeded', (evt, err) =&gt; {
      Notification.error({
        message: err.data.message
      });
    });
  }
  </code></pre>
  
  <p>The first test looks like:</p>
  
  <pre><code>describe('SomeCtrl', () =&gt; {
    let $rootScope, controller, notification;
  
    beforeEach(() =&gt; {
      module('mymodule');
  
      inject(($injector) =&gt; {
        $rootScope = $injector.get('$rootScope');
        notification = $injector.get('Notification');
  
        spyOn(notification, 'error');
  
        controller = $injector.get('$controller')('SomeCtrl', {
          $rootScope: $rootScope,
          Notification: notification 
        });
      });
    });
  
    describe('Initialization', () =&gt; {
      it('Should register a $rootScope listener for mymodule.apiLimitExceeded', () =&gt; {
        const args = {data: {message: 'dis an errr'}};
        $rootScope.$emit('mymodule.apiLimitExceeded', args);
  
        expect(notification.error).toHaveBeenCalled();
        expect(notification.error).toHaveBeenCalledWith(args.data);
        expect(notification.error.calls.count()).toBe(1);
      });
    });
  });
  </code></pre>
  
  <p>This test passes, as expected.  If I literally copy and paste the contents of this file into another test file, without changing anything, the tests start failing.  Removing the second test file makes the original test start passing.  I must be missing something about how karma is running these angular tests, or some tearDown I'm not performing, but I can't see what that might be.  Any ideas?  The error I get, for reference is:</p>
  
  <pre><code>TypeError: Cannot read property '1' of null
  at Function.fb.$$annotate (/Users/greg/projects/someapp/client/build/js/deps.js:7451:410)
  at Function.angular.injector.$$annotate (/Users/greg/projects/someapp/client/node_modules/angular-mocks/angular-mocks.js:2615:36)
  at e (/Users/greg/projects/someapp/client/build/js/deps.js:7298:368)
  at Object.invoke (/Users/greg/projects/someapp/client/build/js/deps.js:7299:86)
  at Object.workFn (/Users/greg/projects/someapp/client/node_modules/angular-mocks/angular-mocks.js:2965:20)
  at window.inject.angular.mock.inject (/Users/greg/projects/someapp/client/node_modules/angular-mocks/angular-mocks.js:2934:42)
  at Object.beforeEach (/Users/greg/projects/someapp/client/test/test.again.someapp.controller.js:7:5)
  Error: Declaration Location
  at window.inject.angular.mock.inject (/Users/greg/projects/someapp/client/node_modules/angular-mocks/angular-mocks.js:2927:25)
  at Object.beforeEach (/Users/greg/projects/someapp/client/test/test.again.someapp.controller.js:7:5)
  TypeError: Cannot read property '$emit' of undefined
  at Object.it (/Users/greg/projects/someapp/client/test/test.again.someapp.controller.js:23:17)
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The issue was that I was using untranspiled ES6, which included using fat arrow functions for my inject blocks.  Apparently there is an issue with Chrome 50/51 where you MUST use a normal function.  Changing the fat arrow version to normal function fixes the issue (or transpile your test files via a babel preprocessor).</p>