Skip to content

Commit

Permalink
test: use Vitest instead of Jest (#86)
Browse files Browse the repository at this point in the history
* test: use vitest instead of jest

* ci: add unit tests workflow

* ci: up actions versions

* style: apply prettier

* build: bump ts version

* build: get rid of bun

* chore: delete bun lockfile
  • Loading branch information
pure-js authored Mar 23, 2024
1 parent 034c792 commit c455659
Show file tree
Hide file tree
Showing 14 changed files with 3,223 additions and 8,167 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env:
extends:
- love
- plugin:react/recommended
- plugin:react/jsx-runtime
- prettier
parserOptions:
ecmaVersion: latest
Expand All @@ -14,4 +15,3 @@ plugins:
- prettier
rules:
'@typescript-eslint/explicit-function-return-type': 'off'
'react/react-in-jsx-scope': 'off'
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
node-version: [20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/deploy-nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
- name: Restore cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
.next/cache
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Build with Next.js
run: pnpm exec next build
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: ./out

Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/lint-bun.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ name: Code Linting
on: push

jobs:
eslint:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Unit Tests

on: push

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Unit tests
run: pnpm test
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
coverage/*
CHANGELOG.md
pnpm-lock.yaml
Binary file removed bun.lockb
Binary file not shown.
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"build": "next build",
"start": "next start",
"predeploy": "npm run build",
"deploy": "gh-pages -d out",
"test": "jest",
"lint": "eslint --ext .js,.jsx,.ts,.tsx src/",
"test": "vitest",
"lint": "eslint --ext .js,.jsx,.ts,.tsx src/ app/",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"format:check": "prettier --check ."
Expand All @@ -34,7 +33,6 @@
"@storybook/react": "^7.0.27",
"@storybook/testing-library": "^0.2.0",
"@trivago/prettier-plugin-sort-imports": "~4.3.0",
"@types/jest": "^29.5.3",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@typescript-eslint/eslint-plugin": "^6.4.0",
Expand All @@ -49,15 +47,13 @@
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "~7.34.1",
"eslint-plugin-storybook": "^0.6.12",
"gh-pages": "^6.0.0",
"jest": "^29.6.1",
"prettier": "3.2.5",
"prettier-plugin-css-order": "2.0.1",
"storybook": "^7.1.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.1.6",
"typescript-plugin-css-modules": "5.0.2"
"typescript": "^5.2.2",
"typescript-plugin-css-modules": "5.0.2",
"vitest": "~1.4.0"
},
"peerDependencies": {
"@types/node": "^18.18.0"
Expand Down
Loading

0 comments on commit c455659

Please sign in to comment.