Scroll to navigation

NYC.JS(1) User Commands NYC.JS(1)

NAME

nyc.js - istanbul command line interface

DESCRIPTION

nyc.js [command] [options] nyc.js [options] [bin-to-instrument]

Commands:

check whether coverage is within thresholds provided
instruments a file or a directory tree and writes the instrumented code to the desired output location
run coverage report for .nyc_output
merge istanbul format coverage
[output-file]
output in a given folder

OPTIONS

working directory used when resolving paths [string] [default: "."]
specify an explicit path to find nyc configuration
directory to output raw coverage information to [string] [default: "./.nyc_output"]
a list of specific files and directories that should be excluded from coverage, glob patterns are supported [string] [default:
["coverage/**","packages/*/test{,s}/**","**/*.d.ts","test{,s}/**","test{,-*}.{ js,cjs,mjs,ts,tsx,jsx}","**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}","**/__tests__/ **","**/{ava,babel,nyc}.config.{js,cjs,mjs}","**/jest.config.{js,cjs,mjs,ts}",
"**/{karma,rollup,webpack}.config.js","**/.{eslint,mocha}rc.{js,cjs}"]]
whether or not to exclude all node_module folders (i.e. **/node_modules/**) by default
[boolean] [default: true]
a list of specific files that should be covered, glob patterns are supported
[string] [default: []]
a list of extensions that nyc should handle in addition to .js
[string] [default: [".js",".cjs",".mjs",".ts",".tsx",".jsx"]]
class method names to ignore for coverage [string] [default: []]
allow `return` statements outside of functions [boolean] [default: true]
should files be treated as ES Modules [boolean] [default: true]
babel parser plugins to use when parsing the source
[string] [default: ["asyncGenerators","bigInt","classProperties","classPrivate Properties","classPrivateMethods","dynamicImport","importMeta","numericSeparat
or","objectRestSpread","optionalCatchBinding","topLevelAwait"]]
should the output be compacted? [boolean] [default: true]
should comments be preserved in the output? [boolean] [default: true]
should source maps be produced? [boolean] [default: true]
should nyc detect and handle source maps? [boolean] [default: true]
a list of additional modules that nyc should attempt to require in its subprocess, e.g., @babel/register, @babel/polyfill
[string] [default: []]
should nyc handle instrumentation? [boolean] [default: true]
should exclude logic be performed after the source-map remaps filenames?
[boolean] [default: true]
what % of branches must be covered? [number] [default: 0]
what % of functions must be covered? [number] [default: 0]
what % of lines must be covered? [number] [default: 90]
what % of statements must be covered? [number] [default: 0]
check thresholds per file [boolean] [default: false]
check whether coverage is within thresholds provided [boolean] [default: false]
coverage reporter(s) to use [string] [default: ["text"]]
directory to output coverage reports in [string] [default: "coverage"]
display the tree of spawned processes [boolean] [default: false]
don't show empty files (no lines of code) in report [boolean] [default: false]
don't show files with 100% statement, branch, and function coverage
[boolean] [default: false]
don't output a report after tests finish running [boolean] [default: false]
whether or not to instrument all files of the project (not just the ones touched by your test suite) [boolean] [default: false]
instantiate the instrumenter at startup (see https://git.io/vMKZ9)
[boolean] [default: false]
cache instrumentation results for improved performance [boolean] [default: true]
explicitly set location for instrumentation cache [string]
cache babel transpilation results for improved performance [boolean] [default: false]
use spawn-wrap instead of setting process.env.NODE_OPTIONS
[boolean] [default: false]
should nyc wrap require? [boolean] [default: true]
should nyc wrap vm.runInContext? [boolean] [default: false]
should nyc wrap vm.runInThisContext? [boolean] [default: false]
should the .nyc_output folder be cleaned before executing tests
[boolean] [default: true]
Show help [boolean]
Show version number [boolean]

EXAMPLES

instrument your tests with coverage
instrument your tests with coverage
and transpile with Babel
output lcov report after running your tests

visit https://git.io/vHysA for list of available reporters

January 2022 nyc.js 15.1.0