
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@connectis/coverage-parser
Advanced tools
A Node.js library for parsing coverage reports.
This library bundles different coverage parsers that parse coverage information in a uniform way. Supported coverage report formats:
Note: if you want to merge the parsed results you can use @connectis/coverage-merger.
const coverageParser = require('@connectis/coverage-parser');
coverageParser
.parseGlobs('**/lcov.info', {
type: 'lcov'
})
.then(results => console.log(results));
The API includes the following:
Type Array<string>
Array of available parser types.
Type object
Type: string
The type of parser which should be used for parsing the coverage files. See the exported types
array for available types.
Type: function
Custom parser function for parsing the coverage files: (file) => Promise<Array<CoverageResult>>
. See below.
Type: 'absolute' | 'relative' | 'unmodified'
Default: 'absolute'
The type of paths that should be used in the parsed result. See options.baseDir
.
Type: string
Default: process.cwd()
The base directory that will be used for making paths relative or absolute in the coverage reports. See options.pathMode
.
Finds all coverage reports matching the glob patterns and parses the results.
Type: Array<string>|string
Either an of glob patterns or a single glob pattern.
Type: options
. See above.
Type: object
Options to pass to fast-glob.
Type: Promise<Array<CoverageResult>>
. See below.
Parses all coverage reports files.
Type: Array<string>
An array of file paths.
Type: options
. See above.
Type: Promise<Array<CoverageResult>>
. See below.
Parses the coverage reports file.
Type: string
The file path.
Type: options
. See above.
Type: Promise<Array<CoverageResult>>
. See below.
The returned data has the following format.
{
"title": "Test #1",
"file": "/some/absolute/path/anim-base/anim-base-coverage.js",
"functions": {
"hit": 23,
"found": 29,
"details": [
{
"name": "(anonymous 1)",
"line": 7,
"hit": 6
},
{
"name": "(anonymous 2)",
"line": 620,
"hit": 225
},
{
"name": "_end",
"line": 516,
"hit": 228
}
]
},
"lines": {
"found": 181,
"hit": 143,
"details": [
{
"line": 7,
"hit": 6
},
{
"line": 29,
"hit": 6
},
{
"line": 41,
"hit": 0
}
]
},
"branches": {
"found": 2,
"hit": 1,
"details": [
{
"line": 9,
"branch": 0,
"taken": 0
},
{
"line": 9,
"branch": 1,
"taken": 1
}
]
}
}
FAQs
Library for parsing coverage reports.
We found that @connectis/coverage-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.