-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Process out of memory, on multiple jest versions #975
Comments
Brief reply because I'm on vacation: it is likely your unit tests set up some expensive listeners and they aren't being cleaned up properly. The memory use between 0.9 and 12 did not change significantly.
Is this with or without coverage? Coverage is currently a bit unoptimized and we are planning to fix it soon.
Do you have any code you could share that reproduces this problem so we can make sure to fix this next week when I'm back? :)
|
Thanks for your answer. Sory for delay. OOM - with coverage collection and without it At first step I will try to profile my code for myself. May be I have memory leak in my code? Or Images can consume a lot of memory? |
I'm pretty sure you aren't loading any images in Jest, are you? :) While Jest could be better with memory use, it is very likely that your tests are for some reasons not being torn down properly and retaining module code that are being required. |
Images are mocked, right? We leaved this behaviour by-default. I see also adding App itself consumes 108MB of RAM (being launched in dev mode), according to iPhone 6s Plus simulator. This iissue becomes pretty interesting, let me digg into jest with profiler... |
@cpojer okay. Nothing to see, just a infinite |
Well, glad Jest could help find some issues with your code! :D |
Can you elaborate about this? I've tried Jest in React project but I ran into memory problem. When running the following test thousands of time the heap grows until an allocation error is thrown. // __tests__/Hello-{001-5000}-test.js
import Hello from '../Hello.js';
describe('Hello', () => {
it('should exist', () => {
expect(Hello).toBeTruthy();
});
}); // Hello.js
import React from 'react';
export default () => <span>hello</span>; |
I'm running into the same problem and my test fails for even the simplest cases: import React from 'react';
import { mount, render, shallow } from 'enzyme';
let component = mount(
<div>test</div>
);
describe('Component', () => {
it('dies with the full object', () => {
//console.log('component', component);
expect(component).toBe(true);
});
}); Of course this is stupid test what should fail anyway but not with memory error. If I'm trying to use with enzyme's shallow rendering it works, but interestingly also if I comment out expect (if I console log my component variable it looks right).
It seems to me that when the test fails it tries to pretty-print my component variable but if that is fully mounted pretty-print gets into an infinite loop. My issue is that for some of my real test cases shallow rendering is not enough for me, i need the full tree to check that child elements are mounted properly. UPDATE |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Our codebase is not that huge. Around 50 small modules.
This error pops up when running jest with or without coverage.
Testing all modules (command: just a
jest
)(
JS stacktrace
is null...)I'm using node v5.10.1.
I tried jest@12, jest@11, jest@0.9
It runs well when executing files one by one, but running on all tests it blows up.
Node process consumes aroung 1G of mem.
The text was updated successfully, but these errors were encountered: