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

test: migrate from Jest to Vitest #25

Merged
merged 19 commits into from
Sep 29, 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
19 changes: 6 additions & 13 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked", // Enable type checking, max strictness
"plugin:prettier/recommended" // prettier rules
"plugin:@typescript-eslint/strict-type-checked",
"plugin:prettier/recommended"
],

parser: "@typescript-eslint/parser",

parserOptions: {
project: true,
project: ["./tsconfig.json", "./tsconfig.eslint.json"],
tsconfigRootDir: __dirname
},

plugins: ["@typescript-eslint"],

root: true,

ignorePatterns: [
".eslintrc.js",
"*.spec.ts",
Expand All @@ -24,15 +19,13 @@ module.exports = {
"coverage/",
"lib/",
"pnpm-lock.yaml",
".pnpm-store/"
], // ESLINT IGNORE

".pnpm-store/",
"vitest.config.js"
],
env: {
// ESLINT ENV
node: true,
jest: true
},

rules: {
"no-else-return": ["error", { allowElseIf: false }],
"consistent-return": "error",
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pnpm preflight
# Check if there are any changes in the dist/ directory
if [ -n "$(git status dist/ --porcelain)" ]; then
git add dist/
git commit -m "chore: update dist"
git commit -m "chore: bump dist" --no-verify
else
echo "No changes in dist/ to commit."
fi
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ __tests__/
badges/
script/
pnpm-lock.yaml
.eslintrc.js
*.md
*.md
vitest.config.ts
10 changes: 6 additions & 4 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
describe('index.ts tests', () => {
it('should pass', () => {
expect(true).toBe(true);
});
import { describe, it, expect } from "vitest";

describe("example", () => {
it("should pass", () => {
expect(true).toBe(true);
});
});
5 changes: 2 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144854,14 +144854,13 @@ async function deleteOldComments(octokit, owner, repo, pull_number) {
});
}
}
async function commentOnPullRequest(commentBody) {
async function commentOnPullRequest(commentBody, token = core.getInput("github-token")) {
if (!lib_github.context.payload.pull_request) {
throw new Error("No pull request found in the context!");
}
if (core.getInput("github-token") === "") {
if (token === "") {
throw new Error("Could not add a comment to pull request because github-token is missing!");
}
const token = core.getInput("github-token");
const octokit = lib_github.getOctokit(token);
const { owner, repo } = lib_github.context.repo;
const pull_number = lib_github.context.payload.pull_request.number;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading