question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
lh0x00commented, Feb 4, 2020

I debugged and this issue from jsdom package, I will try to fix it and update in new version in Jest. Ref https://github.com/jsdom/jsdom/issues/2757

3reactions
SimenBcommented, Feb 5, 2020

Jest 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@24 and use that through config.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found