Skip to content

Latest commit

 

History

History
84 lines (63 loc) · 2.53 KB

File metadata and controls

84 lines (63 loc) · 2.53 KB

Contributing to Coverage Visualizer

Thanks for your interest in contributing. This document covers how to set up the project, run tests, and submit changes.

Development Setup

Prerequisites: Node.js 20+, VS Code 1.90+

git clone https://github.com/kool7/coverage-visualizer.git
cd coverage-visualizer
npm install
npm run compile

Press F5 in VS Code to open the Extension Development Host with the extension loaded.

Project Layout

src/
  extension.ts          # Entry point — commands, decorations, watchers
  config.ts             # All settings in one place
  parsers/              # Format parsers (JSON, XML, SQLite)
  providers/            # VS Code language feature providers (CodeLens, Hover, Tree)
  ui/                   # Status bar and WebView dashboard
tests/
  coverageParser.test.ts
  fixtures/             # Static test data (coverage.json, coverage.xml, .coverage)
  __mocks__/vscode.ts   # Jest mock for the vscode module
scripts/
  generate-test-coverage-db.mjs   # Regenerates tests/fixtures/.coverage

Common Commands

npm run compile      # TypeScript → out/
npm run watch        # Recompile on save
npm test             # Run Jest suite
npm run test:watch   # Run tests in watch mode
npm run lint         # ESLint

Running a Single Test

npx jest --testNamePattern "parseCoverageJson"

Regenerating Test Fixtures

The .coverage SQLite fixture is generated by a script (so it doesn't require Python):

node scripts/generate-test-coverage-db.mjs
cp demo-python-project/.coverage tests/fixtures/.coverage

Run this whenever you change the data in demo-python-project/src/.

Adding a New Coverage Format

  1. Add a parseXxx(input: ...) : CoverageReport function in src/parsers/coverageParser.ts
  2. Add the format detection in detectAndParse() inside src/extension.ts
  3. Add a file watcher pattern in setupWatchers() inside src/extension.ts
  4. Add tests in tests/coverageParser.test.ts with a fixture file in tests/fixtures/

Pull Request Guidelines

  • Keep PRs focused — one feature or fix per PR
  • All existing tests must pass (npm test)
  • Add tests for new parser logic or bug fixes
  • Run npm run compile before opening a PR — type errors block CI
  • Write a clear PR description explaining what changed and why

Reporting Bugs

Open an issue on GitHub with:

  • VS Code version
  • Extension version
  • Which coverage format you were using
  • The error message (from the VS Code Output panel → Coverage Visualizer)
  • A minimal reproduction if possible