From ca7d0de1fd178bdbbdcf44654f4507519547fe1a Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Sat, 15 Jul 2023 02:56:06 +0200 Subject: [PATCH] chore(fetch-wrapper): improve error message when 'fetch' implementation is not present --- src/fetch-wrapper.ts | 2 +- test/request.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fetch-wrapper.ts b/src/fetch-wrapper.ts index 0e6987176..52c278828 100644 --- a/src/fetch-wrapper.ts +++ b/src/fetch-wrapper.ts @@ -32,7 +32,7 @@ export default function fetchWrapper( if (!fetch) { throw new Error( - 'Global "fetch" not found. Please provide `options.request.fetch` to octokit or upgrade to node@18 or newer.', + "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing", ); } diff --git a/test/request.test.ts b/test/request.test.ts index 86e79bbdb..3025c715c 100644 --- a/test/request.test.ts +++ b/test/request.test.ts @@ -396,7 +396,7 @@ x//0u+zd/R/QRUzLOw4N72/Hu+UG6MNt5iDZFCtapRaKt6OvSBwy8w== } globalThis.fetch = originalFetch; expect(error?.message).toEqual( - 'Global "fetch" not found. Please provide `options.request.fetch` to octokit or upgrade to node@18 or newer.', + "fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing", ); });