Improve test coverage

This commit is contained in:
Tom MacWright 2015-11-09 13:08:56 -05:00
parent 33552c6e8a
commit 463bb4e62f
3 changed files with 12 additions and 15 deletions

View File

@ -1,7 +1,6 @@
var documentation = require('../'),
path = require('path'),
var path = require('path'),
yargs = require('yargs'),
loadConfig = require('../lib/load_config.js');
var yargs = require('yargs')
function parse(args) {
// reset() needs to be called at parse time because the yargs module uses an
@ -98,11 +97,6 @@ module.exports = function (args) {
}
}
if (!documentation.formats[argv.f]) {
yargs.showHelp();
throw new Error('Formatter not found');
}
if (argv.f === 'html' && argv.o === 'stdout') {
yargs.showHelp();
throw new Error('The HTML output mode requires a destination directory set with -o');

View File

@ -13,13 +13,9 @@ var walk = require('../walk');
*/
module.exports = function (comments, opts, callback) {
opts = opts || {};
if (!opts.preserveErrors) {
walk(comments, function (comment) {
delete comment.errors;
});
}
walk(comments, function (comment) {
delete comment.errors;
});
return callback(null, JSON.stringify(comments, null, 2));
};

View File

@ -94,6 +94,13 @@ test('bad -f option', function (t) {
});
}, options);
test('--version', function (t) {
documentation(['--version'], {}, function (err, output) {
t.ok(output, 'outputs version');
t.end();
}, false);
}, options);
test('html with no destination', function (t) {
documentation(['-f html fixture/internal.input.js'], function (err) {
t.ok(err.toString()