Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

monocart-coverage-reports

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monocart-coverage-reports

Monocart coverage reports


Version published
Weekly downloads
192K
decreased by-19.57%
Maintainers
1
Weekly downloads
 
Created

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
    • v8
  • 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.

  • sub process 1
const CoverageReport = require('monocart-coverage-reports');
const options = require('path-to/same-options.js');
const coverageReport = new CoverageReport(options);
await coverageReport.add(coverageData1);
  • sub process 2
const CoverageReport = require('monocart-coverage-reports');
const options = require('path-to/same-options.js');
const coverageReport = new CoverageReport(options);
await coverageReport.add(coverageData2);
  • main process
// after all sub processes finished
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

IstanbulV8V8 to Istanbul
InputIstanbul (Object)V8 (Array)V8 (Array)
OutputIstanbul HTML reportV8 HTML reportIstanbul HTML report
IndicatorsCovered Lines, Branches, Statements and Functions, Execution CountsCovered Bytes, Lines❔, Execution CountsCovered Lines, Branches❔, Statements and Functions, Execution Counts
CSS coverage
Minified codeN/A
Code formattingN/A

❔ - Partial or conditional support

Compare Workflows

Chromium Coverage API

Istanbul Coverage

Thanks

FAQs

Package last updated on 08 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts