From 764a620689fa95f36bb7700888e16086b67ca8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20M=C3=B6rling?= Date: Mon, 1 Jun 2026 12:14:13 +0200 Subject: [PATCH] Enforce coverage thresholds in pre-commit via gradlew check. Wire frontendCoverage (Vitest 70%/60%/70%) into the check task chain instead of plain unit tests so commits fail when line or branch coverage drops. Document thresholds in AGENTS.md and improve pre-commit failure hints. Co-authored-by: Cursor --- AGENTS.md | 12 +++++++----- build.gradle | 7 ++++--- scripts/install-pre-commit-hook.sh | 2 +- scripts/pre-commit-check.sh | 17 ++++++++++++++--- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 0521b8d..e04a4fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,7 +37,7 @@ docker compose up -d # starts postgres, backend, frontend ### All-in-one ```bash -./gradlew check # frontend lint → frontend test → backend test+coverage → E2E (Docker) +./gradlew check # lint → frontend/backend tests with coverage thresholds → E2E (Docker) ./gradlew coverage # backend + frontend tests with coverage reports ./gradlew up # docker compose up -d ./gradlew down # docker compose down @@ -170,10 +170,12 @@ export STRIPE_SECRET_KEY=sk_test_fake STRIPE_WEBHOOK_SECRET=whsec_fake STRIPE_PR ./gradlew check ``` -This runs frontend lint, frontend unit tests (242), backend tests (163), coverage -thresholds, Flyway checks, and **all 90 E2E tests in Docker**. **Do not commit or -push if this fails.** Optional local guard: `./scripts/install-pre-commit-hook.sh` -(runs the same `check` on every `git commit`). +This runs frontend lint, frontend unit tests **with Vitest coverage thresholds** +(70% lines, 60% branches, 70% functions), backend tests with **JaCoCo thresholds** +(70% lines, 60% branches), Flyway checks, and **all 90 E2E tests in Docker**. +**Do not commit or push if this fails.** Optional local guard: +`./scripts/install-pre-commit-hook.sh` (runs the same `check` on every `git commit`; +fails if line or branch coverage is below threshold). ### Frontend (Vue.js 3) - `