@kayahr/assert
    Preparing search index...

    Function assertGarbageCollected

    • Calls the given destructor and asserts that the given object (passed via a WeakRef) is garbage collected within a given time (default 5000ms).

      Example:

      await assertGarbageCollected(new WeakRef(obj), () => obj = null);
      

      Parameters

      • ref: WeakRef<object>

        The WeakRef to the object to be monitored.

      • destructor: () => void

        The destructor function to call before checking for garbage-collection.

      • options: AssertGarbageCollectedOptions = {}

        Additional assert options.

      Returns Promise<void>

      AssertionError when object has not been garbage collected.