Getting Started
diff-cover-ts provides two command line tools:
diff-coverchecks coverage on changed lines.diff-qualitychecks static analysis violations on changed lines.
Install
bash
npm install --save-dev diff-coveror with Bun:
bash
bun add -d diff-coverCoverage Gate
Generate a coverage report with your test runner, then run:
bash
diff-cover coverage/lcov.info --compare-branch origin/main --fail-under 90For Vite or Vitest projects, diff-cover can detect common coverage reports from vite.config.* or vitest.config.*:
bash
diff-coverQuality Gate
Run your linter or analyzer first, then pass its report to diff-quality:
bash
diff-quality eslint-report.json --violations eslint --fail-under 95Reports
Generate HTML and JSON coverage reports:
bash
diff-cover coverage/lcov.info --format html:coverage.html,json:coverage.jsonGenerate an HTML quality report:
bash
diff-quality eslint-report.json --violations eslint --html-report quality.html