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); Copy
await assertGarbageCollected(new WeakRef(obj), () => obj = null);
The WeakRef to the object to be monitored.
The destructor function to call before checking for garbage-collection.
Additional assert options.
AssertionError when object has not been garbage collected.
Calls the given destructor and asserts that the given object (passed via a WeakRef) is garbage collected within a given time (default 5000ms).
Example: