From 8cccf74acea2098ad6b066986ef87b33abb3b94d Mon Sep 17 00:00:00 2001 From: Kacper Date: Sat, 20 Dec 2025 23:12:45 +0100 Subject: [PATCH] test: Add and improve coverage thresholds across packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added coverage thresholds to all shared lib packages and increased server thresholds to ensure better code quality and confidence. Lib package thresholds: - dependency-resolver: 90% stmts/lines, 85% branches, 100% funcs - git-utils: 65% stmts/lines, 35% branches, 75% funcs - utils: 15% stmts/lines/funcs, 25% branches (only error-handler tested) - platform: 60% stmts/lines/branches, 40% funcs (only subprocess tested) Server thresholds increased: - From: 55% lines, 50% funcs, 50% branches, 55% stmts - To: 60% lines, 75% funcs, 55% branches, 60% stmts - Current actual: 64% lines, 78% funcs, 56% branches, 64% stmts All tests passing with new thresholds. Lower thresholds on utils and platform reflect that only some files have tests currently. These will be increased as more tests are added. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- apps/server/vitest.config.ts | 12 ++++++------ libs/dependency-resolver/vitest.config.ts | 21 +++++++++++++++++++++ libs/git-utils/vitest.config.ts | 21 +++++++++++++++++++++ libs/platform/vitest.config.ts | 10 ++++++++++ libs/utils/vitest.config.ts | 23 +++++++++++++++++++++++ 5 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 libs/dependency-resolver/vitest.config.ts create mode 100644 libs/git-utils/vitest.config.ts create mode 100644 libs/utils/vitest.config.ts diff --git a/apps/server/vitest.config.ts b/apps/server/vitest.config.ts index faeecd98..aae12c78 100644 --- a/apps/server/vitest.config.ts +++ b/apps/server/vitest.config.ts @@ -17,12 +17,12 @@ export default defineConfig({ "src/routes/**", // Routes are better tested with integration tests ], thresholds: { - // Thresholds lowered after moving lib files to shared packages - // TODO: Gradually increase as we add more tests - lines: 55, - functions: 50, - branches: 50, - statements: 55, + // Increased thresholds to ensure better code quality + // Current coverage: 64% stmts, 56% branches, 78% funcs, 64% lines + lines: 60, + functions: 75, + branches: 55, + statements: 60, }, }, include: ["tests/**/*.test.ts", "tests/**/*.spec.ts"], diff --git a/libs/dependency-resolver/vitest.config.ts b/libs/dependency-resolver/vitest.config.ts new file mode 100644 index 00000000..a54b8f72 --- /dev/null +++ b/libs/dependency-resolver/vitest.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globals: true, + environment: "node", + include: ["tests/**/*.test.ts"], + coverage: { + provider: "v8", + reporter: ["text", "json", "html"], + include: ["src/**/*.ts"], + exclude: ["src/**/*.d.ts", "src/index.ts"], + thresholds: { + lines: 90, + functions: 100, + branches: 85, + statements: 90, + }, + }, + }, +}); diff --git a/libs/git-utils/vitest.config.ts b/libs/git-utils/vitest.config.ts new file mode 100644 index 00000000..dfc57da1 --- /dev/null +++ b/libs/git-utils/vitest.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globals: true, + environment: "node", + include: ["tests/**/*.test.ts"], + coverage: { + provider: "v8", + reporter: ["text", "json", "html"], + include: ["src/**/*.ts"], + exclude: ["src/**/*.d.ts", "src/index.ts", "src/types.ts"], + thresholds: { + lines: 65, + functions: 75, + branches: 35, + statements: 65, + }, + }, + }, +}); diff --git a/libs/platform/vitest.config.ts b/libs/platform/vitest.config.ts index dbea81f2..2a441396 100644 --- a/libs/platform/vitest.config.ts +++ b/libs/platform/vitest.config.ts @@ -8,6 +8,16 @@ export default defineConfig({ coverage: { provider: "v8", reporter: ["text", "json", "html"], + include: ["src/**/*.ts"], + exclude: ["src/**/*.d.ts", "src/index.ts"], + thresholds: { + // Current overall coverage: ~64% (only subprocess.ts well tested) + // Set realistic thresholds until more files are tested + lines: 60, + functions: 40, + branches: 60, + statements: 60, + }, }, }, }); diff --git a/libs/utils/vitest.config.ts b/libs/utils/vitest.config.ts new file mode 100644 index 00000000..62681b2d --- /dev/null +++ b/libs/utils/vitest.config.ts @@ -0,0 +1,23 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globals: true, + environment: "node", + include: ["tests/**/*.test.ts"], + coverage: { + provider: "v8", + reporter: ["text", "json", "html"], + include: ["src/**/*.ts"], + exclude: ["src/**/*.d.ts", "src/index.ts"], + thresholds: { + // Current overall coverage: ~19% (only error-handler.ts tested) + // Set modest thresholds until more files are tested + lines: 15, + functions: 15, + branches: 25, + statements: 15, + }, + }, + }, +});