Hi, I'm curious if there are known, measurable benefits of using the teardown option for someone who is using Jest. Because it causes onDestroy to be called, I would expect it to reduce memory leaks (every time we unsubscribe in the onDestroy hook), but in my testing, I don't see any noticeable difference in memory use in our project with 1754 total tests.
👨🏫 Co-Founder of This is Learning, Organizer of AarhusJS
✍️ Writer, Speaker, FOSS Maintainer 📗 Author
🏆 Microsoft MVP 🌟 GitHub Star
🌊 Nx Champion 🦸 Angular Hero of Education
Performance issues when using Karma. Impact will vary.
Correctness. Destroying modules and services using the any or root provider scopes.
Do you have stateful Angular modules or root/any-provided services? Do they implement OnDestroy? Otherwise, you won't notice anything performance-wise. If you do, you might catch subtle bugs and you might notice performance improvements. Jest is good at parallelizing so much less so than Karma.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, I'm curious if there are known, measurable benefits of using the teardown option for someone who is using Jest. Because it causes
onDestroy
to be called, I would expect it to reduce memory leaks (every time we unsubscribe in theonDestroy
hook), but in my testing, I don't see any noticeable difference in memory use in our project with 1754 total tests.This update is about two things:
Do you have stateful Angular modules or root/any-provided services? Do they implement OnDestroy? Otherwise, you won't notice anything performance-wise. If you do, you might catch subtle bugs and you might notice performance improvements. Jest is good at parallelizing so much less so than Karma.