Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5429dfd

Browse filesBrowse files
wolfy1339nickfloyd
andauthored
feat: v20 (#305)
BREAKING CHANGE: Drop support for NodeJS v14, v16 BREAKING CHANGE: Remove previews support for the REST API BREAKING CHANGE: remove agent option from `octokit.request()` --------- Co-authored-by: Nick Floyd <139819+nickfloyd@users.noreply.github.com>
1 parent 64ca2b9 commit 5429dfd
Copy full SHA for 5429dfd

28 files changed

+1076
-10874
lines changed

‎.github/workflows/test.yml

Copy file name to clipboardExpand all lines: .github/workflows/test.yml
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ jobs:
1818
strategy:
1919
matrix:
2020
node_version:
21-
- 14
22-
- 16
2321
- 18
22+
- 20
2423
steps:
2524
- uses: actions/checkout@v3
2625
- name: Test with Node.js ${{ matrix.node_version }}
2726
uses: actions/setup-node@v3
2827
with:
2928
cache: npm
30-
node-version: 16
29+
node-version: ${{ matrix.node_version }}
3130
- run: npm ci
3231
- run: npm run start-fixtures-server &
3332
- run: sleep 3

‎.github/workflows/update-docs.yml

Copy file name to clipboardExpand all lines: .github/workflows/update-docs.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v3
1111
- uses: actions/setup-node@v3
1212
with:
13-
node-version: 16
13+
node-version: 18
1414
cache: npm
1515
- run: npm ci
1616
- run: npm --prefix ./docs ci ./docs

‎.github/workflows/update-prettier.yml

Copy file name to clipboardExpand all lines: .github/workflows/update-prettier.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/setup-node@v3
1212
with:
1313
cache: npm
14-
node-version: 16
14+
node-version: 18
1515
- run: npm ci
1616
- run: npm run lint:fix
1717
- uses: gr2m/create-or-update-pull-request-action@v1.x

‎package-lock.json

Copy file name to clipboardExpand all lines: package-lock.json
+1,018-10,800Lines changed: 1018 additions & 10800 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Copy file name to clipboardExpand all lines: package.json
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,30 @@
3232
],
3333
"repository": "github:octokit/rest.js",
3434
"dependencies": {
35-
"@octokit/core": "^4.2.1",
36-
"@octokit/plugin-paginate-rest": "^6.1.2",
35+
"@octokit/core": "^5.0.0",
36+
"@octokit/plugin-paginate-rest": "^8.0.0",
3737
"@octokit/plugin-request-log": "^1.0.4",
38-
"@octokit/plugin-rest-endpoint-methods": "^7.1.2"
38+
"@octokit/plugin-rest-endpoint-methods": "^9.0.0"
3939
},
4040
"devDependencies": {
41-
"@octokit/auth-action": "^2.0.3",
42-
"@octokit/auth-app": "^4.0.13",
41+
"@octokit/auth-action": "^4.0.0",
42+
"@octokit/auth-app": "^6.0.0",
4343
"@octokit/fixtures-server": "^7.0.0",
44-
"@octokit/request": "^6.2.5",
44+
"@octokit/request": "^8.0.4",
4545
"@octokit/tsconfig": "^2.0.0",
4646
"@types/jest": "^29.0.0",
4747
"@types/node": "^18.0.0",
4848
"esbuild": "^0.18.0",
49-
"fetch-mock": "^9.0.0",
49+
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
5050
"glob": "^10.2.5",
5151
"jest": "^29.0.0",
52+
"nock": "^13.3.1",
5253
"prettier": "3.0.0",
5354
"semantic-release": "^21.0.0",
5455
"semantic-release-plugin-update-version-in-files": "^1.0.0",
5556
"ts-jest": "^29.0.0",
56-
"typescript": "^5.0.0"
57+
"typescript": "^5.0.0",
58+
"undici": "^5.22.1"
5759
},
5860
"scripts": {
5961
"build": "node scripts/build.mjs && tsc -p tsconfig.json",
@@ -120,6 +122,6 @@
120122
]
121123
},
122124
"engines": {
123-
"node": ">= 14"
125+
"node": ">= 18"
124126
}
125127
}

‎test/integration/agent-ca/agent-ca-test.js

Copy file name to clipboardExpand all lines: test/integration/agent-ca/agent-ca-test.js
+32-12Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
const https = require("https");
21
const { readFileSync } = require("fs");
32
const { resolve } = require("path");
3+
const { fetch: undiciFetch, Agent } = require("undici");
44

55
const { Octokit } = require("../../..");
66
const ca = readFileSync(resolve(__dirname, "./ca.crt"));
77

8-
require("../../mocha-node-setup");
9-
108
describe("custom client certificate", () => {
119
let server;
1210
before((done) => {
@@ -28,13 +26,23 @@ describe("custom client certificate", () => {
2826
server.listen(0, done);
2927
});
3028

31-
it("https.Agent({ca})", () => {
32-
const agent = new https.Agent({
33-
ca,
29+
it("undici.Agent({ca})", () => {
30+
const agent = new Agent({
31+
keepAliveTimeout: 10,
32+
keepAliveMaxTimeout: 10,
33+
connect: { ca: ca },
3434
});
35+
const myFetch = (url, opts) => {
36+
return undiciFetch(url, {
37+
...opts,
38+
dispatcher: agent,
39+
});
40+
};
3541
const octokit = new Octokit({
3642
baseUrl: "https://localhost:" + server.address().port,
37-
request: { agent },
43+
request: {
44+
fetch: myFetch,
45+
},
3846
});
3947

4048
return octokit.rest.repos.get({
@@ -43,14 +51,26 @@ describe("custom client certificate", () => {
4351
});
4452
});
4553

46-
it("https.Agent({ca, rejectUnauthorized})", () => {
47-
const agent = new https.Agent({
48-
ca: "invalid",
49-
rejectUnauthorized: false,
54+
it("undici.Agent({ca, rejectUnauthorized})", () => {
55+
const agent = new Agent({
56+
keepAliveTimeout: 10,
57+
keepAliveMaxTimeout: 10,
58+
connect: {
59+
ca: "invalid",
60+
rejectUnauthorized: true,
61+
},
5062
});
63+
const myFetch = (url, opts) => {
64+
return undiciFetch(url, {
65+
...opts,
66+
dispatcher: agent,
67+
});
68+
};
5169
const octokit = new Octokit({
5270
baseUrl: "https://localhost:" + server.address().port,
53-
request: { agent },
71+
request: {
72+
fetch: myFetch,
73+
},
5474
});
5575

5676
return octokit.rest.repos.get({

‎test/integration/apps-test.js

Copy file name to clipboardExpand all lines: test/integration/apps-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ const { Octokit } = require("../../");
44
const BEARER_TOKEN =
55
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTM4MTkzMTIsImV4cCI6MTU1MzgxOTM3MiwiaXNzIjoxfQ.etiSZ4LFQZ8tiMGJVqKDoGn8hxMCgwL4iLvU5xBUqbAPr4pbk_jJZmMQjuxTlOnRxq4e7NouTizGCdfohRMb3R1mpLzGPzOH9_jqSA_BWYxolsRP_WDSjuNcw6nSxrPRueMVRBKFHrqcTOZJej0djRB5pI61hDZJ_-DGtiOIFexlK3iuVKaqBkvJS5-TbTekGuipJ652g06gXuz-l8i0nHiFJldcuIruwn28hTUrjgtPbjHdSBVn_QQLKc2Fhij8OrhcGqp_D_fvb_KovVmf1X6yWiwXV5VXqWARS-JGD9JTAr2495ZlLV_E4WPxdDpz1jl6XS9HUhMuwBpaCOuipw";
66

7-
require("../mocha-node-setup");
8-
97
describe("apps", () => {
108
let octokit;
119

‎test/integration/authentication-test.js

Copy file name to clipboardExpand all lines: test/integration/authentication-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const { createActionAuth } = require("@octokit/auth-action");
55

66
const { Octokit } = require("../..");
77

8-
require("../mocha-node-setup");
9-
108
describe("authentication", () => {
119
it("unauthenticated", () => {
1210
nock("https://authentication-test-host.com").get("/").reply(200, {});

‎test/integration/conditional-request-test.js

Copy file name to clipboardExpand all lines: test/integration/conditional-request-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const nock = require("nock");
22

33
const { Octokit } = require("../../");
44

5-
require("../mocha-node-setup");
6-
75
describe("request 304s", () => {
86
let octokit;
97

‎test/integration/deprecations-test.js

Copy file name to clipboardExpand all lines: test/integration/deprecations-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ const nock = require("nock");
44
const DeprecatedOctokit = require("../../");
55
const { Octokit } = DeprecatedOctokit;
66

7-
require("../mocha-node-setup");
8-
97
const Mocktokit = Octokit.plugin((octokit) => {
108
octokit.hook.wrap("request", () => null);
119
});

‎test/integration/pagination-test.js

Copy file name to clipboardExpand all lines: test/integration/pagination-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const nock = require("nock");
22

33
const { Octokit } = require("../../");
44

5-
require("../mocha-node-setup");
6-
75
describe("pagination", () => {
86
it(".paginate()", () => {
97
nock("https://pagination-test.com")

‎test/integration/params-validations-test.js

Copy file name to clipboardExpand all lines: test/integration/params-validations-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const nock = require("nock");
22

33
const { Octokit } = require("../../");
44

5-
require("../mocha-node-setup");
6-
75
describe("params validations", () => {
86
it("octokit.rest.orgs.get({})", () => {
97
const octokit = new Octokit();

‎test/integration/plugins-test.js

Copy file name to clipboardExpand all lines: test/integration/plugins-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
const { Octokit } = require("../../");
22

3-
require("../mocha-node-setup");
4-
53
describe("plugins", () => {
64
it("gets called in constructor", () => {
75
const MyOctokit = Octokit.plugin((octokit) => {

‎test/integration/register-endpoints-test.js

Copy file name to clipboardExpand all lines: test/integration/register-endpoints-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const nock = require("nock");
22

33
const { Octokit } = require("../../");
44

5-
require("../mocha-node-setup");
6-
75
describe("registerEndpoints", () => {
86
it("optins are not altered in registered endpoint methods", () => {
97
nock("https://api.github.com")

‎test/integration/request-errors-test.js

Copy file name to clipboardExpand all lines: test/integration/request-errors-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ const nock = require("nock");
22

33
const { Octokit } = require("../../");
44

5-
require("../mocha-node-setup");
6-
75
describe("request errors", () => {
86
it("timeout", () => {
97
nock("https://request-errors-test.com").get("/").delay(2000).reply(200, {});

‎test/issues/1134-missing-endpoint-scopes-test.js

Copy file name to clipboardExpand all lines: test/issues/1134-missing-endpoint-scopes-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
const { Octokit } = require("../../");
22

3-
require("../mocha-node-setup");
4-
53
describe("https://github.com/octokit/rest.js/issues/1134", () => {
64
it("octokit.rest.pulls", () => {
75
const octokit = new Octokit();

‎test/issues/1279-store-otp-send-header-all-requests-test.js

Copy file name to clipboardExpand all lines: test/issues/1279-store-otp-send-header-all-requests-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/1279", () => {
75
it("2fa code gets stored and passed as header to listAuthorizations", () => {
86
nock("https://authentication-test-host.com", {

‎test/issues/1323-parameter-deprecation-bug-test.js

Copy file name to clipboardExpand all lines: test/issues/1323-parameter-deprecation-bug-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../..");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/1323", () => {
75
it("should accept new parameter", () => {
86
nock("https://api.github.com")

‎test/issues/1497-include-error-message-on-validation-error-test.js

Copy file name to clipboardExpand all lines: test/issues/1497-include-error-message-on-validation-error-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/1497", () => {
75
it("octokit.rest.repos.updateBranchProtection()", () => {
86
nock("https://request-errors-test.com", {

‎test/issues/1553-deprecated-teams-methods-test.js

Copy file name to clipboardExpand all lines: test/issues/1553-deprecated-teams-methods-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/1553", () => {
75
it.skip("octokit.rest.teams.removeMember()", () => {
86
const octokit = new Octokit();

‎test/issues/765-remove-milestone-from-issue-test.js

Copy file name to clipboardExpand all lines: test/issues/765-remove-milestone-from-issue-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/765", () => {
75
it("octokit.rest.issues.update({..., milestone: null})", () => {
86
nock("https://api.github.com")

‎test/issues/818-get-installations-test.js

Copy file name to clipboardExpand all lines: test/issues/818-get-installations-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/818", () => {
75
it("octokit.rest.apps.listInstallations()", () => {
86
nock("https://api.github.com").get("/app/installations").reply(200, []);

‎test/issues/826-fail-on-304-test.js

Copy file name to clipboardExpand all lines: test/issues/826-fail-on-304-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/826", () => {
75
it("throws error on 304 responses", () => {
86
nock("https://request-errors-test.com")

‎test/issues/841-head-request-test.js

Copy file name to clipboardExpand all lines: test/issues/841-head-request-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/841", () => {
75
it("supports sending GET requests with method: HEAD", () => {
86
nock("https://head-request-test.com")

‎test/issues/861-custom-accept-header-test.js

Copy file name to clipboardExpand all lines: test/issues/861-custom-accept-header-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/861", () => {
75
it("custom accept header", () => {
86
nock("https://issues-861-test.com", {

‎test/issues/922-create-check-with-empty-actions-array-test.js

Copy file name to clipboardExpand all lines: test/issues/922-create-check-with-empty-actions-array-test.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const nock = require("nock");
22
const { Octokit } = require("../../");
33

4-
require("../mocha-node-setup");
5-
64
describe("https://github.com/octokit/rest.js/issues/922", () => {
75
it("octokit.rest.issues.update({..., milestone: null})", () => {
86
nock("https://api.github.com")

‎test/scenarios/add-and-remove-repository-collaborator.test.ts

Copy file name to clipboardExpand all lines: test/scenarios/add-and-remove-repository-collaborator.test.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe("api.github.com", () => {
3434
.then((response) => {
3535
expect(response.data.length).toEqual(1);
3636

37-
return githubUserB.repos.acceptInvitation({
37+
return githubUserB.repos.acceptInvitationForAuthenticatedUser({
3838
invitation_id: response.data[0].id,
3939
});
4040
})

‎test/scenarios/errors.test.ts

Copy file name to clipboardExpand all lines: test/scenarios/errors.test.ts
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ describe("api.github.com", () => {
2424
expect(error.message).toEqual(
2525
`Validation Failed: {"resource":"Label","code":"invalid","field":"color"}`,
2626
);
27-
expect(error.response.data.errors).toStrictEqual([
28-
{
29-
resource: "Label",
30-
code: "invalid",
31-
field: "color",
32-
},
33-
]);
27+
// To-Do: Figure out why the objects are not strictly equal
28+
expect(JSON.stringify(error.response.data.errors)).toStrictEqual(
29+
JSON.stringify([
30+
{
31+
resource: "Label",
32+
code: "invalid",
33+
field: "color",
34+
},
35+
]),
36+
);
3437
expect(error.response.data.documentation_url).toMatch(
3538
new RegExp("rest/reference/issues#create-a-label"),
3639
);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.