Skip to content

Commit

Permalink
fix: don’t choke on –and report– missing KB links
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeltour committed Oct 4, 2017
1 parent 6134f6d commit 2bc94ab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/report/axe2ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,18 @@ function axe2ace(spineItem, axeResults) {
.withTestSubject(spineItem.relpath, spineItem.title);
// process axe's individual checks for a single content document
axeResults.violations.forEach((violation) => {
const kbURL = (kbMap.map.hasOwnProperty(violation.id))
? kbMap.baseUrl + kbMap.map[violation.id].url
: kbMap.baseUrl;
const kbTitle = (kbMap.map.hasOwnProperty(violation.id))
? kbMap.map[violation.id].title
: 'Unknown';
if (kbTitle == 'Unknown') winston.verbose(`Couldn’t find KB key for rule '${violation.id}'`)
const test = new builders.TestBuilder()
.withImpact(violation.impact)
.withTitle(violation.id)
.withDescription(violation.description)
.withHelp(kbMap.baseUrl + kbMap.map[violation.id].url, kbMap.map[violation.id].title)
.withHelp(kbURL, kbTitle)
.build();
violation.nodes.forEach(node => assertion.withAssertion(
new builders.AssertionBuilder()
Expand Down

0 comments on commit 2bc94ab

Please sign in to comment.