Skip to content

Commit

Permalink
ci: fix code coverage badge generation (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0dr1y authored Oct 24, 2023
1 parent 343a90a commit cb9b289
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/coverage-badge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: "14"
node-version: "18"
cache: "npm"
- name: Install dependencies
run: npm install
- name: Run unit tests with coverage
run: |
SUMMARY="$(npm coverage | tail -2 | head -1)"
TOKENS=($SUMMARY)
echo "COVERAGE=$(echo ${TOKENS[2]})" >> $GITHUB_ENV
npm run coverage
STATEMENTS=$(cat coverage/coverage-summary.json | jq -r '.total.statements.pct')
echo "COVERAGE=$(echo ${STATEMENTS}%)" >> $GITHUB_ENV
- name: Create Coverage Badge
uses: schneegans/[email protected]
with:
Expand All @@ -27,5 +27,5 @@ jobs:
filename: vue-timeago3_coverage.json
label: Test Coverage
message: ${{ env.COVERAGE }}
namedLogo: jest
namedLogo: vitest
color: brightgreen
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default defineConfig({
environment: "jsdom",
coverage: {
provider: 'v8',
reporter: ['text'],
reporter: ['text', 'json-summary'],
},
},
plugins: [
Expand Down

0 comments on commit cb9b289

Please sign in to comment.