@axe-core/reporter-earl 4.7.3 → 4.7.4-2456ed6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -37
- package/dist/axeReporterEarl.d.ts +2 -2
- package/dist/axeReporterEarl.js +62 -102
- package/dist/axeReporterEarl.mjs +62 -108
- package/esmTest.mjs +1 -1
- package/package.json +6 -7
- package/src/axeReporterEarl.ts +1 -1
- package/src/axeResultToEarl.ts +25 -27
- package/src/testResult.ts +8 -10
- package/src/types.ts +0 -6
- package/tests/axeReporterEarl.test.ts +11 -3
- package/tests/axeResultToEarl.test.ts +1 -0
- package/tests/testResult.test.ts +1 -0
- package/tests/utils.ts +10 -3
- package/tsconfig.json +1 -13
package/CHANGELOG.md
CHANGED
|
@@ -7,70 +7,38 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @axe-core/reporter-earl
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
10
|
## [4.7.2](https://github.com/dequelabs/axe-core-npm/compare/v4.7.1...v4.7.2) (2023-06-01)
|
|
15
11
|
|
|
16
12
|
**Note:** Version bump only for package @axe-core/reporter-earl
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
14
|
## [4.7.1](https://github.com/dequelabs/axe-core-npm/compare/v4.7.0...v4.7.1) (2023-05-02)
|
|
23
15
|
|
|
24
16
|
**Note:** Version bump only for package @axe-core/reporter-earl
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
18
|
# [4.7.0](https://github.com/dequelabs/axe-core-npm/compare/v4.6.1...v4.7.0) (2023-04-28)
|
|
31
19
|
|
|
32
|
-
|
|
33
20
|
### Features
|
|
34
21
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
- enable esm import ([#713](https://github.com/dequelabs/axe-core-npm/issues/713)) ([076bfa9](https://github.com/dequelabs/axe-core-npm/commit/076bfa99f27f416b4eaff6d24cc23e8573fc72ee))
|
|
23
|
+
- Update axe-core to v4.7.0 ([#709](https://github.com/dequelabs/axe-core-npm/issues/709)) ([d418d09](https://github.com/dequelabs/axe-core-npm/commit/d418d093b4c462d5d60e0f7ad3d5147bcaf52aa2))
|
|
41
24
|
|
|
42
25
|
## [4.6.1](https://github.com/dequelabs/axe-core-npm/compare/v4.6.0...v4.6.1) (2023-03-28)
|
|
43
26
|
|
|
44
|
-
|
|
45
27
|
### Bug Fixes
|
|
46
28
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
- Update axe-core to v4.6.3 ([#698](https://github.com/dequelabs/axe-core-npm/issues/698)) ([a7d53a4](https://github.com/dequelabs/axe-core-npm/commit/a7d53a4876237c74bb8dc2836b703cdaf2f7ace5))
|
|
52
30
|
|
|
53
31
|
# [4.6.0](https://github.com/dequelabs/axe-core-npm/compare/v4.5.2...v4.6.0) (2023-01-19)
|
|
54
32
|
|
|
55
|
-
|
|
56
33
|
### Features
|
|
57
34
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
35
|
+
- Update axe-core to v4.6.1 ([#633](https://github.com/dequelabs/axe-core-npm/issues/633)) ([8bab5b2](https://github.com/dequelabs/axe-core-npm/commit/8bab5b23b3653a6a0603f10d889e22418a4fff3e))
|
|
63
36
|
|
|
64
37
|
## [4.5.2](https://github.com/dequelabs/axe-core-npm/compare/v4.5.1...v4.5.2) (2022-11-15)
|
|
65
38
|
|
|
66
|
-
|
|
67
39
|
### Bug Fixes
|
|
68
40
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
41
|
+
- update to use axe-core 4.5.2 ([#607](https://github.com/dequelabs/axe-core-npm/issues/607)) ([61312ff](https://github.com/dequelabs/axe-core-npm/commit/61312fff2e9ee4e0f218a29a1608f69b45206fad))
|
|
74
42
|
|
|
75
43
|
## [4.5.1](https://github.com/dequelabs/axe-core-npm/compare/v4.5.0...v4.5.1) (2022-11-03)
|
|
76
44
|
|
|
@@ -40,8 +40,8 @@ interface RawNodeResult {
|
|
|
40
40
|
};
|
|
41
41
|
result?: 'passed' | 'failed' | 'inapplicable' | 'incomplete';
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
type SelectorItem = string[] | string;
|
|
44
|
+
type Selector = SelectorItem[];
|
|
45
45
|
|
|
46
46
|
declare function createEarlReport(rawResults: RawResult[], url?: string): EarlResult;
|
|
47
47
|
declare function axeReporterEarl(rawResults: RawResult[], {}: {}, callback: Function): void;
|
package/dist/axeReporterEarl.js
CHANGED
|
@@ -26,69 +26,33 @@ __export(axeReporterEarl_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(axeReporterEarl_exports);
|
|
27
27
|
|
|
28
28
|
// src/context.json
|
|
29
|
-
var context_exports = {};
|
|
30
|
-
__export(context_exports, {
|
|
31
|
-
"@vocab": () => _vocab,
|
|
32
|
-
WCAG20: () => WCAG20,
|
|
33
|
-
WCAG21: () => WCAG21,
|
|
34
|
-
WebPage: () => WebPage,
|
|
35
|
-
assertedBy: () => assertedBy,
|
|
36
|
-
assertions: () => assertions,
|
|
37
|
-
"auto-wcag": () => auto_wcag,
|
|
38
|
-
dct: () => dct,
|
|
39
|
-
default: () => context_default,
|
|
40
|
-
doap: () => doap,
|
|
41
|
-
earl: () => earl,
|
|
42
|
-
foaf: () => foaf,
|
|
43
|
-
mode: () => mode,
|
|
44
|
-
outcome: () => outcome,
|
|
45
|
-
pointer: () => pointer,
|
|
46
|
-
sch: () => sch,
|
|
47
|
-
url: () => url
|
|
48
|
-
});
|
|
49
|
-
var _vocab = "http://www.w3.org/ns/earl#";
|
|
50
|
-
var earl = "http://www.w3.org/ns/earl#";
|
|
51
|
-
var WCAG20 = "http://www.w3.org/TR/WCAG20/#";
|
|
52
|
-
var WCAG21 = "http://www.w3.org/TR/WCAG21/#";
|
|
53
|
-
var auto_wcag = "https://auto-wcag.github.io/auto-wcag/rules/";
|
|
54
|
-
var dct = "http://purl.org/dc/terms#";
|
|
55
|
-
var sch = "https://schema.org/";
|
|
56
|
-
var doap = "http://usefulinc.com/ns/doap#";
|
|
57
|
-
var foaf = "http://xmlns.com/foaf/spec/#";
|
|
58
|
-
var WebPage = "sch:WebPage";
|
|
59
|
-
var url = "dct:source";
|
|
60
|
-
var assertions = {
|
|
61
|
-
"@reverse": "subject"
|
|
62
|
-
};
|
|
63
|
-
var assertedBy = {
|
|
64
|
-
"@type": "@id"
|
|
65
|
-
};
|
|
66
|
-
var outcome = {
|
|
67
|
-
"@type": "@id"
|
|
68
|
-
};
|
|
69
|
-
var mode = {
|
|
70
|
-
"@type": "@id"
|
|
71
|
-
};
|
|
72
|
-
var pointer = {
|
|
73
|
-
"@type": "ptr:CSSSelectorPointer"
|
|
74
|
-
};
|
|
75
29
|
var context_default = {
|
|
76
|
-
"@vocab":
|
|
77
|
-
earl,
|
|
78
|
-
WCAG20,
|
|
79
|
-
WCAG21,
|
|
80
|
-
"auto-wcag":
|
|
81
|
-
dct,
|
|
82
|
-
sch,
|
|
83
|
-
doap,
|
|
84
|
-
foaf,
|
|
85
|
-
WebPage,
|
|
86
|
-
url,
|
|
87
|
-
assertions
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
30
|
+
"@vocab": "http://www.w3.org/ns/earl#",
|
|
31
|
+
earl: "http://www.w3.org/ns/earl#",
|
|
32
|
+
WCAG20: "http://www.w3.org/TR/WCAG20/#",
|
|
33
|
+
WCAG21: "http://www.w3.org/TR/WCAG21/#",
|
|
34
|
+
"auto-wcag": "https://auto-wcag.github.io/auto-wcag/rules/",
|
|
35
|
+
dct: "http://purl.org/dc/terms#",
|
|
36
|
+
sch: "https://schema.org/",
|
|
37
|
+
doap: "http://usefulinc.com/ns/doap#",
|
|
38
|
+
foaf: "http://xmlns.com/foaf/spec/#",
|
|
39
|
+
WebPage: "sch:WebPage",
|
|
40
|
+
url: "dct:source",
|
|
41
|
+
assertions: {
|
|
42
|
+
"@reverse": "subject"
|
|
43
|
+
},
|
|
44
|
+
assertedBy: {
|
|
45
|
+
"@type": "@id"
|
|
46
|
+
},
|
|
47
|
+
outcome: {
|
|
48
|
+
"@type": "@id"
|
|
49
|
+
},
|
|
50
|
+
mode: {
|
|
51
|
+
"@type": "@id"
|
|
52
|
+
},
|
|
53
|
+
pointer: {
|
|
54
|
+
"@type": "ptr:CSSSelectorPointer"
|
|
55
|
+
}
|
|
92
56
|
};
|
|
93
57
|
|
|
94
58
|
// src/testResult.ts
|
|
@@ -100,16 +64,14 @@ function cssToPointer(selector) {
|
|
|
100
64
|
return item;
|
|
101
65
|
}
|
|
102
66
|
function testResult({ description }, outcomes = []) {
|
|
103
|
-
return outcomes.map(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
);
|
|
67
|
+
return outcomes.map(({ node, result }) => {
|
|
68
|
+
return {
|
|
69
|
+
"@type": "TestResult" /* TestResult */,
|
|
70
|
+
info: description,
|
|
71
|
+
outcome: "earl:" + result,
|
|
72
|
+
pointer: cssToPointer(node.selector)
|
|
73
|
+
};
|
|
74
|
+
});
|
|
113
75
|
}
|
|
114
76
|
|
|
115
77
|
// src/axeResultToEarl.ts
|
|
@@ -126,33 +88,31 @@ function axeResultToEarl(rawResults) {
|
|
|
126
88
|
outcome: "earl:inapplicable"
|
|
127
89
|
});
|
|
128
90
|
}
|
|
129
|
-
const newAsserts = results.map(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
);
|
|
91
|
+
const newAsserts = results.map((result) => {
|
|
92
|
+
const match = axeResult.helpUrl.match(
|
|
93
|
+
/axe\/([1-9][0-9]*\.[1-9][0-9]*)\//
|
|
94
|
+
);
|
|
95
|
+
const version = match && match[1] || "";
|
|
96
|
+
return {
|
|
97
|
+
"@type": "Assertion" /* Assertion */,
|
|
98
|
+
mode: "earl:automatic",
|
|
99
|
+
assertedBy: {
|
|
100
|
+
"@id": `https://github.com/dequelabs/axe-core/releases/tag/${version}.0`,
|
|
101
|
+
"@type": ["earl:Assertor", "earl:Software", "doap:Project"],
|
|
102
|
+
"doap:name": "Axe",
|
|
103
|
+
"doap:vendor": {
|
|
104
|
+
"@id": "https://deque.com/",
|
|
105
|
+
"@type": "foaf:Organization",
|
|
106
|
+
"foaf:name": "Deque Systems"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
test: {
|
|
110
|
+
"@type": "TestCase" /* TestCase */,
|
|
111
|
+
"@id": axeResult.helpUrl
|
|
112
|
+
},
|
|
113
|
+
result
|
|
114
|
+
};
|
|
115
|
+
});
|
|
156
116
|
return asserts.concat(newAsserts);
|
|
157
117
|
},
|
|
158
118
|
[]
|
|
@@ -160,12 +120,12 @@ function axeResultToEarl(rawResults) {
|
|
|
160
120
|
}
|
|
161
121
|
|
|
162
122
|
// src/axeReporterEarl.ts
|
|
163
|
-
function createEarlReport(rawResults,
|
|
123
|
+
function createEarlReport(rawResults, url) {
|
|
164
124
|
debugger;
|
|
165
125
|
return {
|
|
166
|
-
"@context":
|
|
126
|
+
"@context": context_default,
|
|
167
127
|
"@type": "WebPage" /* WebPage */,
|
|
168
|
-
url:
|
|
128
|
+
url: url ? url : window.location.href,
|
|
169
129
|
assertions: axeResultToEarl(rawResults)
|
|
170
130
|
};
|
|
171
131
|
}
|
package/dist/axeReporterEarl.mjs
CHANGED
|
@@ -1,73 +1,31 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
1
|
// src/context.json
|
|
8
|
-
var context_exports = {};
|
|
9
|
-
__export(context_exports, {
|
|
10
|
-
"@vocab": () => _vocab,
|
|
11
|
-
WCAG20: () => WCAG20,
|
|
12
|
-
WCAG21: () => WCAG21,
|
|
13
|
-
WebPage: () => WebPage,
|
|
14
|
-
assertedBy: () => assertedBy,
|
|
15
|
-
assertions: () => assertions,
|
|
16
|
-
"auto-wcag": () => auto_wcag,
|
|
17
|
-
dct: () => dct,
|
|
18
|
-
default: () => context_default,
|
|
19
|
-
doap: () => doap,
|
|
20
|
-
earl: () => earl,
|
|
21
|
-
foaf: () => foaf,
|
|
22
|
-
mode: () => mode,
|
|
23
|
-
outcome: () => outcome,
|
|
24
|
-
pointer: () => pointer,
|
|
25
|
-
sch: () => sch,
|
|
26
|
-
url: () => url
|
|
27
|
-
});
|
|
28
|
-
var _vocab = "http://www.w3.org/ns/earl#";
|
|
29
|
-
var earl = "http://www.w3.org/ns/earl#";
|
|
30
|
-
var WCAG20 = "http://www.w3.org/TR/WCAG20/#";
|
|
31
|
-
var WCAG21 = "http://www.w3.org/TR/WCAG21/#";
|
|
32
|
-
var auto_wcag = "https://auto-wcag.github.io/auto-wcag/rules/";
|
|
33
|
-
var dct = "http://purl.org/dc/terms#";
|
|
34
|
-
var sch = "https://schema.org/";
|
|
35
|
-
var doap = "http://usefulinc.com/ns/doap#";
|
|
36
|
-
var foaf = "http://xmlns.com/foaf/spec/#";
|
|
37
|
-
var WebPage = "sch:WebPage";
|
|
38
|
-
var url = "dct:source";
|
|
39
|
-
var assertions = {
|
|
40
|
-
"@reverse": "subject"
|
|
41
|
-
};
|
|
42
|
-
var assertedBy = {
|
|
43
|
-
"@type": "@id"
|
|
44
|
-
};
|
|
45
|
-
var outcome = {
|
|
46
|
-
"@type": "@id"
|
|
47
|
-
};
|
|
48
|
-
var mode = {
|
|
49
|
-
"@type": "@id"
|
|
50
|
-
};
|
|
51
|
-
var pointer = {
|
|
52
|
-
"@type": "ptr:CSSSelectorPointer"
|
|
53
|
-
};
|
|
54
2
|
var context_default = {
|
|
55
|
-
"@vocab":
|
|
56
|
-
earl,
|
|
57
|
-
WCAG20,
|
|
58
|
-
WCAG21,
|
|
59
|
-
"auto-wcag":
|
|
60
|
-
dct,
|
|
61
|
-
sch,
|
|
62
|
-
doap,
|
|
63
|
-
foaf,
|
|
64
|
-
WebPage,
|
|
65
|
-
url,
|
|
66
|
-
assertions
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
3
|
+
"@vocab": "http://www.w3.org/ns/earl#",
|
|
4
|
+
earl: "http://www.w3.org/ns/earl#",
|
|
5
|
+
WCAG20: "http://www.w3.org/TR/WCAG20/#",
|
|
6
|
+
WCAG21: "http://www.w3.org/TR/WCAG21/#",
|
|
7
|
+
"auto-wcag": "https://auto-wcag.github.io/auto-wcag/rules/",
|
|
8
|
+
dct: "http://purl.org/dc/terms#",
|
|
9
|
+
sch: "https://schema.org/",
|
|
10
|
+
doap: "http://usefulinc.com/ns/doap#",
|
|
11
|
+
foaf: "http://xmlns.com/foaf/spec/#",
|
|
12
|
+
WebPage: "sch:WebPage",
|
|
13
|
+
url: "dct:source",
|
|
14
|
+
assertions: {
|
|
15
|
+
"@reverse": "subject"
|
|
16
|
+
},
|
|
17
|
+
assertedBy: {
|
|
18
|
+
"@type": "@id"
|
|
19
|
+
},
|
|
20
|
+
outcome: {
|
|
21
|
+
"@type": "@id"
|
|
22
|
+
},
|
|
23
|
+
mode: {
|
|
24
|
+
"@type": "@id"
|
|
25
|
+
},
|
|
26
|
+
pointer: {
|
|
27
|
+
"@type": "ptr:CSSSelectorPointer"
|
|
28
|
+
}
|
|
71
29
|
};
|
|
72
30
|
|
|
73
31
|
// src/testResult.ts
|
|
@@ -79,16 +37,14 @@ function cssToPointer(selector) {
|
|
|
79
37
|
return item;
|
|
80
38
|
}
|
|
81
39
|
function testResult({ description }, outcomes = []) {
|
|
82
|
-
return outcomes.map(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
);
|
|
40
|
+
return outcomes.map(({ node, result }) => {
|
|
41
|
+
return {
|
|
42
|
+
"@type": "TestResult" /* TestResult */,
|
|
43
|
+
info: description,
|
|
44
|
+
outcome: "earl:" + result,
|
|
45
|
+
pointer: cssToPointer(node.selector)
|
|
46
|
+
};
|
|
47
|
+
});
|
|
92
48
|
}
|
|
93
49
|
|
|
94
50
|
// src/axeResultToEarl.ts
|
|
@@ -105,33 +61,31 @@ function axeResultToEarl(rawResults) {
|
|
|
105
61
|
outcome: "earl:inapplicable"
|
|
106
62
|
});
|
|
107
63
|
}
|
|
108
|
-
const newAsserts = results.map(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
);
|
|
64
|
+
const newAsserts = results.map((result) => {
|
|
65
|
+
const match = axeResult.helpUrl.match(
|
|
66
|
+
/axe\/([1-9][0-9]*\.[1-9][0-9]*)\//
|
|
67
|
+
);
|
|
68
|
+
const version = match && match[1] || "";
|
|
69
|
+
return {
|
|
70
|
+
"@type": "Assertion" /* Assertion */,
|
|
71
|
+
mode: "earl:automatic",
|
|
72
|
+
assertedBy: {
|
|
73
|
+
"@id": `https://github.com/dequelabs/axe-core/releases/tag/${version}.0`,
|
|
74
|
+
"@type": ["earl:Assertor", "earl:Software", "doap:Project"],
|
|
75
|
+
"doap:name": "Axe",
|
|
76
|
+
"doap:vendor": {
|
|
77
|
+
"@id": "https://deque.com/",
|
|
78
|
+
"@type": "foaf:Organization",
|
|
79
|
+
"foaf:name": "Deque Systems"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
test: {
|
|
83
|
+
"@type": "TestCase" /* TestCase */,
|
|
84
|
+
"@id": axeResult.helpUrl
|
|
85
|
+
},
|
|
86
|
+
result
|
|
87
|
+
};
|
|
88
|
+
});
|
|
135
89
|
return asserts.concat(newAsserts);
|
|
136
90
|
},
|
|
137
91
|
[]
|
|
@@ -139,12 +93,12 @@ function axeResultToEarl(rawResults) {
|
|
|
139
93
|
}
|
|
140
94
|
|
|
141
95
|
// src/axeReporterEarl.ts
|
|
142
|
-
function createEarlReport(rawResults,
|
|
96
|
+
function createEarlReport(rawResults, url) {
|
|
143
97
|
debugger;
|
|
144
98
|
return {
|
|
145
|
-
"@context":
|
|
99
|
+
"@context": context_default,
|
|
146
100
|
"@type": "WebPage" /* WebPage */,
|
|
147
|
-
url:
|
|
101
|
+
url: url ? url : window.location.href,
|
|
148
102
|
assertions: axeResultToEarl(rawResults)
|
|
149
103
|
};
|
|
150
104
|
}
|
package/esmTest.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import defaultExport from './dist/axeReporterEarl.mjs';
|
|
2
2
|
import assert from 'assert';
|
|
3
3
|
|
|
4
|
-
const exportIsFunction = typeof
|
|
4
|
+
const exportIsFunction = typeof defaultExport === 'function';
|
|
5
5
|
assert(exportIsFunction, 'export is not a function');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axe-core/reporter-earl",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.4-2456ed6.0+2456ed6",
|
|
4
4
|
"description": "A EARL+JSON-LD reporter for axe-core",
|
|
5
5
|
"main": "dist/axeReporterEarl.js",
|
|
6
6
|
"module": "./dist/axeReporterEarl.mjs",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"start": "
|
|
16
|
+
"start": "NODE_OPTIONS=--experimental-vm-modules jest --watch --env=jsdom",
|
|
17
17
|
"test": "npm run build && npm run test:unit",
|
|
18
18
|
"test:esm": "node esmTest.mjs",
|
|
19
|
-
"test:unit": "
|
|
19
|
+
"test:unit": "NODE_OPTIONS=--experimental-vm-modules jest --collectCoverage",
|
|
20
20
|
"build": "tsup src/axeReporterEarl.ts --dts --format esm,cjs",
|
|
21
21
|
"prepublishOnly": "npm run build"
|
|
22
22
|
},
|
|
@@ -41,19 +41,18 @@
|
|
|
41
41
|
"license": "MPL-2.0",
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/clone": "^2.1.1",
|
|
44
|
-
"@types/jest": "^29.1.2",
|
|
45
44
|
"@types/jsonld": "github:types/jsonld",
|
|
46
45
|
"@types/node": "^18.8.3",
|
|
47
|
-
"axe-core": "
|
|
46
|
+
"axe-core": "~4.8.2",
|
|
48
47
|
"clone": "^2.1.2",
|
|
49
48
|
"cross-env": "^7.0.3",
|
|
50
49
|
"jest": "^29.1.2",
|
|
51
50
|
"jest-environment-jsdom": "^29.1.2",
|
|
52
|
-
"jsonld": "^8.1
|
|
51
|
+
"jsonld": "^8.2.1",
|
|
53
52
|
"ts-jest": "^29.0.3",
|
|
54
53
|
"ts-node": "^10.9.1",
|
|
55
54
|
"tsup": "^6.7.0",
|
|
56
55
|
"typescript": "^4.8.4"
|
|
57
56
|
},
|
|
58
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "2456ed641781c2262bf71db24f7f97755422d5f6"
|
|
59
58
|
}
|
package/src/axeReporterEarl.ts
CHANGED
package/src/axeResultToEarl.ts
CHANGED
|
@@ -16,33 +16,31 @@ export default function axeResultToEarl(rawResults: RawResult[]): Assertion[] {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const newAsserts = results.map(
|
|
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
|
-
);
|
|
19
|
+
const newAsserts = results.map((result): Assertion => {
|
|
20
|
+
const match = axeResult.helpUrl.match(
|
|
21
|
+
/axe\/([1-9][0-9]*\.[1-9][0-9]*)\//
|
|
22
|
+
);
|
|
23
|
+
const version = (match && match[1]) || '';
|
|
24
|
+
return {
|
|
25
|
+
'@type': EarlType.Assertion,
|
|
26
|
+
mode: 'earl:automatic',
|
|
27
|
+
assertedBy: {
|
|
28
|
+
'@id': `https://github.com/dequelabs/axe-core/releases/tag/${version}.0`,
|
|
29
|
+
'@type': ['earl:Assertor', 'earl:Software', 'doap:Project'],
|
|
30
|
+
'doap:name': 'Axe',
|
|
31
|
+
'doap:vendor': {
|
|
32
|
+
'@id': 'https://deque.com/',
|
|
33
|
+
'@type': 'foaf:Organization',
|
|
34
|
+
'foaf:name': 'Deque Systems'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
test: {
|
|
38
|
+
'@type': EarlType.TestCase,
|
|
39
|
+
'@id': axeResult.helpUrl
|
|
40
|
+
},
|
|
41
|
+
result
|
|
42
|
+
};
|
|
43
|
+
});
|
|
46
44
|
|
|
47
45
|
return asserts.concat(newAsserts);
|
|
48
46
|
},
|
package/src/testResult.ts
CHANGED
|
@@ -18,14 +18,12 @@ export default function testResult(
|
|
|
18
18
|
{ description }: RawResult,
|
|
19
19
|
outcomes: RawNodeResult[] = []
|
|
20
20
|
): TestResult[] {
|
|
21
|
-
return outcomes.map(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
);
|
|
21
|
+
return outcomes.map(({ node, result }): TestResult => {
|
|
22
|
+
return {
|
|
23
|
+
'@type': EarlType.TestResult,
|
|
24
|
+
info: description,
|
|
25
|
+
outcome: 'earl:' + result,
|
|
26
|
+
pointer: cssToPointer(node.selector)
|
|
27
|
+
};
|
|
28
|
+
});
|
|
31
29
|
}
|
package/src/types.ts
CHANGED
|
@@ -12,12 +12,6 @@ export interface EarlResult {
|
|
|
12
12
|
assertions: Assertion[];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
type outcome =
|
|
16
|
-
| 'earl:inapplicable'
|
|
17
|
-
| 'earl:passed'
|
|
18
|
-
| 'earl:incomplete'
|
|
19
|
-
| 'earl:failed';
|
|
20
|
-
|
|
21
15
|
export interface Assertion {
|
|
22
16
|
'@type': EarlType.Assertion;
|
|
23
17
|
mode: 'earl:automatic';
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// jsonld depends on @digitalbazaar/http-client, which depends on the undici HTTP client,
|
|
2
|
+
// which depends on TextEncoder ... which however isn't provided by jsdom, see
|
|
3
|
+
// https://github.com/jsdom/jsdom/issues/2524.
|
|
4
|
+
import { TextEncoder, TextDecoder } from 'util';
|
|
5
|
+
global.TextEncoder = TextEncoder;
|
|
6
|
+
global.TextDecoder = TextDecoder as any;
|
|
7
|
+
|
|
8
|
+
import jsonld from 'jsonld';
|
|
9
|
+
import axe from 'axe-core';
|
|
3
10
|
import { getDummyData } from './utils';
|
|
4
11
|
import axeReporterEarl, { createEarlReport } from '../src/axeReporterEarl';
|
|
5
|
-
import
|
|
12
|
+
import context from '../src/context.json';
|
|
6
13
|
import { RawResult, EarlType } from '../src/types';
|
|
14
|
+
import { describe, beforeEach, test, expect } from '@jest/globals';
|
|
7
15
|
|
|
8
16
|
describe(`createEarlReport`, () => {
|
|
9
17
|
let dummyData: RawResult[];
|
|
@@ -2,6 +2,7 @@ import axeResultToEarl from '../src/axeResultToEarl';
|
|
|
2
2
|
import { getDummyData } from './utils';
|
|
3
3
|
import testResult from '../src/testResult';
|
|
4
4
|
import { RawResult, RawNodeResult } from '../src/types';
|
|
5
|
+
import { describe, beforeEach, test, expect } from '@jest/globals';
|
|
5
6
|
|
|
6
7
|
let dummyData: RawResult[];
|
|
7
8
|
beforeEach(async () => {
|
package/tests/testResult.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import testResult, { cssToPointer } from '../src/testResult';
|
|
2
2
|
import { getDummyData } from './utils';
|
|
3
3
|
import { RawResult, RawNodeResult, EarlType } from '../src/types';
|
|
4
|
+
import { describe, beforeEach, test, expect } from '@jest/globals';
|
|
4
5
|
|
|
5
6
|
let dummyData: RawResult[];
|
|
6
7
|
beforeEach(async () => {
|
package/tests/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RawResult } from '../src/types';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import clone from 'clone';
|
|
3
|
+
import axe from 'axe-core';
|
|
4
4
|
|
|
5
5
|
let _dummyData: RawResult[] | axe.AxeResults;
|
|
6
6
|
export async function getDummyData(version = '3.1'): Promise<RawResult[]> {
|
|
@@ -15,7 +15,14 @@ export async function getDummyData(version = '3.1'): Promise<RawResult[]> {
|
|
|
15
15
|
const params: any = {
|
|
16
16
|
reporter: function (raw: any, _: any, callback: Function) {
|
|
17
17
|
callback(JSON.parse(JSON.stringify(raw)));
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
rules: [
|
|
20
|
+
{
|
|
21
|
+
// color contrast checking doesn't work in a jsdom environment (since it depends on canvas)
|
|
22
|
+
id: 'color-contrast',
|
|
23
|
+
enabled: false
|
|
24
|
+
}
|
|
25
|
+
]
|
|
19
26
|
};
|
|
20
27
|
axe.configure(params);
|
|
21
28
|
_dummyData = await axe.run();
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"moduleResolution": "node",
|
|
4
|
-
"target": "esnext",
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"lib": ["esnext", "dom"],
|
|
7
|
-
"strict": true,
|
|
8
|
-
"pretty": true,
|
|
9
|
-
"sourceMap": true,
|
|
10
|
-
"declaration": true,
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"outDir": "dist",
|
|
13
|
-
"typeRoots": ["node_modules/@types"]
|
|
14
|
-
},
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
15
3
|
"include": ["src"]
|
|
16
4
|
}
|