Skip to content

Commit

Permalink
test: improve test coverage reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Dec 28, 2023
1 parent 5cad6db commit 07215c8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
24 changes: 24 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
codecov:
notify:
after_n_builds: 1
strict_yaml_branch: main

coverage:
range: '50...100'
status:
project:
default:
target: auto
threshold: 5%
patch: off

flag_management:
default_rules:
statuses:
- type: project
target: auto
threshold: 2%

comment:
require_changes: true
after_n_builds: 1
23 changes: 2 additions & 21 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,9 @@ jobs:
run: yarn --immutable
- name: Run unit tests
run: yarn test --coverage
- name: Store code coverage report
uses: actions/upload-artifact@v3
with:
name: nodejs-coverage
path: coverage/

Upload_Coverage_Report:
name: Upload coverage report to codecov
needs: UnitTesting
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Download NodeJS Unit Test Coverage report
uses: actions/download-artifact@v3
with:
name: nodejs-coverage
path: coverage/
- name: Codecov Upload
uses: codecov/codecov-action@v3.1.1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/cobertura-coverage.xml
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default defineConfig({
setupFiles: ['./tests/vitest.setup.ts'],
globals: true,
coverage: {
reporter: ['text', 'lcov', 'clover'],
reporter: ['text', 'lcov', 'cobertura'],
include: ['src/lib/**'],
exclude: [
'src/lib/api',
Expand Down

0 comments on commit 07215c8

Please sign in to comment.