mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-18 14:17:30 +00:00
Improve test coverage
This commit is contained in:
parent
33552c6e8a
commit
463bb4e62f
10
lib/args.js
10
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');
|
||||
|
||||
@ -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));
|
||||
};
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user