Skip to content

Commit

Permalink
test: migrate from Jest to Vitest (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
brenoepics authored Sep 29, 2024
1 parent 1cf20ef commit f55b71e
Show file tree
Hide file tree
Showing 15 changed files with 1,138 additions and 2,098 deletions.
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

0 comments on commit f55b71e

Please sign in to comment.