Skip to content

Commit

Permalink
Run YUIDoc on single it
Browse files Browse the repository at this point in the history
  • Loading branch information
sduquej committed Apr 17, 2017
1 parent 22884be commit 80028dd
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions tests/unit/docs-lint-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,37 @@ describe('YUIDoc', function() {
});
let yuiDoc = new Y.YUIDoc(options);

let json = yuiDoc.run();
it('parses without warnings', function() {
let json = yuiDoc.run();

let warnings = {};
json.warnings.forEach(function(warning) {
let tmp = warning.line.split(':');
let file = tmp[0].trim();
let line = tmp[1];
let warnings = {};
json.warnings.forEach(function(warning) {
let tmp = warning.line.split(':');
let file = tmp[0].trim();
let line = tmp[1];

if (!warnings[file]) {
warnings[file] = [];
}
if (!warnings[file]) {
warnings[file] = [];
}

warnings[file].push({
line,
message: warning.message,
warnings[file].push({
line,
message: warning.message,
});
});
});

Object.keys(json.files).forEach(function(file) {
it(file, function() {
let fileWarnings = warnings[file];
if (fileWarnings) {
let message = `YUIDoc issues found:${EOL}${EOL}`;
fileWarnings.forEach(function(warning) {
message += `line ${warning.line}: ${warning.message}${EOL}`;
});

let error = new Error(message);
delete error.stack;
throw error;
}
let message = '';
Object.keys(warnings).forEach(function(file) {
message += `\t${file} – YUIDoc issues found:${EOL}${EOL}`;
warnings[file].forEach(function(warning) {
message += `\t\tline ${warning.line}: ${warning.message}${EOL}`;
});
});

if (message.length) {
let error = new Error(message);
delete error.stack;
throw error;
}
});
});

0 comments on commit 80028dd

Please sign in to comment.