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

nyc

Package Overview
Dependencies
Maintainers
2
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nyc

a code coverage tool that works well with subprocesses.

  • 3.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.3M
decreased by-11.33%
Maintainers
2
Weekly downloads
 
Created

What is nyc?

The nyc npm package is a command-line tool that allows for JavaScript code coverage. It is built on top of Istanbul and works well with subprocesses. It is often used for tracking how well your unit-tests exercise your codebase.

What are nyc's main functionalities?

Code Coverage

This feature allows you to collect code coverage information from your tests. You can use it with a test runner like mocha by adding it to your npm scripts in your package.json file.

"scripts": {
  "test": "nyc mocha"
}

Check Coverage Thresholds

nyc can enforce coverage thresholds. If code coverage falls below the specified thresholds, nyc will exit with a failure status. This is useful for maintaining a high standard of test coverage in a project.

"scripts": {
  "test": "nyc --check-coverage --lines 95 --functions 95 --branches 95 mocha"
}

Report Generation

After running your tests with nyc, you can generate various types of coverage reports. This example shows how to generate a report in the 'lcov' format, which can be used with tools that support lcov coverage reports.

"scripts": {
  "coverage": "nyc report --reporter=text-lcov > coverage.lcov"
}

Integration with CI/CD

nyc can be integrated with continuous integration/continuous deployment (CI/CD) systems. In this example, coverage information is piped to the 'coveralls' service to track coverage over time.

"scripts": {
  "coveralls": "nyc report --reporter=text-lcov | coveralls"
}

Other packages similar to nyc

Keywords

FAQs

Package last updated on 12 Sep 2015

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