You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
12345678910111213141516171819202122
  1. # jest-leak-detector
  2. Module for verifying whether an object has been garbage collected or not.
  3. 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.
  4. ## Example
  5. ```javascript
  6. let reference = {};
  7. const detector = new LeakDetector(reference);
  8. // Reference is held in memory.
  9. console.log(detector.isLeaked()); // true
  10. // We destroy the only reference to the object.
  11. reference = null;
  12. // Reference is gone.
  13. console.log(detector.isLeaked()); // false
  14. ```