diff --git a/.github/workflows/coverage-badge.yml b/.github/workflows/coverage-badge.yml index 9549896..5d3a17c 100644 --- a/.github/workflows/coverage-badge.yml +++ b/.github/workflows/coverage-badge.yml @@ -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/dynamic-badges-action@v1.1.0 with: @@ -27,5 +27,5 @@ jobs: filename: vue-timeago3_coverage.json label: Test Coverage message: ${{ env.COVERAGE }} - namedLogo: jest + namedLogo: vitest color: brightgreen \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 32c93f4..79dd4a4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -26,7 +26,7 @@ export default defineConfig({ environment: "jsdom", coverage: { provider: 'v8', - reporter: ['text'], + reporter: ['text', 'json-summary'], }, }, plugins: [