mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-24 18:30:23 +00:00
fix(angular-mocks): memory leak in jasmine's DI utils
When using inject/module helper methods in tests, these methods would leave the injector laying around after the test. Since injector is the application it can grow very large.
This commit is contained in:
parent
7b739c9702
commit
24e7da4f19
1 changed files with 6 additions and 0 deletions
6
src/ngMock/angular-mocks.js
vendored
6
src/ngMock/angular-mocks.js
vendored
|
|
@ -1546,6 +1546,12 @@ window.jstestdriver && (function(window) {
|
|||
|
||||
window.jasmine && (function(window) {
|
||||
|
||||
afterEach(function() {
|
||||
var spec = getCurrentSpec();
|
||||
spec.$injector = null;
|
||||
spec.$modules = null;
|
||||
});
|
||||
|
||||
function getCurrentSpec() {
|
||||
return jasmine.getEnv().currentSpec;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue