Skip to content

Commit d900084

Browse files
committed
fix regression: passing jsdoc configuration (--conf) now works again
1 parent 7dbf61a commit d900084

5 files changed

Lines changed: 34 additions & 4 deletions

File tree

es5/jsdoc-parse.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ function jsdocParse(options) {
3939
}
4040

4141
var jsdocOptions = {};
42-
if (options.html) jsdocOptions.configure = path.resolve(__dirname, 'html-conf.json');
42+
43+
if (options.html) {
44+
jsdocOptions.configure = path.resolve(__dirname, 'html-conf.json');
45+
} else {
46+
jsdocOptions.configure = options.conf;
47+
}
4348
jsdocOptions.files = options.files;
4449

4550
var explainStream = jsdoc.createExplainStream(jsdocOptions);
@@ -105,7 +110,7 @@ var ParseOptions = (function () {
105110

106111
this.html = false;
107112

108-
this.conf = null;
113+
this.conf = undefined;
109114

110115
this['sort-by'] = ['scope', 'category', 'kind', 'order'];
111116

lib/jsdoc-parse.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ function jsdocParse (options) {
4444
}
4545

4646
const jsdocOptions = {}
47-
if (options.html) jsdocOptions.configure = path.resolve(__dirname, 'html-conf.json')
47+
48+
if (options.html) {
49+
jsdocOptions.configure = path.resolve(__dirname, 'html-conf.json')
50+
} else {
51+
jsdocOptions.configure = options.conf
52+
}
4853
jsdocOptions.files = options.files
4954

5055
const explainStream = jsdoc.createExplainStream(jsdocOptions)
@@ -157,7 +162,7 @@ class ParseOptions {
157162
* @type {boolean}
158163
* @default
159164
*/
160-
this.conf = null
165+
this.conf = undefined
161166

162167
/**
163168
* Sort by one of more fields, e.g. `--sort-by kind category`. Pass the special value `none` to remove the default sort order.

test/api.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22
var test = require('tape')
33
var parse = require('../')
4+
var fs = require('fs')
45

56
test('api: valid json out', function (t) {
67
t.plan(1)
@@ -26,3 +27,15 @@ test('api: glob expression', function (t) {
2627
}
2728
})
2829
})
30+
31+
test('api: conf', function (t) {
32+
t.plan(1)
33+
var stream = parse({ src: 'test/fixture/simple.js', conf: 'test/fixture/conf.json' })
34+
stream.on('readable', function () {
35+
var chunk = this.read()
36+
if (chunk) {
37+
var data = JSON.parse(chunk)
38+
t.strictEqual(data[0].description, 'A VARIABLE')
39+
}
40+
})
41+
})

test/fixture/conf.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": [ "plugins/shout" ]
3+
}

test/fixture/simple.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* A variable
3+
*/
4+
var one = 1

0 commit comments

Comments
 (0)