diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js index 4599578f1283..c9a59e84e862 100644 --- a/src/ngMock/angular-mocks.js +++ b/src/ngMock/angular-mocks.js @@ -3000,6 +3000,9 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) { }; module.$$cleanup = function() { + if (!currentSpec) { + return; + } var injector = currentSpec.$injector; annotatedFunctions.forEach(function(fn) {