fix(ngMock): handle cases where injector is created before tests
This caused an exception for people who created an injector before the tests actually began to run. Since the array was initialized only in beforeEach, anyone accessing it before that would throw. This is solved easily but initializing the array immediately. Closes #10967
This commit is contained in:
Vendored
+1
-1
@@ -2131,7 +2131,7 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
|
||||
if (window.jasmine || window.mocha) {
|
||||
|
||||
var currentSpec = null,
|
||||
annotatedFunctions,
|
||||
annotatedFunctions = [],
|
||||
isSpecRunning = function() {
|
||||
return !!currentSpec;
|
||||
};
|
||||
|
||||
Vendored
+7
@@ -1813,3 +1813,10 @@ describe('ngMockE2E', function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('make sure that we can create an injector outside of tests', function() {
|
||||
//since some libraries create custom injectors outside of tests,
|
||||
//we want to make sure that this is not breaking the internals of
|
||||
//how we manage annotated function cleanup during tests. See #10967
|
||||
angular.injector([function($injector) {}]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user