You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@bcoe/v8-coverage

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bcoe/v8-coverage

Helper functions for V8 coverage files.


Version published
Weekly downloads
17M
decreased by-18.21%
Maintainers
1
Install size
271 kB
Created
Weekly downloads
 

Package description

What is @bcoe/v8-coverage?

@bcoe/v8-coverage is a Node.js package that provides tools for working with V8 JavaScript engine's code coverage data. It allows you to parse, manipulate, and format coverage data generated by V8, which is useful for analyzing code coverage in JavaScript applications.

What are @bcoe/v8-coverage's main functionalities?

Parsing V8 Coverage Data

This feature allows you to parse raw V8 coverage data into a more manageable format. The code sample demonstrates how to use the `parse` function to convert raw coverage data into a parsed format.

const { parse } = require('@bcoe/v8-coverage');
const coverageData = [
  {
    result: [
      {
        scriptId: '1',
        url: 'file.js',
        functions: [
          {
            functionName: 'foo',
            ranges: [
              { startOffset: 0, endOffset: 10, count: 1 }
            ],
            isBlockCoverage: true
          }
        ]
      }
    ]
  }
];
const parsedData = parse(coverageData);
console.log(parsedData);

Merging Coverage Data

This feature allows you to merge multiple sets of V8 coverage data into a single set. The code sample demonstrates how to use the `mergeProcessCovs` function to combine two sets of coverage data.

const { mergeProcessCovs } = require('@bcoe/v8-coverage');
const coverageData1 = [
  {
    result: [
      {
        scriptId: '1',
        url: 'file.js',
        functions: [
          {
            functionName: 'foo',
            ranges: [
              { startOffset: 0, endOffset: 10, count: 1 }
            ],
            isBlockCoverage: true
          }
        ]
      }
    ]
  }
];
const coverageData2 = [
  {
    result: [
      {
        scriptId: '1',
        url: 'file.js',
        functions: [
          {
            functionName: 'foo',
            ranges: [
              { startOffset: 0, endOffset: 10, count: 2 }
            ],
            isBlockCoverage: true
          }
        ]
      }
    ]
  }
];
const mergedData = mergeProcessCovs([coverageData1, coverageData2]);
console.log(mergedData);

Formatting Coverage Data

This feature allows you to format V8 coverage data into a JSON object. The code sample demonstrates how to use the `CoverageMap` class to create a coverage map and then format it as a JSON object.

const { CoverageMap } = require('@bcoe/v8-coverage');
const coverageData = [
  {
    result: [
      {
        scriptId: '1',
        url: 'file.js',
        functions: [
          {
            functionName: 'foo',
            ranges: [
              { startOffset: 0, endOffset: 10, count: 1 }
            ],
            isBlockCoverage: true
          }
        ]
      }
    ]
  }
];
const coverageMap = new CoverageMap(coverageData);
const formattedData = coverageMap.toJSON();
console.log(formattedData);

Other packages similar to @bcoe/v8-coverage

Readme

Source

V8 Coverage

npm GitHub repository Build status (Travis) Build status (AppVeyor) Codecov

License

MIT License

FAQs

Package last updated on 06 Sep 2019

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc