-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Upgrade ESM and node-fetch #1408
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
base: main
Are you sure you want to change the base?
Upgrade ESM and node-fetch #1408
Conversation
- Added package.json in dist/setup to specify module type as ESM. - Updated jest.config.js to support ESM with ts-jest and added moduleNameMapper for .js extensions. - Created jest.setup.js to ensure Jest globals are available in ESM mode. - Modified test script in package.json to use node with experimental VM modules for Jest. - Updated imports in various distribution files to include .js extensions for ESM compatibility. - Adjusted tsconfig.json to exclude __tests__ directory and maintain ESM settings. - Updated package-lock.json to include new dependencies and their versions.
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 migrates the project from CommonJS to ES modules (ESM) and upgrades node-fetch from version 2.x to 3.x. The changes enable modern JavaScript module syntax and fetch API compatibility.
- Converted package.json to specify "type": "module" for ESM support
- Updated all import statements to include .js extensions for ESM compatibility
- Modified Jest configuration and test scripts to work with ESM modules
Reviewed Changes
Copilot reviewed 30 out of 40 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
package.json | Added ESM module type and updated test script for experimental VM modules |
jest.setup.js | Created Jest setup file to ensure globals are available in ESM mode |
src/**/*.ts | Updated import statements to include .js extensions for ESM compatibility |
tests/**/*.ts | Updated test imports and added ESM compatibility utilities |
.licenses/npm/*.dep.yml | Updated dependency license files for node-fetch v3.x and related packages |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
__tests__/authutil.test.ts
Outdated
let cnSpy: any; | ||
let logSpy: any; | ||
let dbgSpy: any; |
Copilot
AI
Oct 14, 2025
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.
Using 'any' type defeats TypeScript's type safety. Consider using proper Jest spy types like 'jest.SpyInstance' or importing the specific types from '@jest/globals'.
let cnSpy: any; | |
let logSpy: any; | |
let dbgSpy: any; | |
let cnSpy: jest.SpyInstance; | |
let logSpy: jest.SpyInstance; | |
let dbgSpy: jest.SpyInstance; |
Copilot uses AI. Check for mistakes.
…as a dev dependency
Description:
Describe your changes.
Related issue:
Add link to the related issue.
Check list: