mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
don't log an error when a comment only contains whitespace (#698)
This commit is contained in:
parent
5c59bc1488
commit
abfa24578c
@ -130,7 +130,7 @@ function toTags(docletSrc) {
|
||||
}
|
||||
|
||||
function fixDescription(docletSrc) {
|
||||
if (!/^\s*@/.test(docletSrc)) {
|
||||
if (!/^\s*@/.test(docletSrc) && docletSrc.replace(/\s/g, '').length) {
|
||||
docletSrc = '@description ' + docletSrc;
|
||||
}
|
||||
return docletSrc;
|
||||
|
||||
27
test/fixtures/emptycomments.js
vendored
Normal file
27
test/fixtures/emptycomments.js
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/** */
|
||||
function first() {}
|
||||
|
||||
/** */
|
||||
function second() {}
|
||||
|
||||
// the next comment must contain a single hard tab (\t) character
|
||||
/** */
|
||||
function third() {}
|
||||
|
||||
// the next comment must contain at least two hard tab (\t) characters
|
||||
/** */
|
||||
function fourth() {}
|
||||
|
||||
// the next comment must contain one newline (\n) character
|
||||
/**
|
||||
*/
|
||||
function fifth() {}
|
||||
|
||||
// the next comment must contain multiple newline (\n) characters
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function sixth() {}
|
||||
15
test/specs/documentation/emptycomments.js
Normal file
15
test/specs/documentation/emptycomments.js
Normal file
@ -0,0 +1,15 @@
|
||||
/*global describe, expect, it, jasmine, spyOn */
|
||||
'use strict';
|
||||
|
||||
var logger = require('jsdoc/util/logger');
|
||||
|
||||
describe('empty JSDoc comments', function() {
|
||||
it('should not report an error when a JSDoc comment contains only whitespace', function() {
|
||||
var doclets;
|
||||
|
||||
spyOn(logger, 'error');
|
||||
doclets = jasmine.getDocSetFromFile('test/fixtures/emptycomments.js');
|
||||
|
||||
expect(logger.error).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user