diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js index 9d010b4ab9c6..dcefe12008ca 100644 --- a/src/ngMock/angular-mocks.js +++ b/src/ngMock/angular-mocks.js @@ -2131,7 +2131,7 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { if (window.jasmine || window.mocha) { var currentSpec = null, - annotatedFunctions, + annotatedFunctions = [], isSpecRunning = function() { return !!currentSpec; }; diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js index 78cb1e268736..104ece1c0aa5 100644 --- a/test/ngMock/angular-mocksSpec.js +++ b/test/ngMock/angular-mocksSpec.js @@ -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) {}]); +});