Skip to content

Commit

Permalink
Replace jest with vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
rubengees committed Nov 5, 2023
1 parent 2be5e9d commit 615c2db
Show file tree
Hide file tree
Showing 9 changed files with 457 additions and 1,853 deletions.
7 changes: 3 additions & 4 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
project: "tsconfig.json",
},
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "jest", "prettier"],
plugins: ["@typescript-eslint", "prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
Expand All @@ -14,8 +14,7 @@ module.exports = {
],
rules: {
"prettier/prettier": "error",
"jest/unbound-method": "error",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/restrict-template-expressions": "off"
}
"@typescript-eslint/restrict-template-expressions": "off",
},
}
8 changes: 0 additions & 8 deletions jest.config.ts

This file was deleted.

12 changes: 4 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"start": "ts-node src/index.ts",
"build": "ncc build src/index.ts --license LICENSE.txt --minify",
"lint": "eslint --max-warnings 0 .",
"test": "jest",
"test": "vitest run",
"verify": "yarn lint && yarn test"
},
"dependencies": {
Expand All @@ -25,22 +25,18 @@
"semver": "^7.3.8"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^20.8.10",
"@types/semver": "^7.3.13",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"@vercel/ncc": "^0.36.1",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"jest-mock": "^29.5.0",
"jest-mock-extended": "^3.0.4",
"prettier": "^2.8.7",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.3"
"typescript": "^5.0.3",
"vitest": "^0.34.6",
"vitest-mock-extended": "^1.3.1"
}
}
3 changes: 2 additions & 1 deletion test/action.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { mock } from "jest-mock-extended"
import { Range } from "semver"
import { test, expect } from "vitest"
import { mock } from "vitest-mock-extended"
import { executeAction } from "../src/action"
import { DeleteStrategy, Input, PackageType, QueryStrategy } from "../src/types"

Expand Down
1 change: 1 addition & 0 deletions test/delete/delete.strategy.factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, test } from "vitest"
import { decideDeleteStrategy } from "../../src/delete/delete.strategy.factory"
import OrganizationDeleteStrategy from "../../src/delete/strategies/organization.delete.strategy"
import UserDeleteStrategy from "../../src/delete/strategies/user.delete.strategy"
Expand Down
3 changes: 2 additions & 1 deletion test/input.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Range } from "semver"
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
import { getActionInput, validateInput } from "../src/input"
import { Input, PackageType } from "../src/types"

describe("getActionInput", () => {
const env = process.env

beforeEach(() => {
jest.resetModules()
vi.resetModules()
})

afterEach(() => {
Expand Down
3 changes: 2 additions & 1 deletion test/process/process.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types"
import { Range } from "semver"
import { expect, test } from "vitest"
import { processPackages, processResponse } from "../../src/process/process"
import { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types"
import { PackageType } from "../../src/types"

test("filters correctly", () => {
Expand Down
3 changes: 2 additions & 1 deletion test/query/query.strategy.factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, test } from "vitest"
import { decideQueryStrategy } from "../../src/query/query.strategy.factory"
import UserQueryStrategy from "../../src/query/strategies/user.query.strategy"
import OrganizationQueryStrategy from "../../src/query/strategies/organization.query.strategy"
import UserQueryStrategy from "../../src/query/strategies/user.query.strategy"
import { Input, PackageType } from "../../src/types"

test("decide user query strategy", () => {
Expand Down
Loading

0 comments on commit 615c2db

Please sign in to comment.