jest-leak-detector
Advanced tools
Comparing version 28.1.3 to 29.0.0-alpha.0
@@ -81,33 +81,10 @@ 'use strict'; | ||
); | ||
} // TODO: Remove the `if` and `weak-napi` when we drop node 12, as v14 supports FinalizationRegistry | ||
} // When `_finalizationRegistry` is GCed the callback we set will no longer be called, | ||
if (globalThis.FinalizationRegistry) { | ||
// When `_finalizationRegistry` is GCed the callback we set will no longer be called, | ||
// so we need to assign it to `this` to keep it referenced | ||
this._finalizationRegistry = new FinalizationRegistry(() => { | ||
this._isReferenceBeingHeld = false; | ||
}); | ||
this._finalizationRegistry = new FinalizationRegistry(() => { | ||
this._isReferenceBeingHeld = false; | ||
}); | ||
this._finalizationRegistry.register(value, undefined); | ||
} else { | ||
let weak; | ||
this._finalizationRegistry.register(value, undefined); | ||
try { | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
weak = require('weak-napi'); | ||
} catch (err) { | ||
if (!err || err.code !== 'MODULE_NOT_FOUND') { | ||
throw err; | ||
} | ||
throw new Error( | ||
'The leaking detection mechanism requires newer version of node that supports ' + | ||
'FinalizationRegistry, update your node or install the "weak-napi" package ' + | ||
'which support current node version as a dependency on your main project.' | ||
); | ||
} | ||
weak(value, () => (this._isReferenceBeingHeld = false)); | ||
} | ||
this._isReferenceBeingHeld = true; // Ensure value is not leaked by the closure created by the "weak" callback. | ||
@@ -114,0 +91,0 @@ |
{ | ||
"name": "jest-leak-detector", | ||
"version": "28.1.3", | ||
"version": "29.0.0-alpha.0", | ||
"repository": { | ||
@@ -20,11 +20,7 @@ "type": "git", | ||
"dependencies": { | ||
"jest-get-type": "^28.0.2", | ||
"pretty-format": "^28.1.3" | ||
"jest-get-type": "^29.0.0-alpha.0", | ||
"pretty-format": "^29.0.0-alpha.0" | ||
}, | ||
"devDependencies": { | ||
"@types/weak-napi": "^2.0.0", | ||
"weak-napi": "^2.0.1" | ||
}, | ||
"engines": { | ||
"node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" | ||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0" | ||
}, | ||
@@ -34,3 +30,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "2cce069800dab3fc8ca7c469b32d2e2b2f7e2bb1" | ||
"gitHead": "6862afb00307b52f32eedee977a9b3041355f184" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
5594
104
2
+ Added@jest/schemas@29.6.3(transitive)
+ Added@sinclair/typebox@0.27.8(transitive)
+ Addedjest-get-type@29.6.3(transitive)
+ Addedpretty-format@29.7.0(transitive)
- Removed@jest/schemas@28.1.3(transitive)
- Removed@sinclair/typebox@0.24.51(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedjest-get-type@28.0.2(transitive)
- Removedpretty-format@28.1.3(transitive)