Skip to content

Conversation

@686f6c61
Copy link

@686f6c61 686f6c61 commented Dec 30, 2025

Implements test coverage visualization for the LSP testing API (closes #18147).

When the test run kind is coverage, the LSP passes --coverage=<temp_dir> to deno test, collects the V8 coverage JSON files after execution, and sends a new deno/testCoverage notification to the client.

The notification payload includes:

  • File URIs with their coverage data
  • Arrays of covered and uncovered line numbers (1-indexed)
  • Coverage percentage per file

The implementation parses the V8 ScriptCoverage format, converts character offsets to line numbers, and filters out external dependencies (only files under the workspace are reported).

Technical details:

  • New types in cli/lsp/testing/lsp_custom.rs: FileCoverage, CoverageNotificationParams
  • Coverage collection in cli/lsp/testing/execution.rs: collect_coverage_from_dir() reads and parses the JSON files
  • The coverage directory is created in the system temp folder as deno_lsp_coverage_{run_id} and cleaned up after sending the notification

Testing:
To test locally, use the vscode_deno extension with the corresponding PR and run any test file with "Run with Coverage" from the Testing panel.

1352

Screenshots will be added in a follow-up comment.
scr01

scr02

Implements test coverage visualization for the LSP testing API.

When the test run kind is `coverage`, the LSP passes `--coverage=<temp_dir>`
to `deno test`, collects the V8 coverage JSON files after execution, and
sends a new `deno/testCoverage` notification to the client.

The notification payload includes:
- File URIs with their coverage data
- Arrays of covered and uncovered line numbers (1-indexed)
- Coverage percentage per file

The implementation parses the V8 ScriptCoverage format, converts character
offsets to line numbers, and filters out external dependencies (only files
under the workspace are reported).

Technical details:
- New types in `cli/lsp/testing/lsp_custom.rs`: `FileCoverage`,
  `CoverageNotificationParams`
- Coverage collection in `cli/lsp/testing/execution.rs`:
  `collect_coverage_from_dir()` reads and parses the JSON files
- The coverage directory is created in the system temp folder as
  `deno_lsp_coverage_{run_id}` and cleaned up after sending the notification
@CLAassistant
Copy link

CLAassistant commented Dec 30, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: view test coverage in editor

2 participants