diff --git a/packages/eas-cli/__mocks__/undici.ts b/packages/eas-cli/__mocks__/undici.ts deleted file mode 100644 index 845866e561..0000000000 --- a/packages/eas-cli/__mocks__/undici.ts +++ /dev/null @@ -1,7 +0,0 @@ -const undici = require('undici'); - -// This workaround swaps `undici.fetch` for `global.fetch` to connect Nock with Undici. -// See: https://github.com/nock/nock/issues/2183 -require('nock'); - -module.exports = { ...undici, fetch: global.fetch }; diff --git a/packages/eas-cli/src/fetch.ts b/packages/eas-cli/src/fetch.ts index 648029f4e7..6dc475c9c9 100644 --- a/packages/eas-cli/src/fetch.ts +++ b/packages/eas-cli/src/fetch.ts @@ -1,15 +1,11 @@ import { env } from 'node:process'; -import { - ProxyAgent, - type RequestInfo, - type RequestInit, - type Response, - fetch, - getGlobalDispatcher, - setGlobalDispatcher, -} from 'undici'; +import { ProxyAgent, getGlobalDispatcher, setGlobalDispatcher } from 'undici'; -export { Agent, Headers, type RequestInfo, type RequestInit, Response } from 'undici'; +// Re-export the fetch-related Node globals +export type RequestInfo = globalThis.RequestInfo; +export type RequestInit = globalThis.RequestInit; +export type Response = globalThis.Response; +export const Headers = globalThis.Headers; export class RequestError extends Error { constructor(