From 28b6d09c5a0700d7a6b0b91088c1898d0a45458d Mon Sep 17 00:00:00 2001 From: AndrewFinlay Date: Sun, 6 Jan 2019 11:13:25 +1100 Subject: [PATCH] fix: missing command temp-directory (#928) * Fix missing command temp-directory After changing tempDirectory to tempDir, with a fallback for tempDirectory, the default values set in the 'temp-dir' yargs option were being used rather than falling back to tempDirectory and then the default temp dir. This change removes the yargs default value for the option 'temp-dir'. This means the statement that assigns '_tempDirectory' in 'index.js' attempts to use temp-dir, then temp-directory, then the default value. This is now under test with some new test cases that show: - tempDir is preferred to tempDirectory - tempDirectory is used if tempDir isn't set - that we fall back to the '.nyc_output' dir if neither tempDir or tempDirectory are set. * Alternate implementation Maintains notice of default temp-dir in help output. Removed tests as I'm not confident with these right now, will take another look when I get some time. Fixes #927. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b981fbaf1..ffa1b3f17 100755 --- a/index.js +++ b/index.js @@ -41,7 +41,7 @@ function NYC (config) { this.config = config this.subprocessBin = config.subprocessBin || path.resolve(__dirname, './bin/nyc.js') - this._tempDirectory = config.tempDir || config.tempDirectory || './.nyc_output' + this._tempDirectory = config.tempDirectory || config.tempDir || './.nyc_output' this._instrumenterLib = require(config.instrumenter || './lib/instrumenters/istanbul') this._reportDir = config.reportDir || 'coverage' this._sourceMap = typeof config.sourceMap === 'boolean' ? config.sourceMap : true