Skip to content

Commit

Permalink
chore(testing): Add TEST_ANALYTICS check and switch to Codecov uploads
Browse files Browse the repository at this point in the history
In `vitest.config.ts`, added conditional logic to use JUnit reporting when `TEST_ANALYTICS` is set, and specified an output file for the JUnit report. In the GitHub Actions workflow, switched from Codacy to Codecov for uploading coverage reports and added a step to upload test results with JUnit output. These updates aim to improve test analytics and integration with Codecov.
  • Loading branch information
hckhanh committed Dec 2, 2024
1 parent db46b6c commit e76fdb6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,18 @@ jobs:
run: pnpm test -- --coverage.enabled
env:
GOOGLE_SAFE_BROWSING_API_KEY: ${{ secrets.GOOGLE_SAFE_BROWSING_API_KEY }}
- name: Update coverage report
uses: codacy/codacy-coverage-reporter-action@a38818475bb21847788496e9f0fddaa4e84955ba
TEST_ANALYTICS: 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a
if: ${{ github.actor != 'renovate[bot]' }}
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ github.actor != 'renovate[bot]' && !cancelled() }}
uses: codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: 'coverage/junit.xml'
deno:
name: Deno
needs: lints
Expand Down
5 changes: 4 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default defineConfig({
reporter: process.env.CI ? ['clover'] : coverageConfigDefaults.reporter,
},
reporters: process.env.CI
? ['dot', 'github-actions']
? process.env.TEST_ANALYTICS
? ['junit', 'dot', 'github-actions']
: ['dot', 'github-actions']
: configDefaults.reporters,
outputFile: 'coverage/junit.xml',
},
})

0 comments on commit e76fdb6

Please sign in to comment.