Skip to content

Commit

Permalink
chore(ci): enable coverage action
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmanchhabra committed Jun 27, 2024
1 parent f12710a commit cb428d0
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,20 @@ jobs:
run: npm run lint
- name: Test codebase
run: npm run test
cov:
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Setup Volta
uses: volta-cli/action@v4.1.1
- name: Install dependencies
run: npm ci
- name: Enable Coverage
run: npm run test:cov
- name: Report Coverage
if: always()
uses: davelosert/vitest-coverage-report-action@v2.4.0
246 changes: 246 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"scripts": {
"lint": "eslint --config=.github/eslint.config.cjs ./src/**/*.ts",
"build": "tsup src/index.ts --minify --format cjs,esm --dts --clean",
"test": "vitest"
"test": "vitest",
"test:cov": "vitest --coverage.enabled true"
},
"keywords": [
"JSX",
Expand All @@ -40,6 +41,7 @@
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"@vitest/coverage-v8": "^1.6.0",
"esbuild": "~0.21.5",
"eslint": "^8.57.0",
"jsdom": "^24.1.0",
Expand Down
5 changes: 5 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { defineConfig } from 'vite'

export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['json', 'json-summary'],
reportOnFailure: true,
},
globals: true,
environment: 'jsdom',
setupFiles: './test/setup.ts',
Expand Down

0 comments on commit cb428d0

Please sign in to comment.