From 5cd967b5357c27d3dd1aecdcbe165415d93791e5 Mon Sep 17 00:00:00 2001 From: Jordan Simonovski Date: Thu, 16 Jul 2026 12:14:36 +1000 Subject: [PATCH] ci(test): enforce coverage floors at current levels Pin Jest coverageThreshold in the unit configs for app, common-utils and hdx-eval to just below each package's measured coverage (measured minus one, rounded down). Coverage can now only ratchet upwards: any decay below these floors fails the build, so the floors rise only when someone raises them deliberately. Also add --coverage to hdx-eval's ci:unit so its threshold is actually collected and enforced. Integration configs are left untouched. The API unit config is deferred to a follow-up until the API unit/int split (#2653) lands. --- packages/app/jest.config.js | 11 +++++++++++ packages/common-utils/jest.config.js | 11 +++++++++++ packages/hdx-eval/jest.config.js | 11 +++++++++++ packages/hdx-eval/package.json | 2 +- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/packages/app/jest.config.js b/packages/app/jest.config.js index 8691792362..c018531c3b 100644 --- a/packages/app/jest.config.js +++ b/packages/app/jest.config.js @@ -25,4 +25,15 @@ module.exports = { '^ky$': '/src/__mocks__/ky-universal.ts', }, setupFilesAfterEnv: ['/src/setupTests.tsx'], + // Coverage floor pinned just below measured reality so coverage can only + // ratchet up. Decay below these numbers fails the build. Raise them + // deliberately as coverage improves; never lower them silently. + coverageThreshold: { + global: { + statements: 53, + branches: 37, + functions: 38, + lines: 54, + }, + }, }; diff --git a/packages/common-utils/jest.config.js b/packages/common-utils/jest.config.js index 3af5ab5353..dc20747d91 100644 --- a/packages/common-utils/jest.config.js +++ b/packages/common-utils/jest.config.js @@ -15,4 +15,15 @@ module.exports = { moduleNameMapper: { '@/(.*)$': '/$1', }, + // Coverage floor pinned just below measured reality so coverage can only + // ratchet up. Decay below these numbers fails the build. Raise them + // deliberately as coverage improves; never lower them silently. + coverageThreshold: { + global: { + statements: 86, + branches: 78, + functions: 85, + lines: 86, + }, + }, }; diff --git a/packages/hdx-eval/jest.config.js b/packages/hdx-eval/jest.config.js index 4bdc2f8362..f184265f85 100644 --- a/packages/hdx-eval/jest.config.js +++ b/packages/hdx-eval/jest.config.js @@ -12,4 +12,15 @@ module.exports = { moduleNameMapper: { '@/(.*)$': '/$1', }, + // Coverage floor pinned just below measured reality so coverage can only + // ratchet up. Decay below these numbers fails the build. Raise them + // deliberately as coverage improves; never lower them silently. + coverageThreshold: { + global: { + statements: 70, + branches: 55, + functions: 72, + lines: 71, + }, + }, }; diff --git a/packages/hdx-eval/package.json b/packages/hdx-eval/package.json index 7550f4665e..03e64bddbc 100644 --- a/packages/hdx-eval/package.json +++ b/packages/hdx-eval/package.json @@ -36,7 +36,7 @@ "lint": "npx eslint --quiet . --ext .ts", "lint:fix": "npx eslint . --ext .ts --fix", "ci:lint": "yarn lint && yarn tsc --noEmit", - "ci:unit": "jest --ci --forceExit", + "ci:unit": "jest --ci --coverage --forceExit", "dev:unit": "jest --watch", "viewer": "node scripts/viewer/server.js" }