@swellaby/nyc-config
v3.0.13
Published
Our nyc configuration modules
Downloads
2,925
Keywords
Readme
nyc-config
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
, andtext-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