vitest.config.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  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. setupFiles: ['./scripts/test-invariants.ts'],
  10. include: ['packages/*/*/tests/**/*.spec.ts', 'examples/*/tests/**/*.spec.ts', 'scripts/**/*.spec.ts'],
  11. coverage: {
  12. provider: 'v8',
  13. // Coverage measures OUR runtime source. Types-only files carry no
  14. // executable code; vendor/ and examples/ are out of scope (examples are
  15. // exercised by the demo smoke test instead).
  16. include: ['packages/*/*/src/**/*.ts'],
  17. // Types-only files have no runtime coverage. Importing self-executing bins/workers would boot
  18. // them inside the unit process, so real subprocess/Worker tests cover their thin entry glue.
  19. exclude: ['packages/*/*/src/types.ts', 'packages/*/*/src/bin.ts', 'packages/*/*/src/worker.ts'],
  20. // 100% or it doesn't merge (docs/testing.md: excessive tests are welcome).
  21. // Per-file so a well-covered big file can't subsidize a bare one.
  22. // Every v8 ignore comment must carry a reason — see the quality-gates Agent Note
  23. // (.agents/notes/implemented/process/2026-06-11-quality-gates.md).
  24. thresholds: {
  25. perFile: true,
  26. statements: 100,
  27. branches: 100,
  28. functions: 100,
  29. lines: 100,
  30. },
  31. reporter: process.env.CI ? ['text'] : ['text', 'html'],
  32. },
  33. },
  34. })