Monocart Coverage Reports
Code coverage tool to generate V8 or Istanbul coverage reports.
Preview Reports
Usage
const CoverageReport = require('monocart-coverage-reports');
const options = {
outputDir: './coverage-reports',
reports: "v8"
}
const coverageReport = new CoverageReport(options);
await coverageReport.add(coverageData1);
await coverageReport.add(coverageData2);
const coverageResults = await coverageReport.generate();
console.log(coverageResults.summary);
Default Options
Multiple Reports
- v8 report
- istanbul reports
- clover
- cobertura
- html
- html-spa
- json
- json-summary
- lcov
- lcovonly
- none
- teamcity
- text
- text-lcov
- text-summary
const CoverageReport = require('monocart-coverage-reports');
const options = {
outputDir: './coverage-reports',
reports: [
['v8'],
['html', {
subdir: 'istanbul'
}],
['json', {
file: 'my-json-file.json'
}],
'lcovonly'
]
}
const coverageReport = new CoverageReport(options);
Multiprocessing Support
The data will be added to [outputDir]/.cache
, and the cache will be removed after reports generated.
const CoverageReport = require('monocart-coverage-reports');
const options = require('path-to/same-options.js');
const coverageReport = new CoverageReport(options);
await coverageReport.add(coverageData1);
const CoverageReport = require('monocart-coverage-reports');
const options = require('path-to/same-options.js');
const coverageReport = new CoverageReport(options);
await coverageReport.add(coverageData2);
const CoverageReport = require('monocart-coverage-reports');
const options = require('path-to/same-options.js');
const coverageReport = new CoverageReport(options);
const coverageResults = await coverageReport.generate();
console.log(coverageResults.summary);
Compare Reports
| Istanbul | V8 | V8 to Istanbul |
---|
Input | Istanbul (Object) | V8 (Array) | V8 (Array) |
Output | Istanbul HTML report | V8 HTML report | Istanbul HTML report |
Indicators | Covered Lines, Branches, Statements and Functions, Execution Counts | Covered Bytes, Lines❔, Execution Counts | Covered Lines, Branches❔, Statements and Functions, Execution Counts |
CSS coverage | ❌ | ✅ | ✅ |
Minified code | N/A | ✅ | ❌ |
Code formatting | N/A | ✅ | ❌ |
❔ - Partial or conditional support
Compare Workflows
-
Istanbul Workflows
-
V8 Workflows
Chromium Coverage API
Istanbul Coverage
Thanks