Calling nock.restore() after each test suite doesn't stop memory leak
See original GitHub issueWhat is the expected behavior?
Hi there, I am a jest user.
beforeEach(() => {
if (!nock.isActive()) {
nock.activate();
}
});
afterEach(() => {
nock.cleanAll();
nock.restore();
});
calling this block should stop memory leak.
What is the actual behavior?
When I checkout the heap size usage by running node --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage <DIR>
I can still see the heap size gradually increased around 30MB after finishing a test file until it reached to the limit of memory capacity by V8 and shutdown the testing process.
Possible solution
Please if some of you resolved this leak by using nock.store
, share what exactly you do, I do really appreciate it.
How to reproduce the issue
Runkit: Example link
Having problem producing a test case? Try and ask the community for help. If the test case cannot be reproduced, the Nock community might not be able to help you.
Does the bug have a test case?
Versions
Software | Version(s) |
---|---|
Nock | 13.0.4 |
Node | 12.18.3 |
TypeScript |
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
@adamchenwei no one was able to provide a minimal example repo which exhibits the leak. We’ve yet to see actual confirmation that there is a memory leak. I’m not saying there isn’t one, but several of us have tried to reproduce it without success. Any insight you can provide from your issues are welcome.
that would be preferable, thank you! Thank you for creating the repository to reproduce the issue, very helpful!