ignore empty block comments (#1398)

This commit is contained in:
Jeff Williams 2017-07-12 11:51:48 -07:00
parent 4047aa695d
commit b38b8db2d0
2 changed files with 22 additions and 1 deletions

View File

@ -479,7 +479,7 @@ Visitor.prototype.visit = function(node, filename) {
* @memberof module:jsdoc/src/parser.Parser
*/
function isValidJsdoc(commentSrc) {
return commentSrc && commentSrc.indexOf('/**') === 0 &&
return commentSrc && commentSrc.length > 4 && commentSrc.indexOf('/**') === 0 &&
commentSrc.indexOf('/***') !== 0;
}

View File

@ -93,6 +93,27 @@ describe('jsdoc/src/visitor', function() {
expect(events).toEqual([]);
});
it('should ignore empty block comments', function() {
var node = {
leadingComments: [
{
type: 'CommentBlock',
value: '',
loc: {
start: {
line: 0,
column: 0
}
}
}
]
};
visitor.visitNodeComments(node, parser, 'fake');
expect(events).toEqual([]);
});
it('should fire an event for JSDoc comments', function() {
var node = {
leadingComments: [