@axe-core/reporter-earl 4.7.4-10cf350.0 → 4.7.4-2ac1eaf.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/dist/axeReporterEarl.d.ts +2 -2
- package/dist/axeReporterEarl.js +29 -65
- package/dist/axeReporterEarl.mjs +29 -71
- package/package.json +6 -7
- package/src/axeReporterEarl.ts +1 -1
- 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
|
@@ -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
|
|
@@ -156,12 +120,12 @@ function axeResultToEarl(rawResults) {
|
|
|
156
120
|
}
|
|
157
121
|
|
|
158
122
|
// src/axeReporterEarl.ts
|
|
159
|
-
function createEarlReport(rawResults,
|
|
123
|
+
function createEarlReport(rawResults, url) {
|
|
160
124
|
debugger;
|
|
161
125
|
return {
|
|
162
|
-
"@context":
|
|
126
|
+
"@context": context_default,
|
|
163
127
|
"@type": "WebPage" /* WebPage */,
|
|
164
|
-
url:
|
|
128
|
+
url: url ? url : window.location.href,
|
|
165
129
|
assertions: axeResultToEarl(rawResults)
|
|
166
130
|
};
|
|
167
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
|
|
@@ -135,12 +93,12 @@ function axeResultToEarl(rawResults) {
|
|
|
135
93
|
}
|
|
136
94
|
|
|
137
95
|
// src/axeReporterEarl.ts
|
|
138
|
-
function createEarlReport(rawResults,
|
|
96
|
+
function createEarlReport(rawResults, url) {
|
|
139
97
|
debugger;
|
|
140
98
|
return {
|
|
141
|
-
"@context":
|
|
99
|
+
"@context": context_default,
|
|
142
100
|
"@type": "WebPage" /* WebPage */,
|
|
143
|
-
url:
|
|
101
|
+
url: url ? url : window.location.href,
|
|
144
102
|
assertions: axeResultToEarl(rawResults)
|
|
145
103
|
};
|
|
146
104
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axe-core/reporter-earl",
|
|
3
|
-
"version": "4.7.4-
|
|
3
|
+
"version": "4.7.4-2ac1eaf.0+2ac1eaf",
|
|
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": "^4.
|
|
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": "2ac1eafa6318453003ccfd7c33625e63725a7c00"
|
|
59
58
|
}
|
package/src/axeReporterEarl.ts
CHANGED
|
@@ -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
|
}
|