File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed
a11y-check-axe-scenario/src Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type { Page } from 'puppeteer';
55
66import { convertResultsFromNode } from './convert-results-from-node.js' ;
77import { detectLevel } from './detect-level.js' ;
8+ import { detectSeverity } from './detect-severity.js' ;
89import { inferExplanation } from './infer-explanation.js' ;
910import { p } from './paragraph.js' ;
1011import { tagsToSCs } from './tags-to-scs.js' ;
@@ -64,6 +65,7 @@ export async function convertResultsFromViolations(
6465 wcagVersion : violation . tags . includes ( 'wcag2a' ) ? 'WCAG2.0' : 'WCAG2.1' ,
6566 scNumber : tagsToSCs ( violation . tags ) ,
6667 level : detectLevel ( violation . tags ) ,
68+ severity : detectSeverity ( violation . impact ) ,
6769 screenshot : nodeResult ?. screenshot ?? null ,
6870 } ) ;
6971 }
Original file line number Diff line number Diff line change 1+ /**
2+ *
3+ * @param impact
4+ */
5+ export function detectSeverity (
6+ impact ?: 'serious' | 'minor' | 'moderate' | 'critical' | null ,
7+ ) : 'high' | 'medium' | 'low' | null {
8+ if ( ! impact ) {
9+ return null ;
10+ }
11+ switch ( impact ) {
12+ case 'serious' : {
13+ return 'high' ;
14+ }
15+ case 'minor' : {
16+ return 'medium' ;
17+ }
18+ case 'moderate' : {
19+ return 'low' ;
20+ }
21+ case 'critical' : {
22+ return 'high' ;
23+ }
24+ }
25+ }
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ export type Violation = ResultData & {
6565 readonly wcagVersion : string | null ;
6666 readonly scNumber : string | null ;
6767 readonly level : 'A' | 'AA' | 'AAA' | null ;
68+ readonly severity : 'high' | 'medium' | 'low' | null ;
6869 readonly screenshot : string | null ;
6970} ;
7071
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ export class SpreadsheetReporter {
4444 wcagVersion : { value : result . wcagVersion } ,
4545 scNumber : { value : result . scNumber } ,
4646 level : { value : result . level } ,
47+ severity : { value : result . severity } ,
4748 screenshot : { value : result . screenshot } ,
4849 } ;
4950 } ) ,
@@ -111,6 +112,7 @@ export class SpreadsheetReporter {
111112 wcagVersion : 'WCAGバージョン' ,
112113 scNumber : '達成基準番号' ,
113114 level : '適合レベル' ,
115+ severity : '深刻度' ,
114116 screenshot : 'スクリーンショット' ,
115117 } ,
116118 } ,
You can’t perform that action at this time.
0 commit comments