Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cache/_serialize_arg_list_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ Deno.test("_serializeArgList() cleans up cache entries when finalization callbac
});

Deno.test("_serializeArgList() allows garbage collection for weak keys", async () => {
// @ts-expect-error - Triggering true garbage collection is only available
// with `--v8-flags="--expose-gc"`, so we mock `FinalizationRegistry` with
// `using` and some `Symbol.dispose` trickery if it's not available. Run this
// test with `deno test --v8-flags="--expose-gc"` to test actual gc behavior
// Triggering true garbage collection is only available with
// `--v8-flags="--expose-gc"`, so we mock `FinalizationRegistry` with `using`
// and some `Symbol.dispose` trickery if it's not available. Run this test
// with `deno test --v8-flags="--expose-gc"` to test actual gc behavior
// (however, even calling `globalThis.gc` doesn't _guarantee_ garbage
// collection, so this may be flaky between v8 versions etc.)
const gc = globalThis.gc as undefined | (() => void);
const gc = Reflect.get(globalThis, "gc") as (() => void) | undefined;

class MockFinalizationRegistry<T> extends FinalizationRegistry<T> {
#cleanupCallback: (heldValue: T) => void;
Expand Down
Loading