Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for --no-clean, to disable deleting raw coverage output #558

Merged
merged 4 commits into from
Apr 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bin/nyc.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is because we want to just be explicit and start from a fresh state every time? There aren't really any perf benefits from keeping this folder around right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this allows us to keep the folder around between two runs of nyc -- which allows reports to be combined from mocha and tap -- as we start migrating a few tests over.

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
Original file line number Diff line number Diff line change
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