diff --git a/package-lock.json b/package-lock.json index 87ea4958b6..c1e3bdfd36 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@types/jest": "^29.0.0", "@types/node": "^22.0.0", "esbuild": "^0.24.0", - "fetch-mock": "^11.0.0", + "fetch-mock": "^12.0.0", "glob": "^11.0.0", "jest": "^29.0.0", "mockdate": "^3.0.5", @@ -2779,25 +2779,20 @@ } }, "node_modules/fetch-mock": { - "version": "11.1.5", - "resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-11.1.5.tgz", - "integrity": "sha512-KHmZDnZ1ry0pCTrX4YG5DtThHi0MH+GNI9caESnzX/nMJBrvppUHMvLx47M0WY9oAtKOMiPfZDRpxhlHg89BOA==", + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-12.2.0.tgz", + "integrity": "sha512-XjgxM582kB0SzPOqH2UdGTwSqga8A8aBPjxcYr0wTeOlCWpZoK6zBrPzltECUTu6Zt3VTWafmKF599LN9BRN5Q==", "dev": true, "license": "MIT", "dependencies": { "@types/glob-to-regexp": "^0.4.4", "dequal": "^2.0.3", "glob-to-regexp": "^0.4.1", - "is-subset": "^0.1.1", + "is-subset-of": "^3.1.10", "regexparam": "^3.0.0" }, "engines": { - "node": ">=8.0.0" - }, - "peerDependenciesMeta": { - "node-fetch": { - "optional": true - } + "node": ">=18.11.0" } }, "node_modules/filelist": { @@ -3145,12 +3140,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-subset": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", - "integrity": "sha512-6Ybun0IkarhmEqxXCNw/C0bna6Zb/TkfUX9UbwJtK6ObwAVCxmAP308WWTHviM/zAqXk05cdhYsUsZeGQh99iw==", + "node_modules/is-subset-of": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/is-subset-of/-/is-subset-of-3.1.10.tgz", + "integrity": "sha512-avvaYgVmYWyaZ1NDFiv4y9JGkrE2je3op1Po4VYKKJKR8H2qVPsg1GZuuXl5elCTxTlwAIsrAjWAs4BVrISFRw==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "typedescriptor": "3.0.2" + } }, "node_modules/isexe": { "version": "2.0.0", @@ -5165,6 +5164,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typedescriptor": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/typedescriptor/-/typedescriptor-3.0.2.tgz", + "integrity": "sha512-hyVbaCUd18UiXk656g/imaBLMogpdijIEpnhWYrSda9rhvO4gOU16n2nh7xG5lv/rjumnZzGOdz0CEGTmFe0fQ==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dev": true, + "license": "MIT" + }, "node_modules/typescript": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", diff --git a/package.json b/package.json index 75e73b446b..d92e3ec3b0 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@types/jest": "^29.0.0", "@types/node": "^22.0.0", "esbuild": "^0.24.0", - "fetch-mock": "^11.0.0", + "fetch-mock": "^12.0.0", "glob": "^11.0.0", "jest": "^29.0.0", "mockdate": "^3.0.5", diff --git a/test/app.test.ts b/test/app.test.ts index 3b49b460a4..3bffa57ee8 100644 --- a/test/app.test.ts +++ b/test/app.test.ts @@ -46,7 +46,7 @@ describe("App", () => { beforeEach(() => { MockDate.set(0); - mock = fetchMock.sandbox(); + mock = fetchMock.createInstance(); app = new App({ appId: APP_ID, @@ -60,7 +60,7 @@ describe("App", () => { }, Octokit: Octokit.defaults({ request: { - fetch: mock, + fetch: mock.fetchHandler, }, throttle: { enabled: false }, }), @@ -128,7 +128,7 @@ describe("App", () => { expect(repository.full_name).toEqual("octokit/octokit.js"); } - expect(mock.done()).toBe(true); + expect(mock.callHistory.done()).toBe(true); }); test("README example: app.getInstallationOctokit", async () => { @@ -167,7 +167,7 @@ describe("App", () => { title: "Hello, world!", }); - expect(mock.done()).toBe(true); + expect(mock.callHistory.done()).toBe(true); }); test("README example: createNodeMiddleware(app)", async () => { @@ -208,7 +208,7 @@ describe("App", () => { body: "Hello, World!", }); - expect(mock.done()).toBe(true); + expect(mock.callHistory.done()).toBe(true); }); // Your app can now receive webhook events at `/api/github/webhooks`