Skip to content

Commit

Permalink
chore: use vitest (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored Jul 14, 2024
1 parent eaa159d commit f8f0848
Show file tree
Hide file tree
Showing 10 changed files with 2,314 additions and 6,280 deletions.
7,748 changes: 1,893 additions & 5,855 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 4 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lint": "prettier --check '{src,scripts,test}/**/*' '!*/generated/**' README.md package.json",
"lint:fix": "prettier --write '{src,scripts,test}/**/*' '!*/generated/**' README.md package.json",
"pretest": "npm run -s lint",
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" npx jest --coverage",
"test": "vitest run --coverage",
"update-endpoints": "npm-run-all update-endpoints:*",
"update-endpoints:fetch-json": "node scripts/update-endpoints/fetch-json.js",
"update-endpoints:code": "node scripts/update-endpoints/code.js",
Expand All @@ -32,43 +32,17 @@
"@octokit/core": "^6.0.0",
"@octokit/request-error": "^6.0.1",
"@octokit/tsconfig": "^3.0.0",
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
"@vitest/coverage-v8": "^2.0.2",
"esbuild": "^0.23.0",
"fetch-mock": "^10.0.0",
"github-openapi-graphql-query": "^4.0.0",
"glob": "^10.2.6",
"jest": "^29.0.0",
"npm-run-all2": "^6.0.0",
"prettier": "3.3.3",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.0.0"
},
"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"
}
"typescript": "^5.0.0",
"vitest": "^2.0.2"
},
"release": {
"branches": [
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Octokit } from "@octokit/core";
import type { Octokit } from "@octokit/core";
import type { EndpointDefaults } from "@octokit/types";
import Bottleneck from "bottleneck";
import type Bottleneck from "bottleneck";

type LimitHandler = (
retryAfter: number,
Expand Down
1 change: 1 addition & 0 deletions test/deprecations.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "vitest";
// Linting in `npm run test` complains when this isn't used.
// In the future when conducting deprecation testing, the below
// lines may be uncommented.
Expand Down
4 changes: 2 additions & 2 deletions test/events.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TestOctokit } from "./octokit.ts";
import { jest } from "@jest/globals";
import { describe, it, expect, vi } from "vitest";

describe("Events", function () {
it("Should support non-limit 403s", async function () {
Expand Down Expand Up @@ -190,7 +190,7 @@ describe("Events", function () {
},
});

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

const t0 = Date.now();

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

Expand Down
1 change: 1 addition & 0 deletions test/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it, expect } from "vitest";
import Bottleneck from "bottleneck";
import { TestOctokit } from "./octokit.ts";
import { throttling } from "../src/index.ts";
Expand Down
Loading

0 comments on commit f8f0848

Please sign in to comment.