From 07215c8482556f69a3a70211a5e8069e2badc7ed Mon Sep 17 00:00:00 2001 From: Jeroen Claassens Date: Thu, 28 Dec 2023 19:03:57 +0100 Subject: [PATCH] test: improve test coverage reporting --- .codecov.yml | 24 ++++++++++++++++++++ .github/workflows/continuous-integration.yml | 23 ++----------------- vitest.config.ts | 2 +- 3 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000000..22b98c05167 --- /dev/null +++ b/.codecov.yml @@ -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 diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f042b4036a6..12a44813236 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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 diff --git a/vitest.config.ts b/vitest.config.ts index d1230265c4f..7f16e09af51 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -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',