[v25] --detectLeaks option always reports a leak when using jsdom environment
See original GitHub issue💥 Regression Report
Starting in v25, the --detectLeaks option will always report a leak when using env=jsdom.
Last working version
Worked up to version: v24.9.0
Stopped working in version: v25.0.0
To Reproduce
https://github.com/dylanwulf/jest-25-detect-leak
npm run test: run test with jsdom environment
npm run test:sixteen: run test with jest-environment-jsdom-sixteen
npm run test:node: run test with node environment
When using jsdom or jest-environment-jsdom-sixteen it reports a memory leak even though the only thing in the test is a console log. When using the node environment, it does not report a leak.
Expected behavior
Should not report a memory leak for a simple test that clearly does not leak memory.
Link to repl or repo (highly encouraged)
https://github.com/dylanwulf/jest-25-detect-leak
Run npx envinfo --preset jest
Paste the results here:
System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Binaries:
Node: 12.14.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
npmPackages:
jest: 25.1.0 => 25.1.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:16 (6 by maintainers)
Top Results From Across the Web
Jest 25: Laying foundations for the future
The main changes are an upgrade of JSDOM from v11 to v15, 10-15% faster test runs, a new diff view for outdated snapshots...
Read more >Your Jest Tests are Leaking Memory
In this article, we'll walk through why it's so easy for Jest to leak memory, how to tell if your tests have a...
Read more >jsdom and node.js leaking memory - Stack Overflow
Stuck that after the call to window.close. Memory use immediately drops back to baseline (around 50MB for me) every time it gets triggered....
Read more >jest-leak-detector | Yarn - Package Manager
Module for verifying whether an object has been garbage collected or not. Internally creates a weak reference to the object, and forces garbage...
Read more >jest-environment-jsdom-sixteen - npm package - Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix advice.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I debugged and this issue from
jsdompackage, I will try to fix it and update in new version in Jest. Ref https://github.com/jsdom/jsdom/issues/2757Jest 26 is months away, and we’ll upgrade, not downgrade. So no need for a PR yet 🙂
If you want the old version of jsdom back, you can install
jest-environment-jsdom@24and use that through config.