Add pa11y-ci for accessibility testing.

Add pa11y-ci-reporter-html and also upload the HTML results to CI if there are failures
This commit is contained in:
XhmikosR -
parent cc3a5cf79a
commit e4b4eefdeb
5 changed files with 820 additions and 1 deletions

View file

@ -40,3 +40,17 @@ jobs:
- name: Test docs
run: npm run docs
- name: Run accessibility tests
run: npm run docs-accessibility
- name: Generate HTML accessibility results
run: npm run docs-pa11y-html
if: failure()
- name: Upload accessibility results
uses: actions/upload-artifact@v2
if: failure()
with:
name: pa11y-ci-results
path: .pa11y/

2
.gitignore vendored
View file

@ -50,3 +50,5 @@ Thumbs.db
# Folders to ignore
/js/coverage/
/node_modules/
/.pa11y/
/pa11y-ci-results.json

11
build/.pa11yci.json Normal file
View file

@ -0,0 +1,11 @@
{
"standard": "WCAG2AA",
"level": "error",
"concurrency": 4,
"runners": [
"htmlcs"
],
"defaults": {
"hideElements": ".bd-search, [class*=-success], [class*=-info], [class*=-light]"
}
}

785
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -58,8 +58,11 @@
"docs-linkinator": "linkinator _gh_pages --recurse --silent --skip \"^(?!http://localhost)\"",
"docs-vnu": "node build/vnu-jar.js",
"docs-lint": "npm-run-all --parallel docs-vnu docs-linkinator",
"docs-pa11y": "delay 3 && pa11y-ci --config build/.pa11yci.json --sitemap http://localhost:9001/sitemap.xml --sitemap-find https://getbootstrap.com --sitemap-replace http://localhost:9001 --json > pa11y-ci-results.json",
"docs-pa11y-html": "pa11y-ci-reporter-html -d .pa11y",
"docs-accessibility": "npm-run-all --parallel --race docs-serve-only docs-pa11y",
"docs-serve": "hugo server --port 9001 --disableFastRender",
"docs-serve-only": "npx sirv-cli _gh_pages --port 9001",
"docs-serve-only": "sirv _gh_pages --port 9001",
"lockfile-lint": "lockfile-lint --allowed-hosts npm --allowed-schemes https: --empty-hostname false --type npm --path package-lock.json",
"update-deps": "ncu -u -x terser && npm update && echo Manually update site/assets/js/vendor",
"release": "npm-run-all dist release-sri docs-build release-zip*",
@ -110,6 +113,7 @@
"bundlewatch": "^0.3.1",
"clean-css-cli": "^4.3.0",
"cross-env": "^7.0.3",
"delay-cli": "^1.1.0",
"eslint": "^7.15.0",
"eslint-config-xo": "^0.33.1",
"eslint-plugin-import": "^2.22.1",
@ -133,6 +137,8 @@
"lockfile-lint": "^4.3.7",
"nodemon": "^2.0.6",
"npm-run-all": "^4.1.5",
"pa11y-ci": "^2.4.0",
"pa11y-ci-reporter-html": "^2.1.1",
"postcss": "^8.2.1",
"postcss-cli": "^8.3.1",
"rollup": "^2.35.1",
@ -140,6 +146,7 @@
"rtlcss": "^3.0.0",
"sass": "^1.30.0",
"shelljs": "^0.8.4",
"sirv-cli": "^1.0.10",
"stylelint": "^13.8.0",
"stylelint-config-twbs-bootstrap": "^2.1.0",
"terser": "5.1.0",