-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·46 lines (36 loc) · 978 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash -l
set -o pipefail
# Set user inputs
URLS="$1"
echo "URLS value is set to: $URLS"
main() {
echo $URLS >config.json
urls=$(cat config.json | jq '.[]' -r)
for url in ${urls[@]}; do
runTest $url
done
}
function runTest() {
URL=$1
FOLDER=$(echo "$URL" | sed -e 's/[^a-z0-9]//ig' -e 's/https//ig' -e 's/http//gi')
if [ -z $URL ]; then
echo "Missing URL!"
exit 1
fi
mkdir -p results/$FOLDER/webhint
mkdir -p results/$FOLDER/pa11y
echo "Running Webhint test on $URL..."
npx hint $URL >results/$FOLDER/webhint/results.txt
echo "||||||||||||||||||||||"
echo "||| webhint results ||"
echo "||||||||||||||||||||||"
cat results/$FOLDER/webhint/results.txt
echo "Running pa11y test on $URL..."
npx pa11y-ci $URL --reporter json >results/$FOLDER/pa11y/results.json
echo "||||||||||||||||||||||"
echo "|||| pa11y results |||"
echo "||||||||||||||||||||||"
jq '.' results/$FOLDER/pa11y/results.json
}
main "$@"
exit