-
Notifications
You must be signed in to change notification settings - Fork 39
fix: remove use of node-fetch, use built in fetch #714
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces the node-fetch package and jest-fetch-mock usage with the built-in fetch API, and updates tests to use a custom setFetchMock helper.
- Remove all
node-fetchimports in source code and tests - Introduce
setFetchMockinjest.setup.jsfor mockingglobal.fetch - Clean up
package.jsonby deletingnode-fetch,jest-fetch-mock, and related overrides
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/jest.setup.js | Added setFetchMock global helper; removed jest-fetch-mock |
| test/helpers.test.js | Switched from jest-fetch-mock to setFetchMock |
| test/commands/*.test.js | Removed fetch.resetMocks() and node-fetch imports; use setFetchMock |
| test/.eslintrc.json | Declared setFetchMock as a global for linting |
| src/helpers.js | Removed require('node-fetch') |
| src/commands/discover.js | Removed require('node-fetch') |
| package.json | Deleted node-fetch, jest-fetch-mock, and overrides |
Comments suppressed due to low confidence (1)
package.json:1
- Since relying on the built-in
fetchrequires Node ≥18, consider adding an"engines": { "node": ">=18" }field or updating README/CHANGELOG to document the minimum Node version.
{
# Conflicts: # package-lock.json
Motivation and Context
node-fetch@v2's dependencies use the built in punycode module, which is deprecated in node-22, and prints out a deprecation warning.
How Has This Been Tested?
Types of changes
Checklist: