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

c8

Package Overview
Dependencies
Maintainers
2
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

c8

output coverage reports using Node.js' built in coverage

  • 10.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-2.52%
Maintainers
2
Weekly downloads
 
Created

What is c8?

The c8 npm package is a code coverage tool for JavaScript that works with the native V8 coverage functionality built into Node.js. It collects and reports on the test coverage of your code, helping you understand which parts of your codebase are covered by tests and which are not.

What are c8's main functionalities?

Code Coverage Reporting

This command runs your Node.js script with coverage tracking, and upon completion, it outputs a coverage report. The report shows the percentage of code executed by your tests, helping you identify untested parts of your codebase.

npx c8 node script.js

Integration with Testing Frameworks

You can use c8 in conjunction with testing frameworks like Mocha. This command will run Mocha tests with coverage tracking, and then generate a coverage report.

npx c8 mocha

Custom Report Formats

c8 allows you to specify one or more reporters that determine the format of the coverage report. In this example, it generates both 'lcov' and 'text' format reports.

npx c8 --reporter=lcov --reporter=text node script.js

Check Coverage Thresholds

This feature allows you to enforce coverage thresholds. If the coverage falls below the specified percentages for lines, functions, or branches, c8 will exit with a non-zero status, which is useful for CI/CD pipelines.

npx c8 --check-coverage --lines 95 --functions 95 --branches 95 node script.js

Other packages similar to c8

Keywords

FAQs

Package last updated on 10 Dec 2024

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