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

Fix missing command temp-directory #928

Merged
merged 4 commits into from Jan 6, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/commands/merge.js
Expand Up @@ -26,8 +26,7 @@ exports.builder = function (yargs) {
})
.option('temp-dir', {
alias: 't',
describe: 'directory to read raw coverage information from',
default: './.nyc_output'
describe: 'directory to read raw coverage information from'
})
.option('temp-directory', {
hidden: true
Expand Down
3 changes: 1 addition & 2 deletions lib/commands/report.js
Expand Up @@ -22,8 +22,7 @@ exports.builder = function (yargs) {
})
.option('temp-dir', {
alias: 't',
describe: 'directory to read raw coverage information from',
default: './.nyc_output'
describe: 'directory to read raw coverage information from'
})
.option('temp-directory', {
hidden: true
Expand Down
1 change: 0 additions & 1 deletion lib/config-util.js
Expand Up @@ -225,7 +225,6 @@ Config.buildYargs = function (cwd) {
.option('temp-dir', {
alias: 't',
describe: 'directory to output raw coverage information to',
default: './.nyc_output',
global: false
})
.option('temp-directory', {
Expand Down
15 changes: 15 additions & 0 deletions test/src/nyc-tap.js
Expand Up @@ -105,6 +105,21 @@ describe('nyc', function () {
// an empty exclude still has **/node_modules/**, node_modules/** and added.
nyc2.exclude.exclude.length.should.eql(2)
})

it("Prefers 'tempDir' option over 'tempDirectory'", function () {
var nyc2 = new NYC({tempDir: './.temp_dir_test', tempDirectory: './.temp_directory_test'})
nyc2.tempDirectory().should.include('.temp_dir_test')
})

it("Falls back to use 'tempDirectory' option if 'tempDir' is not set", function () {
var nyc2 = new NYC({tempDirectory: './.temp_directory_test'})
nyc2.tempDirectory().should.include('.temp_directory_test')
})

it("Falls back to the default temp directory if neither 'tempDir' or 'tempDirectory is set", function () {
var nyc2 = new NYC({})
nyc2.tempDirectory().should.include('.nyc_output')
})
})

describe('shouldInstrumentFile', function () {
Expand Down