Skip to content

Commit

Permalink
add test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
yukukotani committed Oct 19, 2024
1 parent cb734fa commit b1df953
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Lint

on:
pull_request:
push:
branches:
- main

jobs:
quality:
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: TypeCheck

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: pnpm install
shell: bash
run: |
pnpm install --frozen-lockfile
- name: Run test
run: pnpm run test:coverage
- name: Show coverage
if: ${{ always() && github.event_name == 'pull_request' }}
uses: davelosert/vitest-coverage-report-action@v2
3 changes: 3 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: TypeCheck

on:
pull_request:
push:
branches:
- main

jobs:
type-check:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/

dist/
coverage/
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"fix": "biome check --write ./",
"test": "vitest run",
"test:watch": "vitest --watch",
"test:coverage": "vitest run --coverage.enabled true",
"prepublish": "pnpm run build"
},
"dependencies": {
Expand All @@ -34,6 +35,7 @@
"@types/react": "^18",
"@types/react-dom": "^18",
"@vitejs/plugin-react": "^4.3.2",
"@vitest/coverage-v8": "2.1.2",
"jsdom": "^25.0.1",
"react": "19.0.0-rc-f994737d14-20240522",
"react-dom": "19.0.0-rc-f994737d14-20240522",
Expand Down
119 changes: 119 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ export default defineConfig({
setupFiles: "./vitest.setup.ts",
globals: true,
environment: "jsdom",
coverage: {
reporter: ["text", "json-summary", "json"],
reportOnFailure: true,
},
},
});

0 comments on commit b1df953

Please sign in to comment.