Code Monkey home page Code Monkey logo

nyc-config's Introduction

nyc-config

npmjs Badge npmjs Badge Circle CI Badge license Badge

Our various configurations for nyc based code coverage. Geared for our specific needs, but feel free to use it if helps you!

Installation

Install the nyc-config module as a dev dependency:

npm i @swellaby/nyc-config --save-dev

Usage

Add an extends key to your nyc config file and specify the value of the configuration you want to use:

For example, to use our default nyc configuration add the following to your .nycrc file:

{
    ...
    "extends": "@swellaby/nyc-config",
    ...
}

nyc Configurations

base Configuration

Our base configuration defines a few core configuration settings:

  • reporters - html, lcov, cobertura, text, and text-summary
  • cache - true
  • all - true
  • per-file - true
  • report-dir - .coverage/

You can utilize our base configuration by adding an extends key to your nyc config file and specifying the value of @swellaby/nyc-config/base. For example:

{
    ...
    "extends": "@swellaby/nyc-config/base",
    ...
}

Complete Coverage Configuration

Our complete coverage configuration enforces 100% code coverage. It is the default configuration specified by this config module. It extends our base configuration with the following settings:

  • check-coverage - true
  • lines - 100
  • statements - 100
  • functions - 100
  • branches - 100

This config will be used by adding the config value to the extends key in your nyc config file.

{
    ...
    "extends": "@swellaby/nyc-config",
    ...
}

Partial Coverage Configuration

We also have a configuration that enforces code coverage levels with lower threshold levels. It similarly extends our base configuration but uses defines the following coverage levels:

  • check-coverage - true
  • lines - 75
  • statements - 75
  • functions - 80
  • branches - 70

You can utilize our partial coverage configuration by adding an extends key to your [nyc config file][nyc-config-url] and specifying the value of @swellaby/nyc-config/partial-coverage. For example:

{
    ...
    "extends": "@swellaby/nyc-config/partial-coverage",
    ...
}

API

All configurations are also accessible programmatically and can be accessed via the relevant property after importing the @swellaby/nyc-config module. For example:

const nycConfig = require('@swellaby/nyc-config');

const baseConfig = nycConfig.baseConfig;
const partialCoverageConfig = nycConfig.partialCoverageConfig;

License

MIT - see license details here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.