Skip to content

Commit 297f03a

Browse files
authored
chore: modernize dependencies (#761)
1 parent 89d588a commit 297f03a

File tree

9 files changed

+2161
-4446
lines changed

9 files changed

+2161
-4446
lines changed

package-lock.json

Lines changed: 2129 additions & 4398 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"lint": "prettier --check '{src,test,scripts}/**/*' '!scripts/update-endpoints/generated/**' '!src/generated/**' README.md package.json",
99
"lint:fix": "prettier --write '{src,test,scripts}/**/*' '!scripts/update-endpoints/generated/**' '!src/generated/**' README.md package.json",
1010
"pretest": "npm run -s lint",
11-
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest --coverage",
12-
"update-endpoints": "npm-run-all update-endpoints:*",
11+
"test": "vitest run --coverage",
12+
"update-endpoints": "npm run update-endpoints:fetch-json && npm run update-endpoints:code && npm run update-endpoints:docs && npm run update-endpoints:types",
1313
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json.mjs",
1414
"update-endpoints:code": "node scripts/update-endpoints/code.mjs",
1515
"update-endpoints:docs": "node scripts/update-endpoints/docs.mjs",
@@ -30,56 +30,24 @@
3030
"devDependencies": {
3131
"@octokit/core": "^6.0.0",
3232
"@octokit/tsconfig": "^3.0.0",
33-
"@types/fetch-mock": "^7.3.1",
34-
"@types/jest": "^29.0.0",
3533
"@types/node": "^20.0.0",
36-
"@types/sinon": "^17.0.0",
34+
"@vitest/coverage-v8": "^2.0.3",
35+
"camelcase": "^8.0.0",
3736
"esbuild": "^0.23.0",
38-
"fetch-mock": "npm:@gr2m/fetch-mock@^9.11.0-pull-request-644.1",
37+
"fetch-mock": "^10.0.0",
3938
"github-openapi-graphql-query": "^4.3.1",
4039
"glob": "^11.0.0",
41-
"jest": "^29.0.0",
42-
"lodash.camelcase": "^4.3.0",
43-
"lodash.set": "^4.3.2",
44-
"lodash.upperfirst": "^4.3.1",
45-
"mustache": "^4.0.0",
46-
"npm-run-all2": "^6.0.0",
4740
"prettier": "3.3.3",
4841
"semantic-release-plugin-update-version-in-files": "^1.0.0",
4942
"sinon": "^18.0.0",
5043
"sort-keys": "^5.0.0",
5144
"string-to-jsdoc-comment": "^1.0.0",
52-
"ts-jest": "^29.0.0",
53-
"typescript": "^5.0.0"
45+
"typescript": "^5.0.0",
46+
"vitest": "^2.0.3"
5447
},
5548
"peerDependencies": {
5649
"@octokit/core": ">=6"
5750
},
58-
"jest": {
59-
"extensionsToTreatAsEsm": [
60-
".ts"
61-
],
62-
"transform": {
63-
"^.+\\.(ts|tsx)$": [
64-
"ts-jest",
65-
{
66-
"tsconfig": "test/tsconfig.test.json",
67-
"useESM": true
68-
}
69-
]
70-
},
71-
"coverageThreshold": {
72-
"global": {
73-
"statements": 100,
74-
"branches": 100,
75-
"functions": 100,
76-
"lines": 100
77-
}
78-
},
79-
"moduleNameMapper": {
80-
"^(.+)\\.jsx?$": "$1"
81-
}
82-
},
8351
"release": {
8452
"branches": [
8553
"+([0-9]).x",

scripts/update-endpoints/types.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { writeFileSync, readFileSync } from "node:fs";
22
import { join as pathJoin } from "node:path";
33

4-
import camelCase from "lodash.camelcase";
4+
import camelcase from "camelcase";
55
import { format } from "prettier";
66
import { stringToJsdocComment } from "string-to-jsdoc-comment";
77
import sortKeys from "sort-keys";
@@ -39,7 +39,7 @@ async function generateTypes() {
3939
);
4040

4141
return namespaces.concat({
42-
namespace: camelCase(namespace),
42+
namespace: camelcase(namespace),
4343
methods,
4444
});
4545
}, []);

test/deprecations.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { describe, it } from "vitest";
2+
13
// There are currently no deprecated methods or parameters
24
// Use the tests below as template once there are again.
35

test/issues.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it } from "vitest";
12
import fetchMock from "fetch-mock";
23
import { Octokit } from "@octokit/core";
34

test/rest-endpoint-methods.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
12
import { Octokit } from "@octokit/core";
23
import fetchMock from "fetch-mock";
34

4-
import { jest } from "@jest/globals";
55
import sinon from "sinon";
66
import {
77
legacyRestEndpointMethods,
@@ -227,11 +227,9 @@ describe("REST API endpoint methods", () => {
227227
});
228228

229229
it("allows mocking with jest.spyOn", async () => {
230-
jest
231-
.spyOn(octokit.rest.issues, "listLabelsOnIssue")
232-
.mockResolvedValueOnce({
233-
data: [{ name: "mocked from jest" }],
234-
} as Awaited<ReturnType<typeof octokit.rest.issues.listLabelsOnIssue>>);
230+
vi.spyOn(octokit.rest.issues, "listLabelsOnIssue").mockResolvedValueOnce({
231+
data: [{ name: "mocked from jest" }],
232+
} as Awaited<ReturnType<typeof octokit.rest.issues.listLabelsOnIssue>>);
235233

236234
const jestResult = await octokit.rest.issues.listLabelsOnIssue({
237235
owner: "octokit",
@@ -240,7 +238,7 @@ describe("REST API endpoint methods", () => {
240238
});
241239
expect(jestResult.data[0].name).toBe("mocked from jest");
242240

243-
jest.restoreAllMocks();
241+
vi.restoreAllMocks();
244242
});
245243

246244
it("allows manually replacing a method", async () => {

test/smoke.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it, expect } from "vitest";
12
import { restEndpointMethods } from "../src/index.ts";
23

34
describe("Smoke test", () => {

test/typescript.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it, expect } from "vitest";
12
import { Octokit } from "@octokit/core";
23
import {
34
type RestEndpointMethodTypes,

vite.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "vite";
2+
3+
export default defineConfig({
4+
test: {
5+
coverage: {
6+
include: ["src/**/*.ts"],
7+
reporter: ["html"],
8+
thresholds: {
9+
100: false,
10+
},
11+
},
12+
},
13+
});

0 commit comments

Comments
 (0)