Socket
Socket
Sign inDemoInstall

nyc

Package Overview
Dependencies
6
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nyc

forking code-coverage using istanbul.


Version published
Maintainers
1
Install size
11.1 MB
Created

Package description

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

Readme

Source

nyc

a code coverage reporter built on istanbul that works well for applications that spawn child processes.

Keywords

FAQs

Last updated on 10 May 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc