From a4c3fd45bc697bacb064f93de219f7d9b463285b Mon Sep 17 00:00:00 2001 From: Aubrey Quinn Date: Fri, 27 Sep 2024 22:05:48 +0100 Subject: [PATCH] added code coverage threasholds --- .github/workflows/node.js.yml | 8 +++++--- jest.config.js | 11 ++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index d94fb06..7e01dff 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - name: Node.js CI on: @@ -20,12 +17,17 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: "npm" + - run: npm ci - run: npm run build --if-present - run: npm run lint --if-present - run: npm test + + - name: Run tests with coverage + run: npm run test:coverage diff --git a/jest.config.js b/jest.config.js index 55877bf..111be7a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,5 +5,14 @@ module.exports = { preset: "ts-jest", testEnvironment: "node", testMatch: ["**/tests/**/*.test.ts"], - verbose: true + verbose: true, + collectCoverage: true, + coverageThreshold: { + global: { + branches: 80, + functions: 80, + lines: 80, + statements: 80 + } + } };