jest-leak-detector
Advanced tools
Module for verifying whether an object has been garbage collected or not.
Weekly downloads
Changelog
28.1.3
[jest-leak-detector]
Use native FinalizationRegistry
when it exists to get rid of external C dependency (#12973)[jest-changed-files]
Fix a lock-up after repeated invocations (#12757)[@jest/expect-utils]
Fix deep equality of ImmutableJS OrderedSets (#12977)[jest-mock]
Add index signature support for spyOn
types (#13013, #13020)[jest-snapshot]
Fix indentation of awaited inline snapshots (#12986)Readme
Module for verifying whether an object has been garbage collected or not.
Internally creates a weak reference to the object, and forces garbage collection to happen. If the reference is gone, it meant no one else was pointing to the object.
(async function () {
let reference = {};
let isLeaking;
const detector = new LeakDetector(reference);
// Reference is held in memory.
isLeaking = await detector.isLeaking();
console.log(isLeaking); // true
// We destroy the only reference to the object.
reference = null;
// Reference is gone.
isLeaking = await detector.isLeaking();
console.log(isLeaking); // false
})();
Module for verifying whether an object has been garbage collected or not.
The npm package jest-leak-detector receives a total of 14,064,986 weekly downloads. As such, jest-leak-detector popularity was classified as popular.
We found that jest-leak-detector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 5 open source maintainers collaborating on the project.