Memory leak when running tests
See original GitHub issueSomewhere within the jest preset angular setup it causes memory leaks on every test.
REPL: https://github.com/chris5287/repl-jest-preset-angular-leak
When removing import "jest-preset-angular";
from setupJest.ts
, no memory leaks are detected.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Your Jest Tests are Leaking Memory
Why does Jest leak memory? ... Jest resets the require cache between each test run. This is really nice because it gives test...
Read more >Finding the cause of a memory leak in Jest tests
Memory leaks can be nasty and pretty hard to find. We found that the hard way. We should always make sure to clean...
Read more >Memory Leak Testing in Continuous Integration Systems
Memory testing involves validating a C or C++ application's use of memory and looking for memory leaks or illegal management of memory, such...
Read more >Memory Leak when running multiple test. Especially ... - GitHub
I'm seeing a memory leak while trying to run a basic autogenerated ( with "ng g c my-test" and "ng g c "my-test-2")...
Read more >My Jests tests are leaking memory, how can I fix this?
First of all, make sure that you have leaky tests by running jest with the option: jest --logHeapUsage. Run your tests and check...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We were experimenting same memory leak problems during testing in our codebase (with 1K tests more or less). As @me-12 has mentioned, the problems seems to be related with
zone.js
.I have been checking this PR https://github.com/angular/zone.js/pull/1106 that seems to fix the problem. It is merged in
zone.js
but the current deployed version of the library (0.8.26) still does not include these PR so we are waiting for the official release of a newzone.js
version.Meanwhile, we are using an updated repo (thank you @JiaLiPassion) in our
package.json
:It is not the perfect solution but temporally solves the problem.
Anyway,
jest --detectLeaks
still fails us but the--logHeapUsage
option shows a correct manage of memory by jest.Thanks! That’s interesting, would be nice to have some more findings about that. Maybe it’s related to https://github.com/facebook/jest/issues/6814