Skip to content

Commit

Permalink
feat: Rename --temp-directory option to --temp-dir (#897)
Browse files Browse the repository at this point in the history
* Rename --temp-directory option to --temp-dir
* Add -t alias

Deprecates the option name --temp-directory in favour of --temp-dir
--temp-directory has been demoted to a yargs alias of --temp-dir
This change makes the option naming consistent using the form --*-dir
  • Loading branch information
AndrewFinlay authored and coreyfarrell committed Aug 27, 2018
1 parent 4a6b327 commit ccf42df
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -291,7 +291,7 @@ Any configuration options that can be set via the command line can also be speci
],
"cache": true,
"all": true,
"temp-directory": "./alternative-tmp",
"temp-dir": "./alternative-tmp",
"report-dir": "./alternative"
}
}
Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -41,7 +41,7 @@ function NYC (config) {
this.config = config

this.subprocessBin = config.subprocessBin || path.resolve(__dirname, './bin/nyc.js')
this._tempDirectory = config.tempDirectory || './.nyc_output'
this._tempDirectory = config.tempDir || config.tempDirectory || './.nyc_output'
this._instrumenterLib = require(config.instrumenter || './lib/instrumenters/istanbul')
this._reportDir = config.reportDir || 'coverage'
this._sourceMap = typeof config.sourceMap === 'boolean' ? config.sourceMap : true
Expand Down
6 changes: 5 additions & 1 deletion lib/commands/merge.js
Expand Up @@ -24,10 +24,14 @@ exports.builder = function (yargs) {
type: 'text',
default: 'coverage.json'
})
.option('temp-directory', {
.option('temp-dir', {
alias: 't',
describe: 'directory to read raw coverage information from',
default: './.nyc_output'
})
.option('temp-directory', {
hidden: true
})
.example('$0 merge ./out coverage.json', 'merge together reports in ./out and output as coverage.json')
}

Expand Down
6 changes: 5 additions & 1 deletion lib/commands/report.js
Expand Up @@ -20,10 +20,14 @@ exports.builder = function (yargs) {
describe: 'directory to output coverage reports in',
default: 'coverage'
})
.option('temp-directory', {
.option('temp-dir', {
alias: 't',
describe: 'directory to read raw coverage information from',
default: './.nyc_output'
})
.option('temp-directory', {
hidden: true
})
.option('show-process-tree', {
describe: 'display the tree of spawned processes',
default: false,
Expand Down
7 changes: 6 additions & 1 deletion lib/config-util.js
Expand Up @@ -222,11 +222,16 @@ Config.buildYargs = function (cwd) {
description: 'specify a different .nycrc path',
global: false
})
.option('temp-directory', {
.option('temp-dir', {
alias: 't',
describe: 'directory to output raw coverage information to',
default: './.nyc_output',
global: false
})
.option('temp-directory', {
hidden: true,
global: false
})
.option('skip-empty', {
describe: 'don\'t show empty files (no lines of code) in report',
default: false,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -11,8 +11,8 @@
"build": "node ./build-tests",
"instrument": "node ./build-self-coverage.js",
"test-integration": "tap -t120 --no-cov -b ./test/build/*.js && mocha --timeout=15000 ./test/nyc-bin.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",
"test-mocha": "node ./bin/nyc --no-clean --silent --temp-dir=./.self_coverage mocha ./test/nyc.js ./test/process-args.js",
"report": "node ./bin/nyc --temp-dir ./.self_coverage/ -r text -r lcov report",
"release": "standard-version"
},
"bin": {
Expand Down

0 comments on commit ccf42df

Please sign in to comment.