jest-leak-fixer
v0.0.5
Published
fixes https://github.com/facebook/jest/issues/6399
Downloads
5,589
Readme
Jest Memory Leak Fixer
Inspired by @Telokis comment in jest/issues/6399.
Fixes leaks in:
- graceful-fs
- agent-base (puppeteer dep)
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()
}