Open
Description
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
import { shallowMount } from "@vue/test-utils";
import DummyComponent from "../DummyComponent.vue";
let iterations = [...Array(9999).keys()];
let wrapper;
let heap;
afterAll(() => {
iterations = null;
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
heap = null;
});
it.each(iterations)(`Test`, () => {
wrapper = shallowMount(DummyComponent);
heap = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2);
console.log(`Heap Size: ${heap} MB`);
expect(true).toBe(true);
});
DummyComponent.vue
<template>
<div>
<p>Hi</p>
</div>
</template>
<script>
export default {
name: "DummyComponent",
};
</script>
jest.config.js
module.exports = {
testEnvironment: "jsdom",
transform: {
"^.+\\.js$": "babel-jest",
"^.+\\.vue$": "@vue/vue2-jest",
},
};
Expected behaviour
Heap Size should remain consistent after each iteration of the test.
Actual behaviour
Seeing a 2MB memory leak.