Skip to content

Commit 8fd8d6c

Browse files
authored
feat(axe-core-4.2.0): add axe core 4.2.0 support (#660)
#### Details Per usual, this doesn't have any new behavior changes to the library or impact for customers; this adds pinning test cases and documents that we have verified support for 4.2.0, following the axe-core update process outlined in the README. ##### Motivation Keep support up to date with latest axe-core version, keep web/service/libs in sync ##### Context microsoft/accessibility-insights-web#4155 #### Pull request checklist <!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox --> - [x] PR title respects [Conventional Commits](https://www.conventionalcommits.org) (starts with `fix:`, `feat:`, etc, and is suitable for user-facing release notes) - [x] PR contains no breaking changes, **OR** description of both PR **and final merge commit** starts with `BREAKING CHANGE:` - [n/a] (if applicable) Addresses issue: #0000 - [x] Added relevant unit tests for your changes - [x] Ran `yarn precheckin` - [x] Verified code coverage for the changes made
1 parent 6537590 commit 8fd8d6c

17 files changed

+107830
-137
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The [microsoft/axe-pipelines-samples](https://github.com/microsoft/axe-pipelines
6666
6767
The version number of this library is **independent** from the version numbers of the axe-core inputs and SARIF outputs it supports.
6868
69-
- axe-sarif-converter version 2.x supports input from version ^3.2.0 || ^4.0.0 of axe-core (tested with 3.2.2, 3.3.2, 3.4.1, 3.4.2, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.5.5, 4.0.1, 4.0.2, and 4.1.1) and outputs SARIF v2.1
69+
- axe-sarif-converter version 2.x supports input from version ^3.2.0 || ^4.0.0 of axe-core (tested with 3.2.2, 3.3.2, 3.4.1, 3.4.2, 3.5.1, 3.5.2, 3.5.3, 3.5.4, 3.5.5, 4.0.1, 4.0.2, 4.1.1, and 4.2.0) and outputs SARIF v2.1
7070
- axe-sarif-converter version 1.x supports input from version >= 3.2.0 < 3.3.0 of axe-core (tested with 3.2.2) and outputs SARIF v2.0
7171
7272
Note that the SARIF format _does not use semantic versioning_, and there are breaking changes between the v2.0 and v2.1 SARIF formats. If you need compatibility with a SARIF viewer that only supports v2.0, you should use version 1.x of this library.

src/__snapshots__/index.test.ts.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -1388,15 +1388,15 @@ Object {
13881388
],
13891389
"tool": Object {
13901390
"driver": Object {
1391-
"downloadUri": "https://www.npmjs.com/package/axe-core/v/4.1.1",
1392-
"fullName": "axe for Web v4.1.1",
1391+
"downloadUri": "https://www.npmjs.com/package/axe-core/v/4.2.0",
1392+
"fullName": "axe for Web v4.2.0",
13931393
"informationUri": "https://www.deque.com/axe/axe-for-web/",
13941394
"name": "axe-core",
13951395
"properties": Object {
13961396
"microsoft/qualityDomain": "Accessibility",
13971397
},
13981398
"rules": Array [],
1399-
"semanticVersion": "4.1.1",
1399+
"semanticVersion": "4.2.0",
14001400
"shortDescription": Object {
14011401
"text": "An open source accessibility rules library for automated testing.",
14021402
},
@@ -1407,7 +1407,7 @@ Object {
14071407
"name": "WCAG",
14081408
},
14091409
],
1410-
"version": "4.1.1",
1410+
"version": "4.2.0",
14111411
},
14121412
},
14131413
},

src/cli.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ describe('axe-sarif-converter CLI', () => {
6565
${'w3citylights-axe-v4.0.2.axe-cli-v4.0.0.json'}
6666
${'basic-axe-v4.1.1.axe-cli-v4.1.0.json'}
6767
${'w3citylights-axe-v4.1.1.axe-cli-v4.1.0.json'}
68+
${'basic-axe-v4.2.0.axe-cli-v4.1.1.json'}
69+
${'w3citylights-axe-v4.2.0.axe-cli-v4.1.1.json'}
6870
`(
6971
'supports conversion from axe-cli output $inputFile',
7072
async ({ inputFile }) => {
@@ -183,11 +185,11 @@ describe('axe-sarif-converter CLI', () => {
183185
const testResultsDir = path.join(__dirname, '..', 'test-results');
184186
const basicAxeV2File = path.join(
185187
testResourcesDir,
186-
'basic-axe-v4.1.1.reporter-v2.json',
188+
'basic-axe-v4.2.0.reporter-v2.json',
187189
);
188190
const basicSarifFile = path.join(
189191
testResourcesDir,
190-
'basic-axe-v4.1.1.sarif',
192+
'basic-axe-v4.2.0.sarif',
191193
);
192194

193195
const mkdir = promisify(fs.mkdir);

src/index.test.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ describe('public convertAxeToSarif API', () => {
9393
${'basic-axe-v4.1.1.reporter-v2.json'} | ${'basic-axe-v4.1.1.sarif'}
9494
${'w3citylights-axe-v4.1.1.reporter-v1.json'} | ${'w3citylights-axe-v4.1.1.sarif'}
9595
${'w3citylights-axe-v4.1.1.reporter-v2.json'} | ${'w3citylights-axe-v4.1.1.sarif'}
96+
${'basic-axe-v4.2.0.reporter-v1.json'} | ${'basic-axe-v4.2.0.sarif'}
97+
${'basic-axe-v4.2.0.reporter-v2.json'} | ${'basic-axe-v4.2.0.sarif'}
98+
${'w3citylights-axe-v4.2.0.reporter-v1.json'} | ${'w3citylights-axe-v4.2.0.sarif'}
99+
${'w3citylights-axe-v4.2.0.reporter-v2.json'} | ${'w3citylights-axe-v4.2.0.sarif'}
96100
`(
97101
'converts pinned v1/v2 input $inputFile to pinned output $outputFile',
98102
({ inputFile, outputFile }) => {
@@ -137,7 +141,7 @@ describe('public sarifReporter API', () => {
137141
// it isn't very meaningful to test cases that involve old axe versions here.
138142
it.each`
139143
inputFile | outputFile
140-
${'basic-axe-v4.1.1.reporter-raw.json'} | ${'basic-axe-v4.1.1.sarif'}
144+
${'basic-axe-v4.2.0.reporter-raw.json'} | ${'basic-axe-v4.2.0.sarif'}
141145
`(
142146
'converts pinned raw input $inputFile to pinned output $outputFile',
143147
async ({ inputFile, outputFile }) => {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[
2+
{
3+
"inapplicable": [],
4+
"incomplete": [],
5+
"passes": [],
6+
"testEngine": {
7+
"name": "axe-core",
8+
"version": "4.2.0"
9+
},
10+
"testEnvironment": {
11+
"orientationAngle": 0,
12+
"orientationType": "landscape-primary",
13+
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/90.0.4430.93 Safari/537.36",
14+
"windowHeight": 600,
15+
"windowWidth": 800
16+
},
17+
"testRunner": {
18+
"name": "axe"
19+
},
20+
"timestamp": "2021-04-30T21:12:27.690Z",
21+
"toolOptions": {
22+
"reporter": "v1",
23+
"runOnly": {
24+
"type": "rule",
25+
"values": [
26+
"document-title"
27+
]
28+
}
29+
},
30+
"url": "file:///C:/repos/axe-sarif-converter/src/test-resources/basic.html",
31+
"violations": [
32+
{
33+
"description": "Ensures each HTML document contains a non-empty <title> element",
34+
"help": "Documents must have <title> element to aid in navigation",
35+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.2/document-title?application=webdriverjs",
36+
"id": "document-title",
37+
"impact": "serious",
38+
"nodes": [
39+
{
40+
"all": [],
41+
"any": [
42+
{
43+
"data": null,
44+
"id": "doc-has-title",
45+
"impact": "serious",
46+
"message": "Document does not have a non-empty <title> element",
47+
"relatedNodes": []
48+
}
49+
],
50+
"failureSummary": "Fix any of the following:\n Document does not have a non-empty <title> element",
51+
"html": "<html class=\"deque-axe-is-ready\"><head></head><body>\n</body><script>document.documentElement.classList.add(\"deque-axe-is-ready\");</script></html>",
52+
"impact": "serious",
53+
"none": [],
54+
"target": [
55+
"html"
56+
]
57+
}
58+
],
59+
"tags": [
60+
"cat.text-alternatives",
61+
"wcag2a",
62+
"wcag242",
63+
"ACT"
64+
]
65+
}
66+
]
67+
}
68+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[
2+
{
3+
"id": "document-title",
4+
"result": "failed",
5+
"pageLevel": false,
6+
"impact": "serious",
7+
"tags": [
8+
"cat.text-alternatives",
9+
"wcag2a",
10+
"wcag242",
11+
"ACT"
12+
],
13+
"description": "Ensures each HTML document contains a non-empty <title> element",
14+
"help": "Documents must have <title> element to aid in navigation",
15+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.2/document-title?application=axe-puppeteer",
16+
"inapplicable": [],
17+
"passes": [],
18+
"incomplete": [],
19+
"violations": [
20+
{
21+
"any": [
22+
{
23+
"id": "doc-has-title",
24+
"data": null,
25+
"relatedNodes": [],
26+
"impact": "serious",
27+
"message": "Document does not have a non-empty <title> element"
28+
}
29+
],
30+
"all": [],
31+
"none": [],
32+
"node": {
33+
"selector": [
34+
"html"
35+
],
36+
"source": "<html><head></head><body>\n</body></html>",
37+
"xpath": [
38+
"/html"
39+
],
40+
"ancestry": [
41+
"html"
42+
]
43+
},
44+
"impact": "serious",
45+
"result": "failed"
46+
}
47+
]
48+
}
49+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"testEngine": {
3+
"name": "axe-core",
4+
"version": "4.2.0"
5+
},
6+
"testRunner": {
7+
"name": "axe"
8+
},
9+
"testEnvironment": {
10+
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/91.0.4469.0 Safari/537.36",
11+
"windowWidth": 800,
12+
"windowHeight": 600,
13+
"orientationAngle": 0,
14+
"orientationType": "portrait-primary"
15+
},
16+
"timestamp": "2000-01-02T03:04:05.006Z",
17+
"url": "http://localhost/",
18+
"toolOptions": {
19+
"xpath": true,
20+
"runOnly": {
21+
"type": "rule",
22+
"values": [
23+
"document-title"
24+
]
25+
},
26+
"reporter": "v1"
27+
},
28+
"violations": [
29+
{
30+
"id": "document-title",
31+
"impact": "serious",
32+
"tags": [
33+
"cat.text-alternatives",
34+
"wcag2a",
35+
"wcag242",
36+
"ACT"
37+
],
38+
"description": "Ensures each HTML document contains a non-empty <title> element",
39+
"help": "Documents must have <title> element to aid in navigation",
40+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.2/document-title?application=axe-puppeteer",
41+
"nodes": [
42+
{
43+
"any": [
44+
{
45+
"id": "doc-has-title",
46+
"data": null,
47+
"relatedNodes": [],
48+
"impact": "serious",
49+
"message": "Document does not have a non-empty <title> element"
50+
}
51+
],
52+
"all": [],
53+
"none": [],
54+
"impact": "serious",
55+
"html": "<html><head></head><body>\n</body></html>",
56+
"target": [
57+
"html"
58+
],
59+
"xpath": [
60+
"/html"
61+
],
62+
"failureSummary": "Fix any of the following:\n Document does not have a non-empty <title> element"
63+
}
64+
]
65+
}
66+
],
67+
"passes": [],
68+
"incomplete": [],
69+
"inapplicable": []
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"testEngine": {
3+
"name": "axe-core",
4+
"version": "4.2.0"
5+
},
6+
"testRunner": {
7+
"name": "axe"
8+
},
9+
"testEnvironment": {
10+
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/91.0.4469.0 Safari/537.36",
11+
"windowWidth": 800,
12+
"windowHeight": 600,
13+
"orientationAngle": 0,
14+
"orientationType": "portrait-primary"
15+
},
16+
"timestamp": "2000-01-02T03:04:05.006Z",
17+
"url": "http://localhost/",
18+
"toolOptions": {
19+
"xpath": true,
20+
"runOnly": {
21+
"type": "rule",
22+
"values": [
23+
"document-title"
24+
]
25+
},
26+
"reporter": "v2"
27+
},
28+
"violations": [
29+
{
30+
"id": "document-title",
31+
"impact": "serious",
32+
"tags": [
33+
"cat.text-alternatives",
34+
"wcag2a",
35+
"wcag242",
36+
"ACT"
37+
],
38+
"description": "Ensures each HTML document contains a non-empty <title> element",
39+
"help": "Documents must have <title> element to aid in navigation",
40+
"helpUrl": "https://dequeuniversity.com/rules/axe/4.2/document-title?application=axe-puppeteer",
41+
"nodes": [
42+
{
43+
"any": [
44+
{
45+
"id": "doc-has-title",
46+
"data": null,
47+
"relatedNodes": [],
48+
"impact": "serious",
49+
"message": "Document does not have a non-empty <title> element"
50+
}
51+
],
52+
"all": [],
53+
"none": [],
54+
"impact": "serious",
55+
"html": "<html><head></head><body>\n</body></html>",
56+
"target": [
57+
"html"
58+
],
59+
"xpath": [
60+
"/html"
61+
]
62+
}
63+
]
64+
}
65+
],
66+
"passes": [],
67+
"incomplete": [],
68+
"inapplicable": []
69+
}

0 commit comments

Comments
 (0)