diff --git a/config/FixJSDOMEnvironment.js b/config/FixJSDOMEnvironment.js index 9077731b9b0..dbbf9d3356f 100644 --- a/config/FixJSDOMEnvironment.js +++ b/config/FixJSDOMEnvironment.js @@ -14,7 +14,7 @@ class FixJSDOMEnvironment extends JSDOMEnvironment { // and setting AbortController breaks PersistedQueryLink tests, which may // indicate a memory leak // this.global.fetch = fetch; - // this.global.AbortController = AbortController; + this.global.AbortController = AbortController; } } diff --git a/src/link/persisted-queries/__tests__/persisted-queries.test.ts b/src/link/persisted-queries/__tests__/persisted-queries.test.ts index 32d75fe5136..e970af26d6f 100644 --- a/src/link/persisted-queries/__tests__/persisted-queries.test.ts +++ b/src/link/persisted-queries/__tests__/persisted-queries.test.ts @@ -573,7 +573,11 @@ describe("failure path", () => { variables, }).subscribe({ complete }) ); - + // fetch-mock holds a history of all options it has been called with + // that includes the `signal` option, which (with the native `AbortController`) + // has a reference to the `Request` instance, which will somehow reference our + // hash object + fetchMock.resetHistory(); await expect(hashRefs[0]).toBeGarbageCollected(); } );