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

collect-v8-coverage

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collect-v8-coverage

Use this module to start and stop the V8 inspector manually and collect precise coverage.


Version published
Weekly downloads
16M
decreased by-15.87%
Maintainers
1
Created
Weekly downloads
 

Package description

What is collect-v8-coverage?

The collect-v8-coverage npm package is used to collect code coverage information from V8 JavaScript engine. It is particularly useful for gathering detailed coverage data during the execution of JavaScript code, which can be used for testing and performance analysis.

What are collect-v8-coverage's main functionalities?

Start Coverage Collection

This feature allows you to start collecting coverage data. The code sample demonstrates how to initialize the coverage map and start the collection process.

const { createCoverageMap } = require('collect-v8-coverage');
const coverageMap = createCoverageMap();

async function startCoverage() {
  await coverageMap.startCollecting();
  console.log('Coverage collection started');
}

startCoverage();

Stop Coverage Collection

This feature allows you to stop collecting coverage data and retrieve the collected data. The code sample shows how to stop the collection and log the results.

async function stopCoverage() {
  const result = await coverageMap.stopCollecting();
  console.log('Coverage collection stopped');
  console.log(result);
}

stopCoverage();

Serialize Coverage Data

This feature allows you to serialize the collected coverage data to a file. The code sample demonstrates how to save the coverage data to a JSON file.

const fs = require('fs');

async function saveCoverageData() {
  const result = await coverageMap.stopCollecting();
  fs.writeFileSync('coverage.json', JSON.stringify(result));
  console.log('Coverage data saved to coverage.json');
}

saveCoverageData();

Other packages similar to collect-v8-coverage

Changelog

Source

1.0.2 (2023-07-05)

Bug Fixes

  • workaround for networked filesystems on Windows (#174) (4de72ea)

Readme

Source

collect-v8-coverage

Use this module to start and stop the V8 inspector manually and collect precise coverage.

const {CoverageInstrumenter} = require('collect-v8-coverage');

const instrumenter = new CoverageInstrumenter();

await instrumenter.startInstrumenting();

// require some modules, run some code

const coverage = await instrumenter.stopInstrumenting();

FAQs

Package last updated on 05 Jul 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

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