fix: remove use of node-fetch, use built in fetch#714
Merged
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.
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
moritzraho
approved these changes
Sep 1, 2025
dthampy
approved these changes
Sep 2, 2025
purplecabbage
approved these changes
Sep 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: