2019-07-24 00:55:31 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
JSON_FILE="${1:-}"
|
|
|
|
if test -z "$JSON_FILE"; then
|
|
|
|
echo "Please specify a report JSON file as the first argument."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
jq -r -f script/axe-report.jq "$JSON_FILE"
|
|
|
|
|
|
|
|
NUM_ERRORS="$(jq '.violations | map(.nodes | length) | add' "$JSON_FILE")"
|
2020-09-05 00:23:20 +03:00
|
|
|
if [ -z "$NUM_ERRORS" ];
|
|
|
|
then
|
|
|
|
echo "$NUM_ERRORS accessibility errors"
|
2019-07-24 01:10:08 +03:00
|
|
|
echo
|
2020-09-05 00:23:20 +03:00
|
|
|
echo "To see these errors, run 'make axe-report > errors.new' and open 'errors.new'"
|
2019-07-29 21:47:50 +03:00
|
|
|
exit 1
|
2019-07-24 00:55:31 +03:00
|
|
|
fi
|