so I start to use karma/mocha lib to test webpack/angular app
and when I write
before(angular.mock.module('app'));
it throw error
FAILED timer factory "before all" hook: workFn
debug.html:38 TypeError: Cannot read property '$injector' of null
at Context.workFn (base/node_modules/angular-mocks/angular-mocks.js:2653:22)
and when using beforeEach(angular.mock.module('app'));
it work fine.
why??
I think I should init the module one not every test
the code:
describe('timer factory', function () {
beforeEach(angular.mock.module('app'));
it('should exist',inject(function (Timer) {
timer = new Timer();
should.exist(timer);
}));
});