Skip to content

Commit 463bb4e

Browse files
committed
Improve test coverage
1 parent 33552c6 commit 463bb4e

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

lib/args.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
var documentation = require('../'),
2-
path = require('path'),
1+
var path = require('path'),
2+
yargs = require('yargs'),
33
loadConfig = require('../lib/load_config.js');
4-
var yargs = require('yargs')
54

65
function parse(args) {
76
// reset() needs to be called at parse time because the yargs module uses an
@@ -98,11 +97,6 @@ module.exports = function (args) {
9897
}
9998
}
10099

101-
if (!documentation.formats[argv.f]) {
102-
yargs.showHelp();
103-
throw new Error('Formatter not found');
104-
}
105-
106100
if (argv.f === 'html' && argv.o === 'stdout') {
107101
yargs.showHelp();
108102
throw new Error('The HTML output mode requires a destination directory set with -o');

lib/output/json.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ var walk = require('../walk');
1313
*/
1414
module.exports = function (comments, opts, callback) {
1515

16-
opts = opts || {};
17-
18-
if (!opts.preserveErrors) {
19-
walk(comments, function (comment) {
20-
delete comment.errors;
21-
});
22-
}
16+
walk(comments, function (comment) {
17+
delete comment.errors;
18+
});
2319

2420
return callback(null, JSON.stringify(comments, null, 2));
2521
};

test/bin.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ test('bad -f option', function (t) {
9494
});
9595
}, options);
9696

97+
test('--version', function (t) {
98+
documentation(['--version'], {}, function (err, output) {
99+
t.ok(output, 'outputs version');
100+
t.end();
101+
}, false);
102+
}, options);
103+
97104
test('html with no destination', function (t) {
98105
documentation(['-f html fixture/internal.input.js'], function (err) {
99106
t.ok(err.toString()

0 commit comments

Comments
 (0)