Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@shazron
Copy link
Member

@shazron shazron commented Jan 21, 2025

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?

  • npm test

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Jan 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link

Copilot AI left a 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-fetch imports in source code and tests
  • Introduce setFetchMock in jest.setup.js for mocking global.fetch
  • Clean up package.json by deleting node-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 fetch requires Node ≥18, consider adding an "engines": { "node": ">=18" } field or updating README/CHANGELOG to document the minimum Node version.
{

@shazron shazron merged commit 8e9250d into master Sep 3, 2025
11 checks passed
@shazron shazron deleted the fetch-update branch September 3, 2025 01:17
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.

5 participants