diff options
Diffstat (limited to 'node_modules/nyc/README.md')
-rw-r--r-- | node_modules/nyc/README.md | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/node_modules/nyc/README.md b/node_modules/nyc/README.md index 214ea245f..6c7025c60 100644 --- a/node_modules/nyc/README.md +++ b/node_modules/nyc/README.md @@ -70,9 +70,10 @@ of the pre-transpiled code. You'll have to configure your custom require hook to inline the source map in the transpiled code. For Babel that means setting the `sourceMaps` option to `inline`. -## Use with `babel-plugin-istanbul` for ES2015+ Support +## Use with `babel-plugin-istanbul` for Babel Support -[`babel-plugin-istanbul`](https://github.com/istanbuljs/babel-plugin-istanbul) can be used to enable first-class ES2015+ support. +We recommend using [`babel-plugin-istanbul`](https://github.com/istanbuljs/babel-plugin-istanbul) if your +project uses the babel tool chain: 1. enable the `babel-plugin-istanbul` plugin: @@ -152,6 +153,12 @@ nyc --check-coverage --lines 100 npm test The above check fails if coverage falls below 100%. +To check thresholds on a per-file basis run: + +```shell +nyc check-coverage --lines 95 --per-file +``` + ## Running reports Once you've run your tests with nyc, simply run: @@ -239,6 +246,7 @@ Any configuration options that can be set via the command line can also be speci "description": "These are just examples for demonstration, nothing prescriptive", "nyc": { "check-coverage": true, + "per-file": true, "lines": 99, "statements": 99, "functions": 99, @@ -266,6 +274,23 @@ Any configuration options that can be set via the command line can also be speci } ``` +### Publish, and reuse, your nyc configuration + +nyc allows you to inherit other configurations using the key `extends`. As an example, +an alternative way to configure nyc for `babel-plugin-istanbul` would be to use the +[@istanbuljs/nyc-config-babel preset](https://www.npmjs.com/package/@istanbuljs/nyc-config-babel): + +```json +{ + "nyc": { + "extends": "@istanbuljs/nyc-config-babel" + } +} +``` + +To publish and resuse your own `nyc` configuration, simply create an npm module that +exports an `index.json` with your `nyc` config. + ## High and low watermarks Several of the coverage reporters supported by nyc display special information @@ -366,6 +391,9 @@ Here's how to get `nyc` integrated with codecov and travis-ci.org: That's all there is to it! +## Integrating with TAP formatters +Many testing frameworks (Mocha, Tape, Tap, etc.) can produce [TAP](https://en.wikipedia.org/wiki/Test_Anything_Protocol) output. [tap-nyc](https://github.com/MegaArman/tap-nyc) is a TAP formatter designed to look nice with nyc. + ## More tutorials You can find more tutorials at http://istanbul.js.org/docs/tutorials |