Preface¶
When building agents with DeepSeek Harness (DSH), after an agent runs tests with coverage, the resulting coverage reports are often large and messily structured, making them difficult to use directly as guidance for adding more tests. This plugin addresses this intermediary problem by parsing various coverage reports into structured data and directly outputting a list of the files that most need additional tests, along with the exact uncovered line ranges.
What Is It¶
dsh-test-coverage is a DSH plugin maintained by uckkk. It focuses on parsing code coverage reports in mainstream formats and outputting data that can directly guide the creation of test cases. The plugin is implemented purely in Node and does not depend on shell commands, network requests, or external services.
Core Features¶
- Parses coverage reports: Supports LCOV (
.lcov/lcov.info), Cobertura (coverage.xml), Istanbul / Vitest / Jest (coverage-final.json), and Go’scover.outformat. - Structured output: Produces overall line coverage and a per-file coverage table, with the table sorted from lowest to highest coverage to facilitate priority handling.
- Precisely identifies gaps: Provides a list of files that most need additional tests and supports viewing exact uncovered line ranges for a specified file.
- Local execution: Implemented purely in Node, with no shell, network, or external service dependencies.
Installation and Activation¶
Install the plugin:
dsh plugin add dsh-test-coverage
After installation, add "dsh-test-coverage" to dsh.profile.bundles in the profile’s package.json (or install it in one click from the plugin marketplace).
Typical Usage¶
The plugin registers two tool functions, one for viewing the overall status and another for locating specific gaps.
- View overall project coverage:
Call thecoverage_reportfunction, passing the report path.
coverage_report(path='/workspace/coverage/lcov.info')
This call returns the overall line coverage, the per-file coverage table, and a list of files with the lowest coverage.
- View uncovered lines in a specified file:
Call thecoverage_gapsfunction, specifying the file name and report path.
coverage_gaps(file='src/parser.js', path='/workspace/coverage')
This call returns the exact uncovered line ranges in the specified file.
Suitable Scenarios and Notes¶
Suitable scenario: This plugin is most appropriate when you have already generated a coverage report using the project’s built-in test command and need to quickly analyze coverage and locate uncovered code within a DSH context.
Notes:
- This plugin only performs “parsing and analysis” and does not run tests itself. To run tests and generate a coverage report, use the project’s built-in test command.
- For large reports, the plugin automatically truncates its output: the file table displays up to 300 items, and line ranges display up to 400 segments, to avoid consuming excessive context.
- Installing it means running third-party code on your local machine. Please review the source code and license (MIT) yourself to ensure compliance.
Summary¶
dsh-test-coverage effectively reduces the cognitive load on agents when processing coverage reports, transforming messy textual reports into actionable structured data. By prioritizing the display of files with the lowest coverage and uncovered line ranges, it directly assists developers in completing additional testing.