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 with shallowMount / mount #2041
Comments
I have posted this same question on Stack Overflow. Changing node versions (12, 16, 18) did not resolve the issue. This is a Vue 2 project, so I cannot use vue-test-utils v2. However, I did a brief test on Vue 3 with Vue Test Utils v2, and it looked the issue was still present. Looking for help on what to try next, or if others are experiencing the same issue. To prevent CI from grinding to a halt, I'm using the workerIdleMemoryLimit option from the latest version of Jest as a band-aid. |
If anyone else is experiencing this issue or can reproduce with the steps listed in the original post, that would be great to know. The project I'm working on has ~6000 tests and this memory leak is causing trouble. |
I am able to reproduce the issue |
Uh oh... anyone up to dig into this and find the problem? |
Hey there, I can reproduce the issue by:
import { compileToFunctions } from 'vue-template-compiler'
import {mount} from 'packages/test-utils/src'
describe('mount and destroy components endlessly', () => {
it('should not run out of memory', () => {
const compiled = compileToFunctions('<div></div>')
while (true) {
const wrapper = mount(compiled)
wrapper.destroy()
}
})
})
After having failed to utilize This eventually led me to createStubFromComponent as source of the leak. Here, two things are unexpected:
So I don't really understand why calling I hope that this might be of help for you to find a solution :-) |
Subject of the issue
Seeing a 2MB heap size increase after each test using shallowMount / mount.
Steps to reproduce
Run this command with the below setup:
./node_modules/.bin/jest -- "DummyTest-test.js"
Vue Version 2.7.10
Vue Test Utils Version 1.3.3
Jest Version 29.0.3
Node Version 14.20.0
vue/vue2-jest Version 28.1.0
DummyTest-test.js
DummyComponent.vue
jest.config.js
Expected behaviour
Heap Size should remain consistent after each iteration of the test.
Actual behaviour
Seeing a 2MB memory leak.
The text was updated successfully, but these errors were encountered: