Skip to content

Commit

Permalink
chore: modernize dependencies (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Jul 18, 2024
1 parent 89d588a commit 297f03a
Show file tree
Hide file tree
Showing 9 changed files with 2,161 additions and 4,446 deletions.
6,527 changes: 2,129 additions & 4,398 deletions package-lock.json

Large diffs are not rendered by default.

46 changes: 7 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"lint": "prettier --check '{src,test,scripts}/**/*' '!scripts/update-endpoints/generated/**' '!src/generated/**' README.md package.json",
"lint:fix": "prettier --write '{src,test,scripts}/**/*' '!scripts/update-endpoints/generated/**' '!src/generated/**' README.md package.json",
"pretest": "npm run -s lint",
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest --coverage",
"update-endpoints": "npm-run-all update-endpoints:*",
"test": "vitest run --coverage",
"update-endpoints": "npm run update-endpoints:fetch-json && npm run update-endpoints:code && npm run update-endpoints:docs && npm run update-endpoints:types",
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json.mjs",
"update-endpoints:code": "node scripts/update-endpoints/code.mjs",
"update-endpoints:docs": "node scripts/update-endpoints/docs.mjs",
Expand All @@ -30,56 +30,24 @@
"devDependencies": {
"@octokit/core": "^6.0.0",
"@octokit/tsconfig": "^3.0.0",
"@types/fetch-mock": "^7.3.1",
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
"@types/sinon": "^17.0.0",
"@vitest/coverage-v8": "^2.0.3",
"camelcase": "^8.0.0",
"esbuild": "^0.23.0",
"fetch-mock": "npm:@gr2m/fetch-mock@^9.11.0-pull-request-644.1",
"fetch-mock": "^10.0.0",
"github-openapi-graphql-query": "^4.3.1",
"glob": "^11.0.0",
"jest": "^29.0.0",
"lodash.camelcase": "^4.3.0",
"lodash.set": "^4.3.2",
"lodash.upperfirst": "^4.3.1",
"mustache": "^4.0.0",
"npm-run-all2": "^6.0.0",
"prettier": "3.3.3",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"sinon": "^18.0.0",
"sort-keys": "^5.0.0",
"string-to-jsdoc-comment": "^1.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.0.0"
"typescript": "^5.0.0",
"vitest": "^2.0.3"
},
"peerDependencies": {
"@octokit/core": ">=6"
},
"jest": {
"extensionsToTreatAsEsm": [
".ts"
],
"transform": {
"^.+\\.(ts|tsx)$": [
"ts-jest",
{
"tsconfig": "test/tsconfig.test.json",
"useESM": true
}
]
},
"coverageThreshold": {
"global": {
"statements": 100,
"branches": 100,
"functions": 100,
"lines": 100
}
},
"moduleNameMapper": {
"^(.+)\\.jsx?$": "$1"
}
},
"release": {
"branches": [
"+([0-9]).x",
Expand Down
4 changes: 2 additions & 2 deletions scripts/update-endpoints/types.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { writeFileSync, readFileSync } from "node:fs";
import { join as pathJoin } from "node:path";

import camelCase from "lodash.camelcase";
import camelcase from "camelcase";
import { format } from "prettier";
import { stringToJsdocComment } from "string-to-jsdoc-comment";
import sortKeys from "sort-keys";
Expand Down Expand Up @@ -39,7 +39,7 @@ async function generateTypes() {
);

return namespaces.concat({
namespace: camelCase(namespace),
namespace: camelcase(namespace),
methods,
});
}, []);
Expand Down
2 changes: 2 additions & 0 deletions test/deprecations.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it } from "vitest";

// There are currently no deprecated methods or parameters
// Use the tests below as template once there are again.

Expand Down
1 change: 1 addition & 0 deletions test/issues.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "vitest";
import fetchMock from "fetch-mock";
import { Octokit } from "@octokit/core";

Expand Down
12 changes: 5 additions & 7 deletions test/rest-endpoint-methods.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { Octokit } from "@octokit/core";
import fetchMock from "fetch-mock";

import { jest } from "@jest/globals";
import sinon from "sinon";
import {
legacyRestEndpointMethods,
Expand Down Expand Up @@ -227,11 +227,9 @@ describe("REST API endpoint methods", () => {
});

it("allows mocking with jest.spyOn", async () => {
jest
.spyOn(octokit.rest.issues, "listLabelsOnIssue")
.mockResolvedValueOnce({
data: [{ name: "mocked from jest" }],
} as Awaited<ReturnType<typeof octokit.rest.issues.listLabelsOnIssue>>);
vi.spyOn(octokit.rest.issues, "listLabelsOnIssue").mockResolvedValueOnce({
data: [{ name: "mocked from jest" }],
} as Awaited<ReturnType<typeof octokit.rest.issues.listLabelsOnIssue>>);

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

jest.restoreAllMocks();
vi.restoreAllMocks();
});

it("allows manually replacing a method", async () => {
Expand Down
1 change: 1 addition & 0 deletions test/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from "vitest";
import { restEndpointMethods } from "../src/index.ts";

describe("Smoke test", () => {
Expand Down
1 change: 1 addition & 0 deletions test/typescript.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from "vitest";
import { Octokit } from "@octokit/core";
import {
type RestEndpointMethodTypes,
Expand Down
13 changes: 13 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "vite";

export default defineConfig({
test: {
coverage: {
include: ["src/**/*.ts"],
reporter: ["html"],
thresholds: {
100: false,
},
},
},
});

0 comments on commit 297f03a

Please sign in to comment.