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
Recommended loopโ
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:
- add a failing test that reproduces the issue,
- implement fix,
- ensure test passes,
- keep the new test in the suite as a regression guard.