Skip to content

lev-kazakov/jest-leak-fixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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; test_exit_code=$? && jest-fixer-restore; exit $test_exit_code",
    "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()
}

About

Jest memory leak fixer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published