diff --git a/lib/args.js b/lib/args.js index 93dad20..8199d91 100644 --- a/lib/args.js +++ b/lib/args.js @@ -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'); diff --git a/lib/output/json.js b/lib/output/json.js index 37f90c6..7608930 100644 --- a/lib/output/json.js +++ b/lib/output/json.js @@ -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)); }; diff --git a/test/bin.js b/test/bin.js index 1873057..b6ae255 100644 --- a/test/bin.js +++ b/test/bin.js @@ -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()