jsdoc-to-markdown
Advanced tools
Comparing version 2.0.0-alpha.19 to 2.0.0-alpha.20
@@ -48,3 +48,3 @@ 'use strict'; | ||
description: 'Prints the raw jsdoc data.' | ||
}, { name: 'version', type: Boolean }, { name: 'no-usage-stats', type: Boolean }, { | ||
}, { name: 'version', type: Boolean }, { name: 'no-usage-stats', type: Boolean }, { name: 'send', type: Boolean }, { | ||
name: 'no-cache', | ||
@@ -167,3 +167,3 @@ type: Boolean, | ||
optionList: jsdoc2mdDefinitions, | ||
hide: ['no-usage-stats', 'debug'] | ||
hide: ['no-usage-stats', 'send'] | ||
}, { | ||
@@ -170,0 +170,0 @@ header: 'jsdoc options', |
@@ -30,5 +30,9 @@ 'use strict'; | ||
var dmdOptions = new DmdOptions(options); | ||
return this.getTemplateData(options).then(function (templateData) { | ||
return dmd.async(templateData, dmdOptions); | ||
}); | ||
if (options.data) { | ||
return dmd.async(options.data, dmdOptions); | ||
} else { | ||
return this.getTemplateData(options).then(function (templateData) { | ||
return dmd.async(templateData, dmdOptions); | ||
}); | ||
} | ||
} | ||
@@ -40,3 +44,7 @@ }, { | ||
var dmdOptions = new DmdOptions(options); | ||
return dmd(this.getTemplateDataSync(options), dmdOptions); | ||
if (options.data) { | ||
return dmd(options.data, dmdOptions); | ||
} else { | ||
return dmd(this.getTemplateDataSync(options), dmdOptions); | ||
} | ||
} | ||
@@ -156,2 +164,3 @@ }, { | ||
if (exception) dimensions.exception = exception; | ||
this._sendOptions.send = options.send; | ||
return this._usage.hit(dimensions, metrics, this._sendOptions); | ||
@@ -158,0 +167,0 @@ } |
@@ -23,2 +23,34 @@ 'use strict'; | ||
runner.test('.render({ data })', function () { | ||
var data = [{ | ||
"id": "visible", | ||
"longname": "visible", | ||
"name": "visible", | ||
"kind": "member", | ||
"scope": "global", | ||
"description": "a visible global", | ||
"meta": { | ||
"lineno": 4, | ||
"filename": "ignore.js" | ||
}, | ||
"order": 0 | ||
}, { | ||
"id": "invisible", | ||
"longname": "invisible", | ||
"name": "invisible", | ||
"kind": "member", | ||
"scope": "global", | ||
"description": "an ignored global", | ||
"ignore": true, | ||
"meta": { | ||
"lineno": 10, | ||
"filename": "ignore.js" | ||
}, | ||
"order": 1 | ||
}]; | ||
return jsdoc2md.render({ data: data, cache: false }).then(function (result) { | ||
return a.ok(/a visible global/.test(result)); | ||
}); | ||
}); | ||
runner.test('.render({ files, heading-depth: 4 })', function () { | ||
@@ -25,0 +57,0 @@ return jsdoc2md.render({ files: inputFile, cache: false, 'heading-depth': 4 }).then(function (result) { |
'use strict'; | ||
if (!require('child_process').spawnSync) process.exit(0); | ||
var TestRunner = require('test-runner'); | ||
@@ -8,2 +10,3 @@ var jsdoc2md = require('../../'); | ||
var fs = require('fs'); | ||
try { | ||
@@ -19,28 +22,57 @@ fs.mkdirSync('tmp-test'); | ||
if (require('child_process').spawnSync) { | ||
runner.test('.renderSync({ files })', function () { | ||
var result = jsdoc2md.renderSync({ files: inputFile, cache: false }); | ||
a.ok(/a visible global/.test(result)); | ||
}); | ||
runner.test('.renderSync({ files })', function () { | ||
var result = jsdoc2md.renderSync({ files: inputFile, cache: false }); | ||
a.ok(/a visible global/.test(result)); | ||
}); | ||
runner.test('.renderSync({ files, heading-depth: 4 })', function () { | ||
var result = jsdoc2md.renderSync({ files: inputFile, cache: false, 'heading-depth': 4 }); | ||
a.ok(/#### visible/.test(result)); | ||
}); | ||
runner.test('.renderSync({ data })', function () { | ||
var data = [{ | ||
"id": "visible", | ||
"longname": "visible", | ||
"name": "visible", | ||
"kind": "member", | ||
"scope": "global", | ||
"description": "a visible global", | ||
"meta": { | ||
"lineno": 4, | ||
"filename": "ignore.js" | ||
}, | ||
"order": 0 | ||
}, { | ||
"id": "invisible", | ||
"longname": "invisible", | ||
"name": "invisible", | ||
"kind": "member", | ||
"scope": "global", | ||
"description": "an ignored global", | ||
"ignore": true, | ||
"meta": { | ||
"lineno": 10, | ||
"filename": "ignore.js" | ||
}, | ||
"order": 1 | ||
}]; | ||
var result = jsdoc2md.renderSync({ data: data, cache: false }); | ||
a.ok(/a visible global/.test(result)); | ||
}); | ||
runner.test('.renderSync({ files }, { param-list-format: list })', function () { | ||
var inputFile = 'src/test/fixture/params.js'; | ||
var result = jsdoc2md.renderSync({ files: inputFile, cache: false, 'param-list-format': 'list' }); | ||
a.ok(/- one/.test(result)); | ||
}); | ||
runner.test('.renderSync({ files, heading-depth: 4 })', function () { | ||
var result = jsdoc2md.renderSync({ files: inputFile, cache: false, 'heading-depth': 4 }); | ||
a.ok(/#### visible/.test(result)); | ||
}); | ||
runner.test('.getTemplateDataSync({ files })', function () { | ||
var result = jsdoc2md.getTemplateDataSync({ files: inputFile, cache: false }); | ||
a.ok(result[0].id); | ||
}); | ||
runner.test('.renderSync({ files }, { param-list-format: list })', function () { | ||
var inputFile = 'src/test/fixture/params.js'; | ||
var result = jsdoc2md.renderSync({ files: inputFile, cache: false, 'param-list-format': 'list' }); | ||
a.ok(/- one/.test(result)); | ||
}); | ||
runner.test('.getJsdocDataSync({ files })', function () { | ||
var result = jsdoc2md.getJsdocDataSync({ files: inputFile, cache: false }); | ||
a.ok(result[0].longname); | ||
}); | ||
} | ||
runner.test('.getTemplateDataSync({ files })', function () { | ||
var result = jsdoc2md.getTemplateDataSync({ files: inputFile, cache: false }); | ||
a.ok(result[0].id); | ||
}); | ||
runner.test('.getJsdocDataSync({ files })', function () { | ||
var result = jsdoc2md.getJsdocDataSync({ files: inputFile, cache: false }); | ||
a.ok(result[0].longname); | ||
}); |
{ | ||
"name": "jsdoc-to-markdown", | ||
"author": "Lloyd Brookes", | ||
"version": "2.0.0-alpha.19", | ||
"version": "2.0.0-alpha.20", | ||
"description": "jsdoc-annotated source in, markdown API docs out.", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/jsdoc2md/jsdoc-to-markdown", |
@@ -62,2 +62,3 @@ 'use strict' | ||
{ name: 'no-usage-stats', type: Boolean }, | ||
{ name: 'send', type: Boolean }, | ||
{ | ||
@@ -214,3 +215,3 @@ name: 'no-cache', | ||
optionList: jsdoc2mdDefinitions, | ||
hide: [ 'no-usage-stats', 'debug' ] | ||
hide: [ 'no-usage-stats', 'send' ] | ||
}, | ||
@@ -217,0 +218,0 @@ { |
@@ -19,4 +19,8 @@ 'use strict' | ||
const dmdOptions = new DmdOptions(options) | ||
return this.getTemplateData(options) | ||
.then(templateData => dmd.async(templateData, dmdOptions)) | ||
if (options.data) { | ||
return dmd.async(options.data, dmdOptions) | ||
} else { | ||
return this.getTemplateData(options) | ||
.then(templateData => dmd.async(templateData, dmdOptions)) | ||
} | ||
} | ||
@@ -27,3 +31,7 @@ | ||
const dmdOptions = new DmdOptions(options) | ||
return dmd(this.getTemplateDataSync(options), dmdOptions) | ||
if (options.data) { | ||
return dmd(options.data, dmdOptions) | ||
} else { | ||
return dmd(this.getTemplateDataSync(options), dmdOptions) | ||
} | ||
} | ||
@@ -133,2 +141,3 @@ | ||
if (exception) dimensions.exception = exception | ||
this._sendOptions.send = options.send | ||
return this._usage.hit(dimensions, metrics, this._sendOptions) | ||
@@ -135,0 +144,0 @@ } |
@@ -23,2 +23,36 @@ 'use strict' | ||
runner.test('.render({ data })', function () { | ||
const data = [ | ||
{ | ||
"id": "visible", | ||
"longname": "visible", | ||
"name": "visible", | ||
"kind": "member", | ||
"scope": "global", | ||
"description": "a visible global", | ||
"meta": { | ||
"lineno": 4, | ||
"filename": "ignore.js" | ||
}, | ||
"order": 0 | ||
}, | ||
{ | ||
"id": "invisible", | ||
"longname": "invisible", | ||
"name": "invisible", | ||
"kind": "member", | ||
"scope": "global", | ||
"description": "an ignored global", | ||
"ignore": true, | ||
"meta": { | ||
"lineno": 10, | ||
"filename": "ignore.js" | ||
}, | ||
"order": 1 | ||
} | ||
] | ||
return jsdoc2md.render({ data: data, cache: false }) | ||
.then(result => a.ok(/a visible global/.test(result))) | ||
}) | ||
runner.test('.render({ files, heading-depth: 4 })', function () { | ||
@@ -25,0 +59,0 @@ return jsdoc2md.render({ files: inputFile, cache: false, 'heading-depth': 4 }) |
'use strict' | ||
/* only proceed if node 0.12 or above */ | ||
if (!require('child_process').spawnSync) process.exit(0) | ||
const TestRunner = require('test-runner') | ||
@@ -7,2 +10,3 @@ const jsdoc2md = require('../../') | ||
const fs = require('fs') | ||
try { | ||
@@ -20,28 +24,60 @@ fs.mkdirSync('tmp-test') | ||
if (require('child_process').spawnSync) { | ||
runner.test('.renderSync({ files })', function () { | ||
const result = jsdoc2md.renderSync({ files: inputFile, cache: false }) | ||
a.ok(/a visible global/.test(result)) | ||
}) | ||
runner.test('.renderSync({ files })', function () { | ||
const result = jsdoc2md.renderSync({ files: inputFile, cache: false }) | ||
a.ok(/a visible global/.test(result)) | ||
}) | ||
runner.test('.renderSync({ files, heading-depth: 4 })', function () { | ||
const result = jsdoc2md.renderSync({ files: inputFile, cache: false, 'heading-depth': 4 }) | ||
a.ok(/#### visible/.test(result)) | ||
}) | ||
runner.test('.renderSync({ data })', function () { | ||
const data = [ | ||
{ | ||
"id": "visible", | ||
"longname": "visible", | ||
"name": "visible", | ||
"kind": "member", | ||
"scope": "global", | ||
"description": "a visible global", | ||
"meta": { | ||
"lineno": 4, | ||
"filename": "ignore.js" | ||
}, | ||
"order": 0 | ||
}, | ||
{ | ||
"id": "invisible", | ||
"longname": "invisible", | ||
"name": "invisible", | ||
"kind": "member", | ||
"scope": "global", | ||
"description": "an ignored global", | ||
"ignore": true, | ||
"meta": { | ||
"lineno": 10, | ||
"filename": "ignore.js" | ||
}, | ||
"order": 1 | ||
} | ||
] | ||
const result = jsdoc2md.renderSync({ data: data, cache: false }) | ||
a.ok(/a visible global/.test(result)) | ||
}) | ||
runner.test('.renderSync({ files }, { param-list-format: list })', function () { | ||
const inputFile = 'src/test/fixture/params.js' | ||
const result = jsdoc2md.renderSync({ files: inputFile, cache: false, 'param-list-format': 'list' }) | ||
a.ok(/- one/.test(result)) | ||
}) | ||
runner.test('.renderSync({ files, heading-depth: 4 })', function () { | ||
const result = jsdoc2md.renderSync({ files: inputFile, cache: false, 'heading-depth': 4 }) | ||
a.ok(/#### visible/.test(result)) | ||
}) | ||
runner.test('.getTemplateDataSync({ files })', function () { | ||
const result = jsdoc2md.getTemplateDataSync({ files: inputFile, cache: false }) | ||
a.ok(result[0].id) | ||
}) | ||
runner.test('.renderSync({ files }, { param-list-format: list })', function () { | ||
const inputFile = 'src/test/fixture/params.js' | ||
const result = jsdoc2md.renderSync({ files: inputFile, cache: false, 'param-list-format': 'list' }) | ||
a.ok(/- one/.test(result)) | ||
}) | ||
runner.test('.getJsdocDataSync({ files })', function () { | ||
const result = jsdoc2md.getJsdocDataSync({ files: inputFile, cache: false }) | ||
a.ok(result[0].longname) | ||
}) | ||
} | ||
runner.test('.getTemplateDataSync({ files })', function () { | ||
const result = jsdoc2md.getTemplateDataSync({ files: inputFile, cache: false }) | ||
a.ok(result[0].id) | ||
}) | ||
runner.test('.getJsdocDataSync({ files })', function () { | ||
const result = jsdoc2md.getJsdocDataSync({ files: inputFile, cache: false }) | ||
a.ok(result[0].longname) | ||
}) |
70704
1598