Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: modernize dependencies #761

Merged
merged 7 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
},
},
},
});