vitest.config.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334
  1. import tsconfigPaths from 'vite-tsconfig-paths'
  2. import { defineConfig } from 'vitest/config'
  3. export default defineConfig({
  4. // Native path resolution reads each package's nearest tsconfig, but only the root defines
  5. // workspace paths. Keep this plugin pinned to the root map so unbuilt bare package imports resolve
  6. // to source; native resolution would fall through to absent `lib/` outputs.
  7. plugins: [tsconfigPaths({ projects: ['./tsconfig.json'] })],
  8. test: {
  9. include: ['packages/*/*/tests/**/*.spec.ts', 'examples/*/tests/**/*.spec.ts', 'scripts/**/*.spec.ts'],
  10. coverage: {
  11. provider: 'v8',
  12. // Coverage measures OUR runtime source. Types-only files carry no
  13. // executable code; vendor/ and examples/ are out of scope (examples are
  14. // exercised by the demo smoke test instead).
  15. include: ['packages/*/*/src/**/*.ts'],
  16. // Types-only files have no runtime coverage. Importing self-executing bins/workers would boot
  17. // them inside the unit process, so real subprocess/Worker tests cover their thin entry glue.
  18. exclude: ['packages/*/*/src/types.ts', 'packages/*/*/src/bin.ts', 'packages/*/*/src/worker.ts'],
  19. // 100% or it doesn't merge (docs/testing.md: excessive tests are welcome).
  20. // Per-file so a well-covered big file can't subsidize a bare one.
  21. // Every v8 ignore comment must carry a reason — see the quality-gates Agent Note
  22. // (.agents/notes/implemented/process/2026-06-11-quality-gates.md).
  23. thresholds: {
  24. perFile: true,
  25. statements: 100,
  26. branches: 100,
  27. functions: 100,
  28. lines: 100,
  29. },
  30. reporter: process.env.CI ? ['text'] : ['text', 'html'],
  31. },
  32. },
  33. })