Skip to content

Commit 47c99b4

Browse files
committed
test: 100% test coverage 🎉
Make CLI, which is mainly for testing, use the no-argument form of Logger() when possible in order to achieve 100% branch coverage in Logger() function. Remove the un-used support for boolean flags that default to true (would emit a --no-OPT entry in the usage message), bringing the cli itself up to 100% coverage. This package now has 100% line and branch coverage. Signed-off-by: Ryan Graham <[email protected]>
1 parent 213137d commit 47c99b4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/cli.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ function cli(args) {
2121
version($0, p);
2222
} else if (opts.h || opts.help) {
2323
usage($0, p);
24+
} else if (args.length < 3) {
25+
process.stdin.pipe(Logger()).pipe(process.stdout);
2426
} else {
2527
process.stdin.pipe(Logger(opts)).pipe(process.stdout);
2628
}
@@ -48,9 +50,8 @@ function usage($0, p) {
4850
p('');
4951

5052
function boolOpt(name, def) {
51-
name = def ? 'no-' + name : name;
5253
name = name + PADDING.slice(0, 20-name.length);
53-
p(' --%s default: %s', name, def ? 'on' : 'off');
54+
p(' --%s default: %s', name, def);
5455
}
5556

5657
function stdOpt(name, def) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"main": "index.js",
2626
"scripts": {
27-
"test": "tap --coverage --coverage-report=cobertura test/test-*"
27+
"test": "tap --100 test/test-*"
2828
},
2929
"dependencies": {
3030
"byline": "^5.0.0",

0 commit comments

Comments
 (0)