From ec62c5ed5eca8c246589b5b7da8f9c98fd805829 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela <90895835+vishvamsinh28@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:15:09 +0530 Subject: [PATCH] feat: add codecov to the project (#3168) Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com>%0ACo-authored-by: Ansh Goyal %0ACo-authored-by: asyncapi-bot --- .github/workflows/if-nodejs-pr-testing.yml | 10 ++++++++++ jest.config.js | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/if-nodejs-pr-testing.yml b/.github/workflows/if-nodejs-pr-testing.yml index 2154143339c..c50814a4a17 100644 --- a/.github/workflows/if-nodejs-pr-testing.yml +++ b/.github/workflows/if-nodejs-pr-testing.yml @@ -60,6 +60,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: "${{ steps.nodeversion.outputs.version }}" + - name: Install dependencies run: npm ci - if: steps.packagejson.outputs.exists == 'true' @@ -72,3 +73,12 @@ jobs: name: Run release assets generation to make sure PR does not break it shell: bash run: npm run generate:assets --if-present + + - if: steps.packagejson.outputs.exists == 'true' + name: Upload Coverage to Codecov + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 + with: + fail_ci_if_error: true + files: ./coverage/lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true diff --git a/jest.config.js b/jest.config.js index 25c7865434e..9d370a6bb76 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,9 @@ module.exports = { verbose: true, collectCoverage: true, + coverageReporters: ['text', 'lcov', 'json-summary'], + coverageDirectory: 'coverage', collectCoverageFrom: ['scripts/**/*.js'], // To disallow netlify edge function tests from running testMatch: ['**/tests/**/*.test.*', '!**/netlify/**/*.test.*'], -}; +}; \ No newline at end of file