From 5a373bbc01a763c2790f7a09e8a9e5996ce093b9 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 1 Jul 2024 21:23:05 -0400 Subject: [PATCH 1/4] build(deps): replace `@gr2m/fetch-mock` with `fetch-mock` --- package-lock.json | 98 +++-------------------------------------------- package.json | 2 +- 2 files changed, 6 insertions(+), 94 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32bc16ccb..862ae1a9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@types/fetch-mock": "^7.3.8", "@types/jest": "^29.0.0", "esbuild": "^0.22.0", - "fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1", + "fetch-mock": "^10.0.7", "glob": "^10.2.6", "jest": "^29.0.0", "prettier": "3.3.2", @@ -504,19 +504,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/runtime": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.7.tgz", - "integrity": "sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw==", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/template": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", @@ -3719,18 +3706,6 @@ "dev": true, "license": "MIT" }, - "node_modules/core-js": { - "version": "3.37.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.1.tgz", - "integrity": "sha512-Xn6qmxrQZyB0FFY8E3bgRXei3lWDJHhvI+u0q9TKIYM49G8pAr0FgnnrFRAmsbptZL1yxRADVXn+x5AGsbBfyw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -4651,24 +4626,17 @@ } }, "node_modules/fetch-mock": { - "name": "@gr2m/fetch-mock", - "version": "9.11.0-pull-request-644.1", - "resolved": "https://registry.npmjs.org/@gr2m/fetch-mock/-/fetch-mock-9.11.0-pull-request-644.1.tgz", - "integrity": "sha512-gTp6RCHzlOXS1qRb0APfuyz48Lw/JFPa4uiar+kEgL1STsDwth75HJZ4x30tBlXMJXV8XDTDzJ2Hz9w3RWiHJA==", - "deprecated": "The fix has been implemented in fetch-mock@10", + "version": "10.0.7", + "resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-10.0.7.tgz", + "integrity": "sha512-TFG42kMRJ6dZpUDeVTdXNjh5O4TchHU/UNk41a050TwKzRr5RJQbtckXDjXiQFHPKgXGUG5l2TY3ZZ2gokiXaQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/core": "^7.0.0", - "@babel/runtime": "^7.0.0", - "core-js": "^3.0.0", "debug": "^4.1.1", "glob-to-regexp": "^0.4.0", "is-subset": "^0.1.1", "lodash.isequal": "^4.5.0", "path-to-regexp": "^2.2.1", - "querystring": "^0.2.0", - "whatwg-url": "^6.5.0" + "querystring": "^0.2.1" }, "engines": { "node": ">=4.0.0" @@ -4677,9 +4645,6 @@ "type": "charity", "url": "https://www.justgiving.com/refugee-support-europe" }, - "peerDependencies": { - "node-fetch": "*" - }, "peerDependenciesMeta": { "node-fetch": { "optional": true @@ -7976,13 +7941,6 @@ "dev": true, "license": "MIT" }, - "node_modules/lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", - "dev": true, - "license": "MIT" - }, "node_modules/lodash.uniqby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", @@ -11550,16 +11508,6 @@ "dev": true, "license": "ISC" }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/pure-rand": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", @@ -11740,13 +11688,6 @@ "util-deprecate": "~1.0.1" } }, - "node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "dev": true, - "license": "MIT" - }, "node_modules/regexp.prototype.flags": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", @@ -12931,16 +12872,6 @@ "node": ">=8.0" } }, - "node_modules/tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", - "dev": true, - "license": "MIT", - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/traverse": { "version": "0.6.9", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.9.tgz", @@ -13332,25 +13263,6 @@ "makeerror": "1.0.12" } }, - "node_modules/webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz", - "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index c2f97e08f..54e032fe9 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@types/fetch-mock": "^7.3.8", "@types/jest": "^29.0.0", "esbuild": "^0.22.0", - "fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1", + "fetch-mock": "^10.0.7", "glob": "^10.2.6", "jest": "^29.0.0", "prettier": "3.3.2", From 910d24cf0c5b18ced50c3444b526b71904e0c21f Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 1 Jul 2024 21:29:24 -0400 Subject: [PATCH 2/4] build: remove `@types/fetch-mock` --- package-lock.json | 8 -------- package.json | 1 - 2 files changed, 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 862ae1a9d..9510ddf43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,6 @@ "@octokit/request": "^9.0.0", "@octokit/tsconfig": "^3.0.0", "@octokit/types": "^13.0.0", - "@types/fetch-mock": "^7.3.8", "@types/jest": "^29.0.0", "esbuild": "^0.22.0", "fetch-mock": "^10.0.7", @@ -2463,13 +2462,6 @@ "@babel/types": "^7.20.7" } }, - "node_modules/@types/fetch-mock": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@types/fetch-mock/-/fetch-mock-7.3.8.tgz", - "integrity": "sha512-ztsIGiyUvD0GaqPc9/hb8k20gnr6lupqA6SFtqt+8v2mtHhNO/Ebb6/b7N6af/7x0A7s1C8nxrEGzajMBqz8qA==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", diff --git a/package.json b/package.json index 54e032fe9..b24433eba 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "@octokit/request": "^9.0.0", "@octokit/tsconfig": "^3.0.0", "@octokit/types": "^13.0.0", - "@types/fetch-mock": "^7.3.8", "@types/jest": "^29.0.0", "esbuild": "^0.22.0", "fetch-mock": "^10.0.7", From 8554748af26117d605fa96caa1dab1771a56e858 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Mon, 1 Jul 2024 21:29:40 -0400 Subject: [PATCH 3/4] test: fix types from fetch mock --- test/index.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/index.test.ts b/test/index.test.ts index d01e0900f..390223585 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -1,5 +1,5 @@ import { request } from "@octokit/request"; -import fetchMock, { type MockMatcherFunction } from "fetch-mock"; +import fetchMock from "fetch-mock"; import { createTokenAuth } from "../src/index.js"; @@ -155,7 +155,7 @@ test('auth.hook(request, "GET /user")', async () => { "user-agent": "test", }; - const matchGetUser: MockMatcherFunction = (url, { headers }) => { + const matchGetUser: fetchMock.MockMatcherFunction = (url, { headers }) => { expect(url).toEqual("https://api.github.com/user"); expect(headers).toStrictEqual(expectedRequestHeaders); return true; @@ -184,7 +184,7 @@ test("auth.hook() with JWT", async () => { "user-agent": "test", }; - const matchGetUser: MockMatcherFunction = (url, { headers }) => { + const matchGetUser: fetchMock.MockMatcherFunction = (url, { headers }) => { expect(url).toEqual("https://api.github.com/user"); expect(headers).toStrictEqual(expectedRequestHeaders); return true; From a353fe42487cbcc1c4b50ce7062395dfa8ed55b0 Mon Sep 17 00:00:00 2001 From: wolfy1339 Date: Sun, 14 Jul 2024 20:16:42 -0400 Subject: [PATCH 4/4] remove import unsued --- test/index.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.test.ts b/test/index.test.ts index 747fcc1ba..9ae637115 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -1,5 +1,5 @@ import { request } from "@octokit/request"; -import fetchMock, { type MockMatcherFunction } from "fetch-mock"; +import fetchMock from "fetch-mock"; import { test, expect } from "vitest"; import { createTokenAuth } from "../src/index.js";