Skip to content

Commit 13fac59

Browse files
committed
Clean up config, final message
1 parent 5185e18 commit 13fac59

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

plugin/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ const getConfiguration = ({
2121
runners = runners || DEFAULT_RUNNERS;
2222

2323
if (isInvalidRunner(runners)) {
24-
throw new Error(`Invalid value for \`runners\` input. Runners must be ${AXE} or ${HTMLCS}`);
24+
throw new Error(`Invalid value for \`runners\` input. Runners must be \`${AXE}\` or \`${HTMLCS}\`.`);
2525
}
2626
return {
2727
absolutePublishDir: PUBLISH_DIR || process.env.PUBLISH_DIR,
2828
checkPaths: checkPaths || DEFAULT_CHECK_PATHS,
2929
debugMode: debugMode || false,
3030
ignoreDirectories: ignoreDirectories || DEFAULT_IGNORE_DIRECTORIES,
31+
resultMode: resultMode || DEFAULT_RESULT_MODE,
3132
pa11yOpts: {
3233
runners,
33-
resultMode: resultMode || DEFAULT_RESULT_MODE,
3434
userAgent: PA11Y_USER_AGENT,
3535
}
3636
}

plugin/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ module.exports = {
1414
checkPaths,
1515
debugMode,
1616
ignoreDirectories,
17-
pa11yOpts
17+
pa11yOpts,
18+
resultMode,
1819
} = getConfiguration({ constants, inputs })
1920
const htmlFilePaths = await pluginCore.generateFilePaths({
2021
absolutePublishDir,
@@ -32,8 +33,13 @@ module.exports = {
3233
pa11yOpts,
3334
});
3435
if (issueCount > 0) {
36+
const postRunMsg = `Pa11y found ${issueCount} accessibility issues with your site! Check the logs above for more information.`
3537
console.log(results);
36-
build.failBuild(`Pa11y found ${issueCount} accessibility issues with your site! Check the logs above for more information`);
38+
if (resultMode === 'error') {
39+
build.failBuild(postRunMsg)
40+
} else {
41+
console.warn(postRunMsg)
42+
}
3743
}
3844

3945
} catch(err) {

0 commit comments

Comments
 (0)