we are currently working on an angularjs project with round about 2500 Jasmine test cases. We are using chrome as browser and the karma-ng-html2js-preprocessor to preprocess our templates.
We are now facing the problem that our tests consuming a huge amount of memory and our karma server disconnects, because latter tests are taking way too long. Approximately 2000 tests are executed in 3 mins, but the last 500 are taking up to 10 mins. We tried several solutions we found online to get rid of this problem, but nothing is working. We tried the following solutions:
- use this-operator: https://gist.github.com/traviskaufman/11131303
- declare variables in afterEach: https://blog.thecodecampus.de/avoid-memory-leaks-angularjs-unit-tests/
We analysed the memory usage with the chrome memory snapshot tool. The first snapshot was taken after 300 Tests and the second after 600 Tests.
Can anybody help with this problem? We are unfortunately not allowed to show some code. But our tests not differ from angular jasmine examples you can find on the web.

