Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak reported by detectLeaks for minimal coverage example #5285

Closed
rickhanlonii opened this issue Jan 11, 2018 · 2 comments · Fixed by #5289
Closed

Memory leak reported by detectLeaks for minimal coverage example #5285

rickhanlonii opened this issue Jan 11, 2018 · 2 comments · Fixed by #5289

Comments

@rickhanlonii
Copy link
Member

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Current behavior is for --detectLeaks to report a leak for any --coverage enabled test (which has at least one import)

Reproduction Steps

Steps to repo:

What is the expected behavior?

Expect that --detectLeaks does not fail for minimal --coverage test

Versions

  • jest@22.0.6
  • yarn@1.3.2
  • node@8.9.4
  • npm@5.6.0
  • macOS@10.13.1

More information

Using the new detectLeaks feature I was able to create a minimal expample repo of a leak when ever coverage is enabled:

// module.js
const noOp = () => {};
module.exports = noOp;
// module.spec.js
const _ = require('./module.js');

test('empty test', () => {
  expect(true).toBeTruthy();
});

Screens

Pass:

Fail:

A few notes:

  • The module is not used in the test, only imported
  • Commenting out the import will pass with coverage
  • Moving the module function into the test file will pass
  • This is only Jest (i.e. no babel-jest or React)
@rickhanlonii
Copy link
Member Author

I think the next step is probably to figure out if this is an error with the detectLeaks reporting or if it's a legit leak

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant