@axe-core/reporter-earl 4.6.2-alpha.379 → 4.6.2-alpha.380
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/dist/axeReporterEarl.d.ts +49 -3
- package/dist/axeReporterEarl.js +175 -18
- package/dist/axeReporterEarl.mjs +157 -0
- package/esmTest.mjs +5 -0
- package/package.json +14 -3
- package/tsconfig.json +3 -3
- package/dist/axeReporterEarl.js.map +0 -1
- package/dist/axeResultToEarl.d.ts +0 -2
- package/dist/axeResultToEarl.js +0 -44
- package/dist/axeResultToEarl.js.map +0 -1
- package/dist/context.json +0 -28
- package/dist/testResult.d.ts +0 -3
- package/dist/testResult.js +0 -27
- package/dist/testResult.js.map +0 -1
- package/dist/types.d.ts +0 -44
- package/dist/types.js +0 -11
- package/dist/types.js.map +0 -1
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare enum EarlType {
|
|
2
|
+
WebPage = "WebPage",
|
|
3
|
+
Assertion = "Assertion",
|
|
4
|
+
TestCase = "TestCase",
|
|
5
|
+
TestResult = "TestResult"
|
|
6
|
+
}
|
|
7
|
+
interface EarlResult {
|
|
8
|
+
'@context': object;
|
|
9
|
+
'@type': EarlType.WebPage;
|
|
10
|
+
url: string;
|
|
11
|
+
assertions: Assertion[];
|
|
12
|
+
}
|
|
13
|
+
interface Assertion {
|
|
14
|
+
'@type': EarlType.Assertion;
|
|
15
|
+
mode: 'earl:automatic';
|
|
16
|
+
assertedBy: {};
|
|
17
|
+
test: {
|
|
18
|
+
'@type': EarlType.TestCase;
|
|
19
|
+
'@id': string;
|
|
20
|
+
};
|
|
21
|
+
result: TestResult;
|
|
22
|
+
}
|
|
23
|
+
interface TestResult {
|
|
24
|
+
'@type': EarlType.TestResult;
|
|
25
|
+
outcome: string;
|
|
26
|
+
pointer?: string;
|
|
27
|
+
info?: string;
|
|
28
|
+
}
|
|
29
|
+
interface RawResult {
|
|
30
|
+
id: string;
|
|
31
|
+
helpUrl: string;
|
|
32
|
+
description: string;
|
|
33
|
+
violations?: RawNodeResult[];
|
|
34
|
+
passes?: RawNodeResult[];
|
|
35
|
+
incomplete?: RawNodeResult[];
|
|
36
|
+
}
|
|
37
|
+
interface RawNodeResult {
|
|
38
|
+
node: {
|
|
39
|
+
selector: Selector;
|
|
40
|
+
};
|
|
41
|
+
result?: 'passed' | 'failed' | 'inapplicable' | 'incomplete';
|
|
42
|
+
}
|
|
43
|
+
declare type SelectorItem = string[] | string;
|
|
44
|
+
declare type Selector = SelectorItem[];
|
|
45
|
+
|
|
46
|
+
declare function createEarlReport(rawResults: RawResult[], url?: string): EarlResult;
|
|
47
|
+
declare function axeReporterEarl(rawResults: RawResult[], {}: {}, callback: Function): void;
|
|
48
|
+
|
|
49
|
+
export { createEarlReport, axeReporterEarl as default };
|
package/dist/axeReporterEarl.js
CHANGED
|
@@ -1,21 +1,178 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/axeReporterEarl.ts
|
|
21
|
+
var axeReporterEarl_exports = {};
|
|
22
|
+
__export(axeReporterEarl_exports, {
|
|
23
|
+
createEarlReport: () => createEarlReport,
|
|
24
|
+
default: () => axeReporterEarl
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(axeReporterEarl_exports);
|
|
27
|
+
|
|
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
|
+
var context_default = {
|
|
76
|
+
"@vocab": _vocab,
|
|
77
|
+
earl,
|
|
78
|
+
WCAG20,
|
|
79
|
+
WCAG21,
|
|
80
|
+
"auto-wcag": auto_wcag,
|
|
81
|
+
dct,
|
|
82
|
+
sch,
|
|
83
|
+
doap,
|
|
84
|
+
foaf,
|
|
85
|
+
WebPage,
|
|
86
|
+
url,
|
|
87
|
+
assertions,
|
|
88
|
+
assertedBy,
|
|
89
|
+
outcome,
|
|
90
|
+
mode,
|
|
91
|
+
pointer
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// src/testResult.ts
|
|
95
|
+
function cssToPointer(selector) {
|
|
96
|
+
const item = selector[0];
|
|
97
|
+
if (Array.isArray(item)) {
|
|
98
|
+
return item[0];
|
|
99
|
+
}
|
|
100
|
+
return item;
|
|
15
101
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
102
|
+
function testResult({ description }, outcomes = []) {
|
|
103
|
+
return outcomes.map(
|
|
104
|
+
({ node, result }) => {
|
|
105
|
+
return {
|
|
106
|
+
"@type": "TestResult" /* TestResult */,
|
|
107
|
+
info: description,
|
|
108
|
+
outcome: "earl:" + result,
|
|
109
|
+
pointer: cssToPointer(node.selector)
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
);
|
|
19
113
|
}
|
|
20
|
-
|
|
21
|
-
|
|
114
|
+
|
|
115
|
+
// src/axeResultToEarl.ts
|
|
116
|
+
function axeResultToEarl(rawResults) {
|
|
117
|
+
return rawResults.reduce(
|
|
118
|
+
(asserts, axeResult) => {
|
|
119
|
+
let results = [];
|
|
120
|
+
results = results.concat(testResult(axeResult, axeResult.violations));
|
|
121
|
+
results = results.concat(testResult(axeResult, axeResult.passes));
|
|
122
|
+
results = results.concat(testResult(axeResult, axeResult.incomplete));
|
|
123
|
+
if (results.length === 0) {
|
|
124
|
+
results.push({
|
|
125
|
+
"@type": "TestResult" /* TestResult */,
|
|
126
|
+
outcome: "earl:inapplicable"
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
const newAsserts = results.map(
|
|
130
|
+
(result) => {
|
|
131
|
+
const match = axeResult.helpUrl.match(
|
|
132
|
+
/axe\/([1-9][0-9]*\.[1-9][0-9]*)\//
|
|
133
|
+
);
|
|
134
|
+
const version = match && match[1] || "";
|
|
135
|
+
return {
|
|
136
|
+
"@type": "Assertion" /* Assertion */,
|
|
137
|
+
mode: "earl:automatic",
|
|
138
|
+
assertedBy: {
|
|
139
|
+
"@id": `https://github.com/dequelabs/axe-core/releases/tag/${version}.0`,
|
|
140
|
+
"@type": ["earl:Assertor", "earl:Software", "doap:Project"],
|
|
141
|
+
"doap:name": "Axe",
|
|
142
|
+
"doap:vendor": {
|
|
143
|
+
"@id": "https://deque.com/",
|
|
144
|
+
"@type": "foaf:Organization",
|
|
145
|
+
"foaf:name": "Deque Systems"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
test: {
|
|
149
|
+
"@type": "TestCase" /* TestCase */,
|
|
150
|
+
"@id": axeResult.helpUrl
|
|
151
|
+
},
|
|
152
|
+
result
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
return asserts.concat(newAsserts);
|
|
157
|
+
},
|
|
158
|
+
[]
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/axeReporterEarl.ts
|
|
163
|
+
function createEarlReport(rawResults, url2) {
|
|
164
|
+
debugger;
|
|
165
|
+
return {
|
|
166
|
+
"@context": context_exports,
|
|
167
|
+
"@type": "WebPage" /* WebPage */,
|
|
168
|
+
url: url2 ? url2 : window.location.href,
|
|
169
|
+
assertions: axeResultToEarl(rawResults)
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function axeReporterEarl(rawResults, {}, callback) {
|
|
173
|
+
callback(createEarlReport(rawResults));
|
|
174
|
+
}
|
|
175
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
176
|
+
0 && (module.exports = {
|
|
177
|
+
createEarlReport
|
|
178
|
+
});
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
// 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
|
+
var context_default = {
|
|
55
|
+
"@vocab": _vocab,
|
|
56
|
+
earl,
|
|
57
|
+
WCAG20,
|
|
58
|
+
WCAG21,
|
|
59
|
+
"auto-wcag": auto_wcag,
|
|
60
|
+
dct,
|
|
61
|
+
sch,
|
|
62
|
+
doap,
|
|
63
|
+
foaf,
|
|
64
|
+
WebPage,
|
|
65
|
+
url,
|
|
66
|
+
assertions,
|
|
67
|
+
assertedBy,
|
|
68
|
+
outcome,
|
|
69
|
+
mode,
|
|
70
|
+
pointer
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/testResult.ts
|
|
74
|
+
function cssToPointer(selector) {
|
|
75
|
+
const item = selector[0];
|
|
76
|
+
if (Array.isArray(item)) {
|
|
77
|
+
return item[0];
|
|
78
|
+
}
|
|
79
|
+
return item;
|
|
80
|
+
}
|
|
81
|
+
function testResult({ description }, outcomes = []) {
|
|
82
|
+
return outcomes.map(
|
|
83
|
+
({ node, result }) => {
|
|
84
|
+
return {
|
|
85
|
+
"@type": "TestResult" /* TestResult */,
|
|
86
|
+
info: description,
|
|
87
|
+
outcome: "earl:" + result,
|
|
88
|
+
pointer: cssToPointer(node.selector)
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/axeResultToEarl.ts
|
|
95
|
+
function axeResultToEarl(rawResults) {
|
|
96
|
+
return rawResults.reduce(
|
|
97
|
+
(asserts, axeResult) => {
|
|
98
|
+
let results = [];
|
|
99
|
+
results = results.concat(testResult(axeResult, axeResult.violations));
|
|
100
|
+
results = results.concat(testResult(axeResult, axeResult.passes));
|
|
101
|
+
results = results.concat(testResult(axeResult, axeResult.incomplete));
|
|
102
|
+
if (results.length === 0) {
|
|
103
|
+
results.push({
|
|
104
|
+
"@type": "TestResult" /* TestResult */,
|
|
105
|
+
outcome: "earl:inapplicable"
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const newAsserts = results.map(
|
|
109
|
+
(result) => {
|
|
110
|
+
const match = axeResult.helpUrl.match(
|
|
111
|
+
/axe\/([1-9][0-9]*\.[1-9][0-9]*)\//
|
|
112
|
+
);
|
|
113
|
+
const version = match && match[1] || "";
|
|
114
|
+
return {
|
|
115
|
+
"@type": "Assertion" /* Assertion */,
|
|
116
|
+
mode: "earl:automatic",
|
|
117
|
+
assertedBy: {
|
|
118
|
+
"@id": `https://github.com/dequelabs/axe-core/releases/tag/${version}.0`,
|
|
119
|
+
"@type": ["earl:Assertor", "earl:Software", "doap:Project"],
|
|
120
|
+
"doap:name": "Axe",
|
|
121
|
+
"doap:vendor": {
|
|
122
|
+
"@id": "https://deque.com/",
|
|
123
|
+
"@type": "foaf:Organization",
|
|
124
|
+
"foaf:name": "Deque Systems"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
test: {
|
|
128
|
+
"@type": "TestCase" /* TestCase */,
|
|
129
|
+
"@id": axeResult.helpUrl
|
|
130
|
+
},
|
|
131
|
+
result
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
return asserts.concat(newAsserts);
|
|
136
|
+
},
|
|
137
|
+
[]
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// src/axeReporterEarl.ts
|
|
142
|
+
function createEarlReport(rawResults, url2) {
|
|
143
|
+
debugger;
|
|
144
|
+
return {
|
|
145
|
+
"@context": context_exports,
|
|
146
|
+
"@type": "WebPage" /* WebPage */,
|
|
147
|
+
url: url2 ? url2 : window.location.href,
|
|
148
|
+
assertions: axeResultToEarl(rawResults)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function axeReporterEarl(rawResults, {}, callback) {
|
|
152
|
+
callback(createEarlReport(rawResults));
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
createEarlReport,
|
|
156
|
+
axeReporterEarl as default
|
|
157
|
+
};
|
package/esmTest.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axe-core/reporter-earl",
|
|
3
|
-
"version": "4.6.2-alpha.
|
|
3
|
+
"version": "4.6.2-alpha.380+076bfa9",
|
|
4
4
|
"description": "A EARL+JSON-LD reporter for axe-core",
|
|
5
5
|
"main": "dist/axeReporterEarl.js",
|
|
6
|
+
"module": "./dist/axeReporterEarl.mjs",
|
|
7
|
+
"types": "./dist/axeReporterEarl.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/axeReporterEarl.mjs",
|
|
11
|
+
"require": "./dist/axeReporterEarl.js",
|
|
12
|
+
"types": "./dist/axeReporterEarl.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
6
15
|
"scripts": {
|
|
7
16
|
"start": "node --experimental-vm-modules node_modules/.bin/jest --watch --env=jsdom",
|
|
8
17
|
"test": "npm run build && npm run test:unit",
|
|
18
|
+
"test:esm": "node esmTest.mjs",
|
|
9
19
|
"test:unit": "node --experimental-vm-modules node_modules/.bin/jest --collectCoverage",
|
|
10
|
-
"build": "
|
|
20
|
+
"build": "tsup src/axeReporterEarl.ts --dts --format esm,cjs",
|
|
11
21
|
"prepublishOnly": "npm run build"
|
|
12
22
|
},
|
|
13
23
|
"publishConfig": {
|
|
@@ -42,7 +52,8 @@
|
|
|
42
52
|
"jsonld": "^8.1.0",
|
|
43
53
|
"ts-jest": "^29.0.3",
|
|
44
54
|
"ts-node": "^10.9.1",
|
|
55
|
+
"tsup": "^6.7.0",
|
|
45
56
|
"typescript": "^4.8.4"
|
|
46
57
|
},
|
|
47
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "076bfa99f27f416b4eaff6d24cc23e8573fc72ee"
|
|
48
59
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axeReporterEarl.js","sourceRoot":"","sources":["../src/axeReporterEarl.ts"],"names":[],"mappings":";;;AAAA,iCAA0D;AAC1D,wCAA0C;AAC1C,qDAAqD;AAErD,SAAgB,gBAAgB,CAC9B,UAAuB,EACvB,GAAY;IAEZ,QAAQ,CAAC;IACT,OAAO;QACL,UAAU,EAAE,OAAO;QACnB,OAAO,EAAE,gBAAQ,CAAC,OAAO;QACzB,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI;QACrC,UAAU,EAAE,IAAA,yBAAoB,EAAC,UAAU,CAAC;KAC7C,CAAC;AACJ,CAAC;AAXD,4CAWC;AAED,SAAwB,eAAe,CACrC,UAAuB,EACvB,EAAE,EACF,QAAkB;IAElB,QAAQ,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;AACzC,CAAC;AAND,kCAMC"}
|
package/dist/axeResultToEarl.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var types_1 = require("./types");
|
|
4
|
-
var testResult_1 = require("./testResult");
|
|
5
|
-
function axeResultToEarl(rawResults) {
|
|
6
|
-
return rawResults.reduce(function (asserts, axeResult) {
|
|
7
|
-
var results = [];
|
|
8
|
-
results = results.concat((0, testResult_1.default)(axeResult, axeResult.violations));
|
|
9
|
-
results = results.concat((0, testResult_1.default)(axeResult, axeResult.passes));
|
|
10
|
-
results = results.concat((0, testResult_1.default)(axeResult, axeResult.incomplete));
|
|
11
|
-
if (results.length === 0) {
|
|
12
|
-
results.push({
|
|
13
|
-
'@type': types_1.EarlType.TestResult,
|
|
14
|
-
outcome: 'earl:inapplicable'
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
var newAsserts = results.map(function (result) {
|
|
18
|
-
var match = axeResult.helpUrl.match(/axe\/([1-9][0-9]*\.[1-9][0-9]*)\//);
|
|
19
|
-
var version = (match && match[1]) || '';
|
|
20
|
-
return {
|
|
21
|
-
'@type': types_1.EarlType.Assertion,
|
|
22
|
-
mode: 'earl:automatic',
|
|
23
|
-
assertedBy: {
|
|
24
|
-
'@id': "https://github.com/dequelabs/axe-core/releases/tag/".concat(version, ".0"),
|
|
25
|
-
'@type': ['earl:Assertor', 'earl:Software', 'doap:Project'],
|
|
26
|
-
'doap:name': 'Axe',
|
|
27
|
-
'doap:vendor': {
|
|
28
|
-
'@id': 'https://deque.com/',
|
|
29
|
-
'@type': 'foaf:Organization',
|
|
30
|
-
'foaf:name': 'Deque Systems'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
test: {
|
|
34
|
-
'@type': types_1.EarlType.TestCase,
|
|
35
|
-
'@id': axeResult.helpUrl
|
|
36
|
-
},
|
|
37
|
-
result: result
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
return asserts.concat(newAsserts);
|
|
41
|
-
}, []);
|
|
42
|
-
}
|
|
43
|
-
exports.default = axeResultToEarl;
|
|
44
|
-
//# sourceMappingURL=axeResultToEarl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axeResultToEarl.js","sourceRoot":"","sources":["../src/axeResultToEarl.ts"],"names":[],"mappings":";;AAAA,iCAAqE;AACrE,2CAAuC;AAEvC,SAAwB,eAAe,CAAC,UAAuB;IAC7D,OAAO,UAAU,CAAC,MAAM,CACtB,UAAC,OAAoB,EAAE,SAAoB;QACzC,IAAI,OAAO,GAAiB,EAAE,CAAC;QAC/B,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAA,oBAAW,EAAC,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QACvE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAA,oBAAW,EAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QACnE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAA,oBAAW,EAAC,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAEvE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,OAAO,CAAC,IAAI,CAAC;gBACX,OAAO,EAAE,gBAAQ,CAAC,UAAU;gBAC5B,OAAO,EAAE,mBAAmB;aAC7B,CAAC,CAAC;SACJ;QAED,IAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAC5B,UAAC,MAAM;YACL,IAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CACnC,mCAAmC,CACpC,CAAC;YACF,IAAM,OAAO,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC1C,OAAO;gBACL,OAAO,EAAE,gBAAQ,CAAC,SAAS;gBAC3B,IAAI,EAAE,gBAAgB;gBACtB,UAAU,EAAE;oBACV,KAAK,EAAE,6DAAsD,OAAO,OAAI;oBACxE,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,cAAc,CAAC;oBAC3D,WAAW,EAAE,KAAK;oBAClB,aAAa,EAAE;wBACb,KAAK,EAAE,oBAAoB;wBAC3B,OAAO,EAAE,mBAAmB;wBAC5B,WAAW,EAAE,eAAe;qBAC7B;iBACF;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,gBAAQ,CAAC,QAAQ;oBAC1B,KAAK,EAAE,SAAS,CAAC,OAAO;iBACzB;gBACD,MAAM,QAAA;aACP,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC;AA/CD,kCA+CC"}
|
package/dist/context.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"@vocab": "http://www.w3.org/ns/earl#",
|
|
3
|
-
"earl": "http://www.w3.org/ns/earl#",
|
|
4
|
-
"WCAG20": "http://www.w3.org/TR/WCAG20/#",
|
|
5
|
-
"WCAG21": "http://www.w3.org/TR/WCAG21/#",
|
|
6
|
-
"auto-wcag": "https://auto-wcag.github.io/auto-wcag/rules/",
|
|
7
|
-
"dct": "http://purl.org/dc/terms#",
|
|
8
|
-
"sch": "https://schema.org/",
|
|
9
|
-
"doap": "http://usefulinc.com/ns/doap#",
|
|
10
|
-
"foaf": "http://xmlns.com/foaf/spec/#",
|
|
11
|
-
"WebPage": "sch:WebPage",
|
|
12
|
-
"url": "dct:source",
|
|
13
|
-
"assertions": {
|
|
14
|
-
"@reverse": "subject"
|
|
15
|
-
},
|
|
16
|
-
"assertedBy": {
|
|
17
|
-
"@type": "@id"
|
|
18
|
-
},
|
|
19
|
-
"outcome": {
|
|
20
|
-
"@type": "@id"
|
|
21
|
-
},
|
|
22
|
-
"mode": {
|
|
23
|
-
"@type": "@id"
|
|
24
|
-
},
|
|
25
|
-
"pointer": {
|
|
26
|
-
"@type": "ptr:CSSSelectorPointer"
|
|
27
|
-
}
|
|
28
|
-
}
|
package/dist/testResult.d.ts
DELETED
package/dist/testResult.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cssToPointer = void 0;
|
|
4
|
-
var types_1 = require("./types");
|
|
5
|
-
function cssToPointer(selector) {
|
|
6
|
-
var item = selector[0];
|
|
7
|
-
if (Array.isArray(item)) {
|
|
8
|
-
return item[0];
|
|
9
|
-
}
|
|
10
|
-
return item;
|
|
11
|
-
}
|
|
12
|
-
exports.cssToPointer = cssToPointer;
|
|
13
|
-
function testResult(_a, outcomes) {
|
|
14
|
-
var description = _a.description;
|
|
15
|
-
if (outcomes === void 0) { outcomes = []; }
|
|
16
|
-
return outcomes.map(function (_a) {
|
|
17
|
-
var node = _a.node, result = _a.result;
|
|
18
|
-
return {
|
|
19
|
-
'@type': types_1.EarlType.TestResult,
|
|
20
|
-
info: description,
|
|
21
|
-
outcome: 'earl:' + result,
|
|
22
|
-
pointer: cssToPointer(node.selector)
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
exports.default = testResult;
|
|
27
|
-
//# sourceMappingURL=testResult.js.map
|
package/dist/testResult.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testResult.js","sourceRoot":"","sources":["../src/testResult.ts"],"names":[],"mappings":";;;AAAA,iCAMiB;AAEjB,SAAgB,YAAY,CAAC,QAAkB;IAC7C,IAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;KAChB;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAND,oCAMC;AAED,SAAwB,UAAU,CAChC,EAA0B,EAC1B,QAA8B;QAD5B,WAAW,iBAAA;IACb,yBAAA,EAAA,aAA8B;IAE9B,OAAO,QAAQ,CAAC,GAAG,CACjB,UAAC,EAAgB;YAAd,IAAI,UAAA,EAAE,MAAM,YAAA;QACb,OAAO;YACL,OAAO,EAAE,gBAAQ,CAAC,UAAU;YAC5B,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,OAAO,GAAG,MAAM;YACzB,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC;SACrC,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAdD,6BAcC"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export declare enum EarlType {
|
|
2
|
-
WebPage = "WebPage",
|
|
3
|
-
Assertion = "Assertion",
|
|
4
|
-
TestCase = "TestCase",
|
|
5
|
-
TestResult = "TestResult"
|
|
6
|
-
}
|
|
7
|
-
export interface EarlResult {
|
|
8
|
-
'@context': object;
|
|
9
|
-
'@type': EarlType.WebPage;
|
|
10
|
-
url: string;
|
|
11
|
-
assertions: Assertion[];
|
|
12
|
-
}
|
|
13
|
-
export interface Assertion {
|
|
14
|
-
'@type': EarlType.Assertion;
|
|
15
|
-
mode: 'earl:automatic';
|
|
16
|
-
assertedBy: {};
|
|
17
|
-
test: {
|
|
18
|
-
'@type': EarlType.TestCase;
|
|
19
|
-
'@id': string;
|
|
20
|
-
};
|
|
21
|
-
result: TestResult;
|
|
22
|
-
}
|
|
23
|
-
export interface TestResult {
|
|
24
|
-
'@type': EarlType.TestResult;
|
|
25
|
-
outcome: string;
|
|
26
|
-
pointer?: string;
|
|
27
|
-
info?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface RawResult {
|
|
30
|
-
id: string;
|
|
31
|
-
helpUrl: string;
|
|
32
|
-
description: string;
|
|
33
|
-
violations?: RawNodeResult[];
|
|
34
|
-
passes?: RawNodeResult[];
|
|
35
|
-
incomplete?: RawNodeResult[];
|
|
36
|
-
}
|
|
37
|
-
export interface RawNodeResult {
|
|
38
|
-
node: {
|
|
39
|
-
selector: Selector;
|
|
40
|
-
};
|
|
41
|
-
result?: 'passed' | 'failed' | 'inapplicable' | 'incomplete';
|
|
42
|
-
}
|
|
43
|
-
export declare type SelectorItem = string[] | string;
|
|
44
|
-
export declare type Selector = SelectorItem[];
|
package/dist/types.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EarlType = void 0;
|
|
4
|
-
var EarlType;
|
|
5
|
-
(function (EarlType) {
|
|
6
|
-
EarlType["WebPage"] = "WebPage";
|
|
7
|
-
EarlType["Assertion"] = "Assertion";
|
|
8
|
-
EarlType["TestCase"] = "TestCase";
|
|
9
|
-
EarlType["TestResult"] = "TestResult";
|
|
10
|
-
})(EarlType = exports.EarlType || (exports.EarlType = {}));
|
|
11
|
-
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,iCAAqB,CAAA;IACrB,qCAAyB,CAAA;AAC3B,CAAC,EALW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAKnB"}
|