Files
agentic-dev/packages/core-shared/vitest.config.ts
Danijel Martinek 0d4be0a4f4 fix(coverage): exempt .d.ts files from diff coverage gate
Ambient declaration files have no runtime code so v8 coverage
never generates DA records for them. Without an allowlist entry,
coverage:diff reports no-coverage-data for every .d.ts in the
diff. Add /\.d\.ts$/ to ALLOWED_GLOBS with a companion test.

Also configure @vitest/coverage-v8 for core-shared and add
targeted vitest exclusions for infrastructure files that are not
unit-testable (DI symbols, interface files, tRPC context, Sentry
SDK init) — bringing core-shared into the L2 aggregate and making
the L1 diff gate enforce coverage on new executable code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 18:26:50 +00:00

26 lines
872 B
TypeScript

import path from "node:path";
import { mergeConfig } from "vitest/config";
import { nodeVitestConfig } from "@repo/core-typescript/vitest.base.node";
export default mergeConfig(nodeVitestConfig, {
test: {
coverage: {
exclude: [
// Ambient declaration files have no runtime code
"src/**/*.d.ts",
// Pure TypeScript interface files — erased at runtime, not unit-testable
"src/**/*.interface.ts",
// DI symbol constants — boilerplate, covered implicitly by bind-* tests
"src/**/symbols.ts",
// tRPC context factory — wired at app bootstrap, not unit-testable
"src/trpc/context.ts",
// Sentry client init — browser/node SDK init, tested in apps
"src/instrumentation/sentry/**",
],
},
},
resolve: {
alias: { "@": path.resolve(__dirname, "./src") },
},
});