coverage-exempt.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * Heavy suites the coverage aggregate runs uninstrumented in a parallel gate.
  3. * Membership rule: a suite qualifies only when every coverage-measured
  4. * file it executes in-process (`coverage.include` spans package src trees;
  5. * typert generator src is threshold-excluded in vitest.config.ts) is already
  6. * fully covered by other suites, so removing it from the instrumented run
  7. * changes no threshold outcome. The aggregate still runs every listed suite
  8. * plain beside the instrumented gate, so correctness signal is unchanged —
  9. * only the v8 instrumentation tax on compiler- and subprocess-heavy fixtures
  10. * is dropped.
  11. */
  12. /** One coverage-exempt suite: a Vitest CLI filter and its exclude glob. */
  13. export interface CoverageExemptSuite {
  14. /** Positional file filter selecting the suite in the uninstrumented gate. */
  15. readonly filter: string
  16. /** Exclude glob removing the suite from the instrumented gate. */
  17. readonly exclude: string
  18. }
  19. /**
  20. * Set to `1` by the instrumented coverage gate; vitest.config.ts then drops
  21. * the exempt suites from every project. CLI `--exclude` cannot express this:
  22. * it does not reach per-project include resolution.
  23. */
  24. export const COVERAGE_EXEMPT_ENV = 'DSH_COVERAGE_EXEMPT_HEAVY'
  25. /** Coverage-exempt heavy suites; keep filter and exclude selecting the same files. */
  26. export const coverageExemptHeavySuites: readonly CoverageExemptSuite[] = [
  27. // Whole-workspace compiler analysis per case — the lane's longest tail.
  28. // Generator src is threshold-excluded; tools-catalog's registry and
  29. // tool-cordis imports are fully covered by those packages' own tests.
  30. {
  31. filter: 'packages/typert/generator/tests/',
  32. exclude: 'packages/typert/generator/tests/**',
  33. },
  34. // Real child-process fixtures over scripts/ sources, which coverage never measures.
  35. { filter: 'scripts/install-lefthook.spec.ts', exclude: 'scripts/install-lefthook.spec.ts' },
  36. { filter: 'scripts/oxlint-contract.spec.ts', exclude: 'scripts/oxlint-contract.spec.ts' },
  37. { filter: 'scripts/change-scope.spec.ts', exclude: 'scripts/change-scope.spec.ts' },
  38. { filter: 'scripts/translation-pairing-merge.spec.ts', exclude: 'scripts/translation-pairing-merge.spec.ts' },
  39. ]