Skip to content

Commit f8f0848

Browse files
authored
chore: use vitest (#720)
1 parent eaa159d commit f8f0848

10 files changed

+2314
-6280
lines changed

package-lock.json

+1,893-5,855
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-30
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"lint": "prettier --check '{src,scripts,test}/**/*' '!*/generated/**' README.md package.json",
1313
"lint:fix": "prettier --write '{src,scripts,test}/**/*' '!*/generated/**' README.md package.json",
1414
"pretest": "npm run -s lint",
15-
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest --coverage",
15+
"test": "vitest run --coverage",
1616
"update-endpoints": "npm-run-all update-endpoints:*",
1717
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json.js",
1818
"update-endpoints:code": "node scripts/update-endpoints/code.js",
@@ -32,43 +32,17 @@
3232
"@octokit/core": "^6.0.0",
3333
"@octokit/request-error": "^6.0.1",
3434
"@octokit/tsconfig": "^3.0.0",
35-
"@types/jest": "^29.0.0",
3635
"@types/node": "^20.0.0",
36+
"@vitest/coverage-v8": "^2.0.2",
3737
"esbuild": "^0.23.0",
3838
"fetch-mock": "^10.0.0",
3939
"github-openapi-graphql-query": "^4.0.0",
4040
"glob": "^10.2.6",
41-
"jest": "^29.0.0",
4241
"npm-run-all2": "^6.0.0",
4342
"prettier": "3.3.3",
4443
"semantic-release-plugin-update-version-in-files": "^1.0.0",
45-
"ts-jest": "^29.0.0",
46-
"typescript": "^5.0.0"
47-
},
48-
"jest": {
49-
"extensionsToTreatAsEsm": [
50-
".ts"
51-
],
52-
"transform": {
53-
"^.+\\.(ts|tsx)$": [
54-
"ts-jest",
55-
{
56-
"tsconfig": "test/tsconfig.test.json",
57-
"useESM": true
58-
}
59-
]
60-
},
61-
"coverageThreshold": {
62-
"global": {
63-
"statements": 100,
64-
"branches": 100,
65-
"functions": 100,
66-
"lines": 100
67-
}
68-
},
69-
"moduleNameMapper": {
70-
"^(.+)\\.jsx?$": "$1"
71-
}
44+
"typescript": "^5.0.0",
45+
"vitest": "^2.0.2"
7246
},
7347
"release": {
7448
"branches": [

src/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Octokit } from "@octokit/core";
1+
import type { Octokit } from "@octokit/core";
22
import type { EndpointDefaults } from "@octokit/types";
3-
import Bottleneck from "bottleneck";
3+
import type Bottleneck from "bottleneck";
44

55
type LimitHandler = (
66
retryAfter: number,

test/deprecations.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it } from "vitest";
12
// Linting in `npm run test` complains when this isn't used.
23
// In the future when conducting deprecation testing, the below
34
// lines may be uncommented.

test/events.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TestOctokit } from "./octokit.ts";
2-
import { jest } from "@jest/globals";
2+
import { describe, it, expect, vi } from "vitest";
33

44
describe("Events", function () {
55
it("Should support non-limit 403s", async function () {
@@ -190,7 +190,7 @@ describe("Events", function () {
190190
},
191191
});
192192

193-
jest.spyOn(octokit.log, "warn").mockImplementation(() => {});
193+
vi.spyOn(octokit.log, "warn").mockImplementation(() => {});
194194

195195
const t0 = Date.now();
196196

test/exports.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it } from "vitest";
12
import type { ThrottlingOptions } from "../src/index.ts";
23
import type { Octokit } from "@octokit/core";
34

test/plugin.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it, expect } from "vitest";
12
import Bottleneck from "bottleneck";
23
import { TestOctokit } from "./octokit.ts";
34
import { throttling } from "../src/index.ts";

0 commit comments

Comments
 (0)