We saw memory leaks when running tests using a Jest framework after migrating to an up-to-date version of Node.js in our project. (jest issues#11956
- v14.21.3 ✅ (no leaks)
- v16.20.2 ⚠️ (leaks)
- v18.19.0 ⚠️ (leaks)
- v20.10.0 ✅ (no leaks)
Undoubtedly a Node.js problem, it was resolved in the release v20.10.0
Therefore, adding a --no-compilation-cache
option will fix memory leaks if you plan to use versions 16 or 18.
see package.json
example:
{
"scripts": {
- "test": "jest"
+ "test": "node --expose-gc --no-compilation-cache node_modules/.bin/jest"
}
}
Top comments (0)