From 8529c4dfa8d2dfc0ee543b29149471b7055d9a63 Mon Sep 17 00:00:00 2001 From: Andrey Ponomarev Date: Mon, 3 Feb 2025 11:35:31 +0300 Subject: [PATCH] 65 ci enforce test coverage threshold (#66) Enforce test coverage threshold --- api/jest.config.json | 13 ++++++++++++- api/package.json | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/api/jest.config.json b/api/jest.config.json index 8543b1f..6dba7cc 100644 --- a/api/jest.config.json +++ b/api/jest.config.json @@ -12,5 +12,16 @@ "resetMocks": true, "restoreMocks": true, "extensionsToTreatAsEsm": [".ts"], - "setupFilesAfterEnv": ["jest-extended/all"] + "setupFilesAfterEnv": ["jest-extended/all"], + + "collectCoverage": true, + "collectCoverageFrom": ["src/**/*.ts", "src/**/*.tsx", "!**/src/open-api/**"], + "coverageThreshold": { + "global": { + "branches": 7, + "functions": 1, + "lines": 7, + "statements": 6 + } + } } diff --git a/api/package.json b/api/package.json index b07cb39..45720a9 100644 --- a/api/package.json +++ b/api/package.json @@ -6,8 +6,8 @@ "scripts": { "build": "tsc -p ./tsconfig.json", "serve:dev": "nodemon --watch ./src -e ts,json --exec 'TS_NODE_PROJECT=tsconfig.json node --inspect=0.0.0.0:9229 --require ts-node/register ./src/index.ts'", - "test:unit": "jest --testMatch='**/*.unit.test.ts' --verbose --detectOpenHandles --colors", - "test:int": "jest --testMatch='**/*.int.test.ts' --verbose --detectOpenHandles --runInBand --colors ./tests-integration", + "test:unit": "jest --verbose --detectOpenHandles --colors ./src", + "test:int": "jest --verbose --detectOpenHandles --runInBand --colors ./tests-integration", "test:e2e-api": "jest ./tests-e2e-api --verbose --detectOpenHandles --runInBand --colors", "test:coverage": "jest --coverage", "test:clearjest": "jest --clearCache",