jest-leak-fixer

fixes https://github.com/facebook/jest/issues/6399

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
jest-leak-fixer
800.0.56 years ago6 years agoMinified + gzip package size for jest-leak-fixer in KB

Readme

Jest Memory Leak Fixer
Inspired by @Telokis comment in jest/issues/6399.
Fixes leaks in:
PRs are welcome.

Install

yarn add --dev jest-leak-fixer

Apply

Via CLI
package.json
{
  ...
  "scripts": {
    ...
    "test": "jest-fixer-apply; yarn test:detect-leaks; jest-fixer-restore",
    "test:detect-leaks": "jest --detectLeaks",
  }
}
Via globalSetup/globalTeardown configuration
globalSetup.js
'use strict'
const jestLeakFixer = require('jest-leak-fixer')
...

module.exports = () => {
    jestLeakFixer.apply()
    ...
}

globalTeardown.js
'use strict'
const jestLeakFixer = require('jest-leak-fixer')
...

module.exports = () => {
    ...
    jestLeakFixer.restore()
}