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
Fix "memory leaks" in tests #3124
Comments
Is there a strategy for finding leaks? Jest warning is too generic. I would like to learn how to find leaks, but don't know how to do it. |
Yeah, this is not an easy problem. I ran it and got 35 failed test suites ... not sure what the difference would be. |
Ref: #3236 (comment)
Additionally, |
I was investigating memory leaks in tests. But without much success. I run
I found the reason for leaks for two of them and created a PR: #3249. Then I tried to find problem with I've removed all rule code, except bare minimum: stylelint/lib/rules/at-rule-empty-line-before/index.js Lines 3 to 18 in e6ef28b
And I didn't use stylelint/lib/rules/at-rule-empty-line-before/__tests__/index.js Lines 3 to 20 in e6ef28b
npm run jest:detectleaks -- lib/rules/at-rule-empty-line-before/__tests__/index.js With 700 tests there is always a memory leak detected. With 500 tests. Sometimes it detected, sometimes — not. That's why I think this is the problem with a number of tests, rather with test code or stylelint code itself. Possibly it's a problem with Jest. I'll try to investigate further other tests. While I was searching for leaks I did some profiling. I noticed that I used Chrome DevTools to profile: node --inspect-brk bin/stylelint.js system-tests/001/stylesheet.css --config system-tests/001/config.json The slowest rules were for selectors mostly. |
I was about to make a new issue but GitHub got a 500 error and my issue was not posted and noticed this one :)
And with
|
Is the increasing heap size a good indication that there are indeed memory leaks? If so, continuing the investigation into the leaks would be a good project for someone if they have time. |
At this point, I'm not sure if the memory leaks are in tests only. It needs further investigation, for sure. |
It might be related to the outdated version of |
Seems to be resolved.
|
17 tests currently fail Jest's new "Experimental Leak Detection" https://facebook.github.io/jest/blog/#experimental-leak-detection
Any/all
n/a
n/a
master
n/a
No
No tests to be flagged
FAIL
Running
npm run jest:detectleaks
results in 17 tests failed:The text was updated successfully, but these errors were encountered: