Skip to main content

Testing rules and fixtures

Test structureโ€‹

Rule tests are under test/ and should validate:

  • positive cases (expected reports)
  • negative cases (no reports)
  • fixer/suggestion behavior when applicable
  • option combinations and edge cases
npm run build
npm run test

For focused work, run relevant test files directly through Vitest filters.

Coverage expectationsโ€‹

  • Cover primary rule branches.
  • Include malformed input and boundary conditions.
  • Assert message IDs rather than only counts where possible.

Regression strategyโ€‹

When fixing a bug:

  1. add a failing test that reproduces the issue,
  2. implement fix,
  3. ensure test passes,
  4. keep the new test in the suite as a regression guard.