Skip to content

Commit

Permalink
feat: add support for --no-clean, to disable deleting raw coverage ou…
Browse files Browse the repository at this point in the history
…tput (#558)
  • Loading branch information
bcoe committed Apr 29, 2017
1 parent ff73b18 commit 1887d1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 1 addition & 2 deletions bin/nyc.js
Expand Up @@ -38,8 +38,7 @@ if (argv._[0] === 'report') {
else config.instrumenter = './lib/instrumenters/istanbul'

var nyc = (new NYC(config))
nyc.reset()

if (config.clean) nyc.reset()
if (config.all) nyc.addAllFiles()

var env = {
Expand Down
13 changes: 12 additions & 1 deletion lib/config-util.js
Expand Up @@ -64,7 +64,7 @@ Config.buildYargs = function (cwd) {
default: 'coverage'
})
.option('temp-directory', {
describe: 'directory from which coverage JSON files are read',
describe: 'directory to read raw coverage information from',
default: './.nyc_output'
})
.option('show-process-tree', {
Expand Down Expand Up @@ -219,6 +219,17 @@ Config.buildYargs = function (cwd) {
type: 'boolean',
global: false
})
.option('clean', {
describe: 'should the .nyc_output folder be cleaned before executing tests',
default: true,
type: 'boolean',
global: false
})
.option('temp-directory', {
describe: 'directory to output raw coverage information to',
default: './.nyc_output',
global: false
})
.pkgConf('nyc', cwd || process.cwd())
.example('$0 npm test', 'instrument your tests with coverage')
.example('$0 --require babel-core/register npm test', 'instrument your tests with coverage and babel')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -11,7 +11,7 @@
"build": "node ./build-tests",
"instrument": "node ./build-self-coverage.js",
"test-integration": "tap -t120 --no-cov -b ./test/build/*.js && mocha --timeout=15000 ./test/src/nyc-bin.js",
"test-mocha": "node ./bin/nyc --silent --temp-directory=./.self_coverage mocha ./test/nyc.js ./test/process-args.js",
"test-mocha": "node ./bin/nyc --no-clean --silent --temp-directory=./.self_coverage mocha ./test/nyc.js ./test/process-args.js",
"report": "node ./bin/nyc --temp-directory ./.self_coverage/ -r text -r lcov report",
"release": "standard-version"
},
Expand Down

0 comments on commit 1887d1c

Please sign in to comment.