Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use native AbortController #11753

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion config/FixJSDOMEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much overhead this would add, but: thoughts on calling this in an afterEach to make these tests future-proof?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so - in this case, it was even within the test.

In the long run, we should probably move away from mock-fetch, so I wouldn't spend too much time with it now, tbh.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right! Forgot that it wasn't just at the top of the test :/ makes sense 👍

await expect(hashRefs[0]).toBeGarbageCollected();
}
);
Expand Down
Loading