Coverage Importer
Category: Importer (takes in a coverage report generated by any coverage tool - see supported formats below)
The CoverageImporter generates visualisation data from a coverage report generated by any coverage tool. The coverage report must be in one of the supported formats (see below). The CoverageImporter generates node attributes for each file in the coverage report.
Supported Metrics
Section titled “Supported Metrics”| Metric | Description |
|---|---|
line_coverage | The percentage of lines covered by tests in the file. |
branch_coverage | The percentage of branches covered by tests in the file. |
statement_coverage | The percentage of statements covered by tests in the file. |
instruction_coverage | The percentage of instructions covered by tests in the file. |
complexity_coverage | The percentage of complexity covered by tests. |
method_coverage | The percentage of methods covered by tests in the file. |
class_coverage | The percentage of classes covered by tests. |
Supported Coverage Report Formats
Section titled “Supported Coverage Report Formats”| Format | Command | Default Report File |
|---|---|---|
| LCOV | lcov | lcov.info |
| JaCoCo | jacoco | jacoco.xml |
| Cobertura | cobertura | coverage.cobertura.xml |
| PHPUnit | phpunit | index.xml |
| Clover | clover | clover.xml |
Usage and Parameters
Section titled “Usage and Parameters”| Parameters | Description |
|---|---|
<pathToReportFile> | path to the coverage report file (when specifying a folder, the importer searches for a file matching the default file name - see above) |
-f, --format | specify the format of the coverage report (see above) |
-h, --help | displays help and exits |
-nc, --not-compressed | save uncompressed output File |
-o, --output-file=<outputFilePath> | output File (or empty for stdout) |
-klp, --keep-leading-paths | Keep full file paths, including segments before the project root directory |
Usage: ccsh coverageimport -f=<format> [-h] [-nc] [-klp] [-o=<outputFile>]... <pathToReportFile>Example
Section titled “Example”Lcov / TypeScript
Section titled “Lcov / TypeScript”- Create a coverage report with your coverage tool, e.g. with Jest
- Import the coverage report with the CoverageImporter
ccsh coverageimport lcov.info --format=lcov -o typescript_coverage.cc.jsonExample File Content
Section titled “Example File Content”JavaScript / TypeScript
Section titled “JavaScript / TypeScript”Example Input file: lcov.info
TN:SF:app/app.config.tsFN:55,(anonymous_0)FN:55,(anonymous_1)FNF:2FNH:0FNDA:0,(anonymous_0)FNDA:0,(anonymous_1)DA:1,0DA:2,0DA:3,0DA:4,0DA:5,0DA:6,0DA:7,0DA:8,0DA:9,0DA:10,0DA:11,0DA:12,0DA:13,0DA:14,0DA:15,0DA:16,0DA:17,0DA:18,0DA:19,0DA:20,0DA:21,0DA:22,0DA:23,0DA:24,0DA:26,0DA:55,0LF:26LH:0BRF:0BRH:0end_of_recordExample Output file: typescript_coverage.cc.json (simplified excerpt; the real output also contains attributeTypes, attributeDescriptors and blacklist fields)
{ "projectName": "typescript_coverage", "apiVersion": "1.5", "nodes": [ { "name": "root", "type": "Folder", "attributes": {}, "children": [ { "name": "app", "type": "Folder", "attributes": {}, "children": [ { "name": "app.config.ts", "type": "File", "attributes": { "line_coverage": 0, "branch_coverage": 0, "statement_coverage": 0 } } ] } ] } ], "edges": []}