MCPcopy Create free account
hub / github.com/code-pushup/cli / toAuditOutput

Function toAuditOutput

packages/plugin-axe/src/lib/runner/transform.ts:39–64  ·  view source on GitHub ↗

* For failing audits (score 0), includes detailed issues with locations and severities. * For passing audits (score 1), only includes element count.

(
  result: axe.Result,
  url: string,
  score: number,
)

Source from the content-addressed store, hash-verified

37 * For passing audits (score 1), only includes element count.
38 */
39function toAuditOutput(
40 result: axe.Result,
41 url: string,
42 score: number,
43): AuditOutput {
44 const base = {
45 slug: result.id,
46 score,
47 value: result.nodes.length,
48 };
49
50 if (score === 0 && result.nodes.length > 0) {
51 const issues = result.nodes.map(node => toIssue(node, result, url));
52
53 return {
54 ...base,
55 displayValue: formatIssueSeverities(issues),
56 details: { issues },
57 };
58 }
59
60 return {
61 ...base,
62 displayValue: pluralizeToken('element', result.nodes.length),
63 };
64}
65
66function formatSelector(selector: axe.CrossTreeSelector): string {
67 if (typeof selector === 'string') {

Callers 1

toEntriesFunction · 0.85

Calls 3

formatIssueSeveritiesFunction · 0.90
pluralizeTokenFunction · 0.90
toIssueFunction · 0.85

Tested by

no test coverage detected