coverage-exempt.ts 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // The webworker-runtime package is outside the coverage requirement by
  35. // decision: vitest.config.ts threshold-excludes its src, so every suite
  36. // runs uninstrumented.
  37. {
  38. filter: 'packages/experimental/webworker-runtime/tests/',
  39. exclude: 'packages/experimental/webworker-runtime/tests/**',
  40. },
  41. // Real child-process fixtures over scripts/ sources, which coverage never measures.
  42. { filter: 'scripts/install-lefthook.spec.ts', exclude: 'scripts/install-lefthook.spec.ts' },
  43. { filter: 'scripts/oxlint-contract.spec.ts', exclude: 'scripts/oxlint-contract.spec.ts' },
  44. { filter: 'scripts/change-scope.spec.ts', exclude: 'scripts/change-scope.spec.ts' },
  45. { filter: 'scripts/translation-pairing-merge.spec.ts', exclude: 'scripts/translation-pairing-merge.spec.ts' },
  46. // Spawns the full-corpus transform gate in a child process (Node's ESM
  47. // loader is its oracle), so no measured file executes in-process; the
  48. // package src is threshold-excluded in vitest.config.ts. A single
  49. // 900s-budget case; running it inside an instrumented partition exceeds
  50. // the Windows partition budget under load.
  51. {
  52. filter: 'packages/experimental/webworker-runtime/tests/compile/transform-corpus.spec.ts',
  53. exclude: 'packages/experimental/webworker-runtime/tests/compile/transform-corpus.spec.ts',
  54. },
  55. // Built-artifact proof. Packer/runtime src is threshold-excluded, and the
  56. // native Windows aggregate makes this uninstrumented gate wait for build so
  57. // the suite never observes a partially emitted workspace closure.
  58. {
  59. filter: 'packages/experimental/webworker-packer/tests/image-loadable.spec.ts',
  60. exclude: 'packages/experimental/webworker-packer/tests/image-loadable.spec.ts',
  61. },
  62. ]