(node: axe.NodeResult, result: axe.Result, url: string)
| 85 | } |
| 86 | |
| 87 | function toIssue(node: axe.NodeResult, result: axe.Result, url: string): Issue { |
| 88 | const selector = node.target?.[0] |
| 89 | ? formatSelector(node.target[0]) |
| 90 | : undefined; |
| 91 | |
| 92 | const message = formatNodeMessage(node, result.help); |
| 93 | |
| 94 | return { |
| 95 | message: truncateIssueMessage(message), |
| 96 | severity: impactToSeverity(node.impact), |
| 97 | source: { |
| 98 | url, |
| 99 | ...(node.html && { snippet: node.html }), |
| 100 | ...(selector && { selector }), |
| 101 | }, |
| 102 | }; |
| 103 | } |
| 104 | |
| 105 | function impactToSeverity(impact: axe.ImpactValue | undefined): IssueSeverity { |
| 106 | switch (impact) { |
no test coverage detected