You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running Jest tests on my project I noticed a constant memory consumption growth. A short investigation revealed that if I comment out the archiver import statement, memory gets released after each tests set execution.
Here's the simple setup that reproduces the issue:
There's a set of 20 test files, each having the same code:
// my_test1.e2e.js, my_test2.e2e.js ...importarchiverfrom'archiver';describe(`describe`,()=>{// make sure to collect garbage before each test (run node with --expose-gc option)beforeEach(()=>global.gc());// introducing a timeout to watch for memory growthtest('test',async()=>awaitnewPromise(r=>setTimeout(r,3000)));});
Jest config is as simple as:
// jest.config.e2e.jsmodule.exports={// The test environment that will be used for testingtestEnvironment: 'node',// The glob patterns Jest uses to detect test filestestMatch: ['**/__tests__/**/my_test*.e2e.js'],};
Run the tests with the following command (use --runInBand to make Jest run all tests subsequently in a single node process):
And here's the Node process monitoring results captured while running the tests. It clearly shows that memory allocation grows with each subsequent tests set execution:
And here's what I have after commenting out the import archiver from 'archiver'; statement in all test files:
The text was updated successfully, but these errors were encountered:
Running Jest tests on my project I noticed a constant memory consumption growth. A short investigation revealed that if I comment out the archiver import statement, memory gets released after each tests set execution.
Here's the simple setup that reproduces the issue:
There's a set of 20 test files, each having the same code:
Jest config is as simple as:
Run the tests with the following command (use --runInBand to make Jest run all tests subsequently in a single node process):
node --expose-gc node_modules/jest/bin/jest --config="jest.config.e2e.js" --runInBand
Result:
And here's the Node process monitoring results captured while running the tests. It clearly shows that memory allocation grows with each subsequent tests set execution:
And here's what I have after commenting out the
import archiver from 'archiver';
statement in all test files:The text was updated successfully, but these errors were encountered: