File tree Expand file tree Collapse file tree 1 file changed +11
-18
lines changed
Expand file tree Collapse file tree 1 file changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -22,26 +22,19 @@ module.exports = {
2222 htmlFilePaths,
2323 pa11yOpts,
2424 } )
25- const log = issueCount === 0 ? console . log : failWithIssues ? build . failBuild : console . warn
26- log ( generatePostrunMessage ( issueCount , report ) )
25+ const reportSummary =
26+ `${ issueCount === 0 ? 'No' : issueCount } accessibility issues found!` +
27+ ( issueCount > 0 ? ' Check the logs for more information.' : '' )
28+
29+ console . log ( report )
30+
31+ if ( failWithIssues ) {
32+ build . failBuild ( reportSummary )
33+ } else {
34+ console . warn ( pico . magenta ( reportSummary ) )
35+ }
2736 } catch ( err ) {
2837 build . failBuild ( err . message )
2938 }
3039 } ,
3140}
32-
33- /**
34- * Generates the message sent to the build log after a11y checks have been peformed.
35- * @param {number } issueCount
36- * @param {string } report
37- */
38- function generatePostrunMessage ( issueCount , report ) {
39- // Only print a line between the report and the summary
40- // if the report has any contents.
41- const spacer = report . length > 0 ? '\n' : ''
42- const humanReadableCount = issueCount === 0 ? 'No' : issueCount
43- const summary = `${ humanReadableCount } accessibility violations found! ${
44- issueCount > 0 ? 'Check the logs above for more information.' : ''
45- } `
46- return report + spacer + pico . magenta ( summary )
47- }
You can’t perform that action at this time.
0 commit comments