-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
172 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
var NYC | ||
try { | ||
NYC = require('../../index.covered.js') | ||
} catch (e) { | ||
NYC = require('../../index.js') | ||
} | ||
|
||
exports.command = 'check-coverage' | ||
|
||
exports.describe = 'check whether coverage is within thresholds provided' | ||
|
||
exports.builder = function (yargs) { | ||
yargs | ||
.option('branches', { | ||
default: 0, | ||
description: 'what % of branches must be covered?' | ||
}) | ||
.option('functions', { | ||
default: 0, | ||
description: 'what % of functions must be covered?' | ||
}) | ||
.option('lines', { | ||
default: 90, | ||
description: 'what % of lines must be covered?' | ||
}) | ||
.option('statements', { | ||
default: 0, | ||
description: 'what % of statements must be covered?' | ||
}) | ||
.option('per-file', { | ||
default: false, | ||
description: 'check thresholds per file' | ||
}) | ||
.example('$0 check-coverage --lines 95', "check whether the JSON in nyc's output folder meets the thresholds provided") | ||
} | ||
|
||
exports.handler = function (argv) { | ||
process.env.NYC_CWD = process.cwd() | ||
|
||
;(new NYC(argv)).checkCoverage({ | ||
lines: argv.lines, | ||
functions: argv.functions, | ||
branches: argv.branches, | ||
statements: argv.statements | ||
}, argv['per-file']) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
var NYC | ||
try { | ||
NYC = require('../../index.covered.js') | ||
} catch (e) { | ||
NYC = require('../../index.js') | ||
} | ||
|
||
exports.command = 'report' | ||
|
||
exports.describe = 'run coverage report for .nyc_output' | ||
|
||
exports.builder = function (yargs) { | ||
return yargs | ||
.option('reporter', { | ||
alias: 'r', | ||
describe: 'coverage reporter(s) to use', | ||
default: 'text' | ||
}) | ||
.option('report-dir', { | ||
describe: 'directory to output coverage reports in', | ||
default: 'coverage' | ||
}) | ||
.option('temp-directory', { | ||
describe: 'directory to read raw coverage information from', | ||
default: './.nyc_output' | ||
}) | ||
.option('show-process-tree', { | ||
describe: 'display the tree of spawned processes', | ||
default: false, | ||
type: 'boolean' | ||
}) | ||
.example('$0 report --reporter=lcov', 'output an HTML lcov report to ./coverage') | ||
} | ||
|
||
exports.handler = function (argv) { | ||
process.env.NYC_CWD = process.cwd() | ||
var nyc = new NYC(argv) | ||
nyc.report() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.