Skip to content

Commit

Permalink
Use dashed options, add temp-directory option for report, lose istanb…
Browse files Browse the repository at this point in the history
…ul dep fully
  • Loading branch information
ananthk committed Jul 10, 2016
1 parent 98ad477 commit 155de13
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions bin/nyc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ var yargs = require('yargs/yargs')(process.argv.slice(2))
describe: 'directory to output coverage reports in',
default: 'coverage'
})
.option('temp-directory', {
describe: 'directory from which coverage JSON files are read',
default: './.nyc_output'
})
.example('$0 report --reporter=lcov', 'output an HTML lcov report to ./coverage')
})
.command('check-coverage', 'check whether coverage is within thresholds provided', function (yargs) {
Expand Down Expand Up @@ -127,12 +131,12 @@ var yargs = require('yargs/yargs')(process.argv.slice(2))
type: 'boolean',
description: 'should nyc handle instrumentation?'
})
.option('hookRunInContext', {
.option('hook-run-in-context', {
default: false,
type: 'boolean',
description: 'should nyc wrap vm.runInThisContext?'
})
.option('hookCreateScript', {
.option('hook-create-script', {
default: false,
type: 'boolean',
description: 'should nyc wrap vm.createScript?'
Expand Down Expand Up @@ -232,7 +236,8 @@ function report (argv) {

;(new NYC({
reporter: argv.reporter,
reportDir: argv.reportDir
reportDir: argv.reportDir,
tempDirectory: argv.tempDirectory
})).report()
}

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",
"run-tests": "tap -t120 --no-cov -b ./test/build/*.js ./test/src/nyc-bin.js",
"report": "istanbul report --include=./.self_coverage/*.json lcov text",
"report": "node ./bin/nyc --temp-directory ./.self_coverage/ -r text -r lcov report",
"cover": "npm run clean && npm run build && npm run instrument && npm run run-tests && npm run report",
"dev": "npm run clean && npm run build && npm run run-tests",
"version": "standard-version"
Expand Down
2 changes: 1 addition & 1 deletion test/src/nyc-bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ describe('the nyc cli', function () {

describe('hooks', function () {
it('provides coverage for requireJS and AMD modules', function (done) {
var args = [bin, '--hookRunInContext', process.execPath, './index.js']
var args = [bin, '--hook-run-in-context', process.execPath, './index.js']

var proc = spawn(process.execPath, args, {
cwd: fixturesHooks,
Expand Down

0 comments on commit 155de13

Please sign in to comment.