From 6f28ca09d9afbeffa440b339aaa85527f422419e Mon Sep 17 00:00:00 2001 From: Harley Harris Date: Fri, 5 Jan 2024 11:00:26 +0000 Subject: [PATCH] add jest coverage threshold check in prepush and github action coverage table --- .github/workflows/jest-coverage-report.yml | 15 +++++++++++++++ .husky/pre-push | 2 +- jest.config.js | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/jest-coverage-report.yml diff --git a/.github/workflows/jest-coverage-report.yml b/.github/workflows/jest-coverage-report.yml new file mode 100644 index 0000000..fb00fdd --- /dev/null +++ b/.github/workflows/jest-coverage-report.yml @@ -0,0 +1,15 @@ +name: Jest Coverage Report + +on: [pull_request] + +jobs: + jest-coverage-report: + + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Coverage Report + uses: ArtiomTr/jest-coverage-report-action@v2 \ No newline at end of file diff --git a/.husky/pre-push b/.husky/pre-push index 879e935..a155e38 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -npm run test +npm run coverage diff --git a/jest.config.js b/jest.config.js index 1b15123..b0dd6e0 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,6 +2,11 @@ module.exports = { roots: ['/src', '/test'], testPathIgnorePatterns: ['/node_modules/', '/lib/'], collectCoverageFrom: ['./src/**/*.ts'], + coverageThreshold: { + global: { + lines: 95, + }, + }, preset: 'ts-jest', testEnvironment: 'node', verbose: true,