Skip to content

Commit 24e7da4

Browse files
mheveryIgorMinar
authored andcommitted
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.
1 parent 7b739c9 commit 24e7da4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ngMock/angular-mocks.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,12 @@ window.jstestdriver && (function(window) {
15461546

15471547
window.jasmine && (function(window) {
15481548

1549+
afterEach(function() {
1550+
var spec = getCurrentSpec();
1551+
spec.$injector = null;
1552+
spec.$modules = null;
1553+
});
1554+
15491555
function getCurrentSpec() {
15501556
return jasmine.getEnv().currentSpec;
15511557
}

0 commit comments

Comments
 (0)