Skip to content

task: upgrade jest and nock to support native fetch - #18724

Closed
toufali wants to merge 3 commits into
mainfrom
task/fix-native-fetch-tests
Closed

task: upgrade jest and nock to support native fetch#18724
toufali wants to merge 3 commits into
mainfrom
task/fix-native-fetch-tests

Conversation

@toufali

@toufali toufali commented Apr 15, 2025

Copy link
Copy Markdown
Member

Because

Tests fail when using native Fetch API, blocking our migration away from Axios

This pull request

Upgrades Jest and Nock to versions that are known to support the native Fetch API

Issue that this pull request solves

Closes: FXA-11503

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

@toufali toufali changed the title task(): upgrade jest and nock to support native fetch task: upgrade jest and nock to support native fetch Apr 15, 2025
@toufali
toufali force-pushed the task/fix-native-fetch-tests branch from 914e658 to 8447804 Compare April 15, 2025 16:17
@toufali
toufali force-pushed the task/fix-native-fetch-tests branch from 8447804 to a7f8c72 Compare April 15, 2025 19:52
@toufali

toufali commented Apr 17, 2025

Copy link
Copy Markdown
Member Author

Closing this in favor of #18698 .

Nock was not built for native fetch. A recent release suggests it can work, but after upgrading and going down that path I found too many work-arounds were needed, including importing text-encoder/decoder for all nock test files, and installing yet another dependency, @mswjs/interceptors. Since one of the original goals was to remove dependencies, I decided on a different approach, replacing nock with fetch-mock (which is already used/installed in our codebase).

Since fetch-mock doesn't work with Axios (and vice-versa) I'll complete this replacement together with native fetch in #18698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant