forked from pa11y/pa11y
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (28 loc) · 778 Bytes
/
index.js
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
// An example of running Pa11y on multiple URLS
'use strict';
const pa11y = require('../..');
runExample();
// Async function required for us to use await
async function runExample() {
try {
// Put together some options to use in each test
const options = {
log: {
debug: console.log,
error: console.error,
info: console.log
}
};
// Run tests against multiple URLs
const results = await Promise.all([
pa11y('http://example.com/', options),
pa11y('http://example.com/otherpage/', options)
]);
// Output the raw result objects
console.log(results[0]); // Results for the first URL
console.log(results[1]); // Results for the second URL
} catch (error) {
// Output an error if it occurred
console.error(error.message);
}
}