-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in tests #2030
Comments
Is this an angular app? If so, you'll have a lot more luck asking in their IRC or related channels. Tracking down memory leaks specific to an application isn't really within the scope of mocha. I don't know how your Hopefully adding a few afterEach won't be too bad, since your 1000 specs are likely grouped in 100 or less suites? Also, random aside, but you don't need to return Sorry we couldn't be of more help! And if this is angular, these might be of help: |
thanks @danielstjules I'll take a look! the |
I had a similar issue and the compilation did add returns. When I removed the returns the tests ran without issue. Just wanted to post in case anyone in the future finds a similar issue. |
@danieldram check, i have got the similar issues |
I mean to post an update thanks @justmyway. It turns out that you do need the returns. When I pulled them out, my tests were passing even though they shouldn't have (I realized later). The main problem seems to be when I execute many HTTP requests or one right after another, in a promise chain.. Sometimes one would not fire, sometimes it would not, but still pass when the return isn't provided. But always explicitly returning from chai-http in the it() at least gave me the errors. |
I'm getting the following error when running the entire suite of tests:
timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
After some investigation, I found out to be a memory leak issue. Looking at some heap profiling snapshot, objects still seem to be referenced and not getting garbaged collected.
Anyone know a solution that would prevent it from happening? There's some options such as going through each one of my 1000ish specs and adding
afterEach
to do some clean up, but that seems like a lot of work.Here's a sample layout of how most of my tests look like
Below are some profiling screenshots:
Thanks!
The text was updated successfully, but these errors were encountered: