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

@connectis/coverage-parser

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@connectis/coverage-parser

Library for parsing coverage reports.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7K
decreased by-35.09%
Maintainers
2
Weekly downloads
 
Created
Source

coverage-parser

A Node.js library for parsing coverage reports.

NPM versionDependency Status

This library bundles different coverage parsers that parse coverage information in a uniform way. Supported coverage report formats:

API

The API includes the following:

  • parseGlobs(globs, options)
  • parseFiles(files, options)
  • parseFile(file, options)
  • types

types

Type Array<string>

Array of available parser types.

options

Type object

options.type

Type: string

The type of parser which should be used for parsing the coverage files. See the exported types array for available types.

options.parser

Type: function

Custom parser function for parsing the coverage files: (file) => Promise<Array<CoverageResult>>. See below.

options.pathMode

Type: 'absolute' | 'relative' | 'unmodified'

Default: 'absolute'

The type of paths that should be used in the parsed result. See options.baseDir.

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.

parseGlobs(globs, options)

Finds all coverage reports matching the glob patterns and parses the results.

globs

Type: Array<string>

An array of glob patterns.

options

Type: options. See above.

options.globOptions

Type: object

Options to pass to fast-glob.

returns

Type: Promise<Array<CoverageResult>>. See below.

parseFiles(files, options)

Parses all coverage reports files.

files

Type: Array<string>

An array of file paths.

options

Type: options. See above.

returns

Type: Promise<Array<CoverageResult>>. See below.

parseFile(file, options)

Parses the coverage reports file.

file

Type: string

The file path.

options

Type: options. See above.

returns

Type: Promise<Array<CoverageResult>>. See below.

CoverageResult

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
        }        
      ]
    }
}

Keywords

FAQs

Package last updated on 24 Oct 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc