I had a similar problem when angular injections in global beforeEach stopped working and all tests failed after 20 prefix maximumSpecCallbackDepth.
During my research, I found that angular-mock does not work very well with setTimeout made in jasmine when this limit is reached.
The following code, cited as an example everywhere, will create a new injector in each test case:
var yourService; beforeEach(module('app')); beforeEach(inject(function(_yourService_) { yourService = _yourService_; }));
Instead, you can do the following, which will use a single injector and register your modules only once.
var yourService; module.sharedInjector(); beforeAll(module('app')); beforeEach(inject(function(_yourService_) { yourService = _yourService_; }));
I hope this would help others, since it took me almost a week to find out that this was the main cause of the problem, and not Jasmine herself, as some people think about github.
source share