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

feat: native fetch mocking #2580

Merged
merged 7 commits into from Feb 3, 2024

Conversation

mikicho
Copy link
Contributor

@mikicho mikicho commented Feb 3, 2024

BREAKING CHANGE: drop support for Node < 18

Fetch support.

  1. Solves the urgent need for fetch support.
  2. Although I think it's working as expected, I believe we should consider this as experimental until we see it working properly.
  3. Recording is not supported, yet(?). Workaround can be found here.
  4. I believe that we should keep working on switching the 'backend' to use 'mswjs/interceptors'., here is why.

@gr2m WDYT?
CC @kettanaito

@Uzlopak
Copy link
Member

Uzlopak commented Feb 3, 2024

I restructured few weeks ago the test folder. The folder test/got contains all tests which are got specific. So theoretically, you could copy the folder and name it fetch and rewrite the tests from using got to fetch.

@gr2m
Copy link
Member

gr2m commented Feb 3, 2024

Fetch support

Outstanding!!

  1. I believe that we should keep working on switching the 'backend' to use 'mswjs/interceptors'., here is why.

Agree!

  1. we should consider this as experimental

Yes! I'll setup beta releasing. Feel free to drop any support/tests for any Node version below 18

@gr2m gr2m changed the base branch from main to beta February 3, 2024 19:12
Copy link
Member

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

changes look good to me, thank you for working on this ❤️ you can merge at will into the beta branch, it will do automated pre-releases that you can then install with nock@beta. Just include this in the merge commit body (not subject):

BREAKING CHANGE: drop support for Node < 18

Even if you haven't implemented that yet, it's just so that the beta version starts at 14.0.0-beta.1 instead of 13.6.0-beta

@gr2m gr2m changed the title support fetch mocking feat: native fetch mocking Feb 3, 2024
@mikicho
Copy link
Contributor Author

mikicho commented Feb 3, 2024

@gr2m Thanks! It would also solve the coverage issues.
I think I need you to approve the pull request.

Also, seems like we need to adjust the configuration in the settings: Test (10, ubuntu-latest) Expected — Waiting for status to be reported (protected branch)

Copy link
Member

@gr2m gr2m left a comment

Choose a reason for hiding this comment

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

🚀

@gr2m gr2m enabled auto-merge (squash) February 3, 2024 20:20
@gr2m gr2m merged commit 8b8c0c2 into nock:beta Feb 3, 2024
14 checks passed
Copy link

github-actions bot commented Feb 3, 2024

🎉 This PR is included in version 14.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mikicho mikicho deleted the Michael/fetch-support-monkey-patch branch February 3, 2024 20:31
@gr2m
Copy link
Member

gr2m commented Feb 3, 2024

@mikicho if you think it's ready for user testing, can you please tell folks at #2397? They can install the latest beta with

npm install --save-dev nock@beta

@kettanaito
Copy link

I think this is a great first step, @mikicho. Apologies for my limited availability over the past week, I've got buried in a few tasks. I will get back to our discussion on sockets and pending issues as soon as I can! Thank you!

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

Successfully merging this pull request may close these issues.

None yet

4 participants