@qualweb/earl-reporter 0.3.0 → 0.4.2
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/LICENSE +14 -14
- package/README.md +68 -68
- package/dist/contants.d.ts +941 -0
- package/dist/contants.d.ts.map +1 -0
- package/dist/contants.js +945 -0
- package/dist/contants.js.map +1 -0
- package/dist/index.d.ts +6 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -134
- package/dist/index.js.map +1 -1
- package/package.json +63 -51
- package/.eslintignore +0 -3
- package/.eslintrc +0 -19
- package/.prettierrc +0 -6
- package/CHANGELOG +0 -86
- package/dist/lib/act-rules.reporter.d.ts +0 -6
- package/dist/lib/act-rules.reporter.d.ts.map +0 -1
- package/dist/lib/act-rules.reporter.js +0 -59
- package/dist/lib/act-rules.reporter.js.map +0 -1
- package/dist/lib/best-practices.reporter.d.ts +0 -6
- package/dist/lib/best-practices.reporter.d.ts.map +0 -1
- package/dist/lib/best-practices.reporter.js +0 -58
- package/dist/lib/best-practices.reporter.js.map +0 -1
- package/dist/lib/wcag-techniques.reporter.d.ts +0 -6
- package/dist/lib/wcag-techniques.reporter.d.ts.map +0 -1
- package/dist/lib/wcag-techniques.reporter.js +0 -59
- package/dist/lib/wcag-techniques.reporter.js.map +0 -1
- package/src/index.ts +0 -130
- package/src/lib/act-rules.reporter.ts +0 -61
- package/src/lib/best-practices.reporter.ts +0 -58
- package/src/lib/wcag-techniques.reporter.ts +0 -58
- package/test/modules.spec.js +0 -286
- package/test/report.spec.js +0 -665
- package/tsconfig.json +0 -38
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/// <reference types="@qualweb/types" />
|
|
2
|
-
import { ACTRulesReport } from '@qualweb/act-rules';
|
|
3
|
-
import { Assertion } from '@qualweb/earl-reporter';
|
|
4
|
-
declare function ACTRulesReportToEARL(report: ACTRulesReport, date?: string): Promise<Assertion[]>;
|
|
5
|
-
export = ACTRulesReportToEARL;
|
|
6
|
-
//# sourceMappingURL=act-rules.reporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"act-rules.reporter.d.ts","sourceRoot":"","sources":["../../src/lib/act-rules.reporter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAW,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAA4B,MAAM,wBAAwB,CAAC;AAE7E,iBAAe,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAmC/F;AAsBD,SAAS,oBAAoB,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
function ACTRulesReportToEARL(report, date) {
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
const assertions = new Array();
|
|
14
|
-
for (const ruleName in report.assertions || {}) {
|
|
15
|
-
if (report.assertions[ruleName]) {
|
|
16
|
-
const rule = report.assertions[ruleName];
|
|
17
|
-
if (rule) {
|
|
18
|
-
const sources = generateSources(rule);
|
|
19
|
-
const result = {
|
|
20
|
-
'@type': 'TestResult',
|
|
21
|
-
outcome: 'earl:' + (rule.metadata.outcome !== 'warning' ? rule.metadata.outcome : 'cantTell'),
|
|
22
|
-
source: sources,
|
|
23
|
-
description: rule.metadata.description,
|
|
24
|
-
date: date ? date : new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '')
|
|
25
|
-
};
|
|
26
|
-
const assertion = {
|
|
27
|
-
'@type': 'Assertion',
|
|
28
|
-
test: {
|
|
29
|
-
'@id': rule.metadata.url,
|
|
30
|
-
'@type': 'TestCase',
|
|
31
|
-
title: rule.name,
|
|
32
|
-
description: rule.description
|
|
33
|
-
},
|
|
34
|
-
mode: 'earl:automatic',
|
|
35
|
-
result
|
|
36
|
-
};
|
|
37
|
-
assertions.push(assertion);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return assertions;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function generateSources(rule) {
|
|
45
|
-
var _a;
|
|
46
|
-
const sources = new Array();
|
|
47
|
-
for (const result of rule.results || []) {
|
|
48
|
-
const source = {
|
|
49
|
-
result: {
|
|
50
|
-
pointer: (_a = result.elements) === null || _a === void 0 ? void 0 : _a.filter((e) => e.pointer !== undefined).map((e) => e.pointer).join(', '),
|
|
51
|
-
outcome: 'earl:' + (result.verdict !== 'warning' ? result.verdict : 'cantTell')
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
sources.push(source);
|
|
55
|
-
}
|
|
56
|
-
return sources;
|
|
57
|
-
}
|
|
58
|
-
module.exports = ACTRulesReportToEARL;
|
|
59
|
-
//# sourceMappingURL=act-rules.reporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"act-rules.reporter.js","sourceRoot":"","sources":["../../src/lib/act-rules.reporter.ts"],"names":[],"mappings":";;;;;;;;;;AAGA,SAAe,oBAAoB,CAAC,MAAsB,EAAE,IAAa;;QACvE,MAAM,UAAU,GAAG,IAAI,KAAK,EAAa,CAAC;QAE1C,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE;YAC9C,IAAI,MAAM,CAA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;YAC3B,MAAM,EAAE;gBACN,OAAO,QAAE,MAAM,CAAC,QAAQ,0CACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,EACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EACpB,IAAI,CAAC,IAAI,CAAC;gBACb,OAAO,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;aAChF;SACF,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACtB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,iBAAS,oBAAoB,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/// <reference types="@qualweb/types" />
|
|
2
|
-
import { Assertion } from '@qualweb/earl-reporter';
|
|
3
|
-
import { BestPracticesReport } from '@qualweb/best-practices';
|
|
4
|
-
declare function BestPracticesReportToEARL(report: BestPracticesReport, date?: string): Promise<Assertion[]>;
|
|
5
|
-
export = BestPracticesReportToEARL;
|
|
6
|
-
//# sourceMappingURL=best-practices.reporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.reporter.d.ts","sourceRoot":"","sources":["../../src/lib/best-practices.reporter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAA4B,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAgB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE5E,iBAAe,yBAAyB,CAAC,MAAM,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAmCzG;AAmBD,SAAS,yBAAyB,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
function BestPracticesReportToEARL(report, date) {
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
const assertions = new Array();
|
|
14
|
-
for (const bpName in report.assertions || {}) {
|
|
15
|
-
if (report.assertions[bpName]) {
|
|
16
|
-
const bestPractice = report.assertions[bpName];
|
|
17
|
-
if (bestPractice) {
|
|
18
|
-
const sources = generateSources(bestPractice);
|
|
19
|
-
const result = {
|
|
20
|
-
'@type': 'TestResult',
|
|
21
|
-
outcome: 'earl:' + (bestPractice.metadata.outcome !== 'warning' ? bestPractice.metadata.outcome : 'cantTell'),
|
|
22
|
-
source: sources,
|
|
23
|
-
description: bestPractice.metadata.description,
|
|
24
|
-
date: date || new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '')
|
|
25
|
-
};
|
|
26
|
-
const assertion = {
|
|
27
|
-
'@type': 'Assertion',
|
|
28
|
-
test: {
|
|
29
|
-
'@id': bestPractice.metadata.url || bestPractice.name,
|
|
30
|
-
'@type': 'TestCase',
|
|
31
|
-
title: bestPractice.name,
|
|
32
|
-
description: bestPractice.description
|
|
33
|
-
},
|
|
34
|
-
mode: 'earl:automatic',
|
|
35
|
-
result
|
|
36
|
-
};
|
|
37
|
-
assertions.push(assertion);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return assertions;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function generateSources(bestPractice) {
|
|
45
|
-
const sources = new Array();
|
|
46
|
-
for (const result of bestPractice.results || []) {
|
|
47
|
-
const source = {
|
|
48
|
-
result: {
|
|
49
|
-
pointer: result.pointer,
|
|
50
|
-
outcome: 'earl:' + (result.verdict !== 'warning' ? result.verdict : 'cantTell')
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
sources.push(source);
|
|
54
|
-
}
|
|
55
|
-
return sources;
|
|
56
|
-
}
|
|
57
|
-
module.exports = BestPracticesReportToEARL;
|
|
58
|
-
//# sourceMappingURL=best-practices.reporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.reporter.js","sourceRoot":"","sources":["../../src/lib/best-practices.reporter.ts"],"names":[],"mappings":";;;;;;;;;;AAGA,SAAe,yBAAyB,CAAC,MAA2B,EAAE,IAAa;;QACjF,MAAM,UAAU,GAAG,IAAI,KAAK,EAAa,CAAC;QAE1C,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE;YAC5C,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;gBAC7B,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAC/C,IAAI,YAAY,EAAE;oBAChB,MAAM,OAAO,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;oBAE9C,MAAM,MAAM,GAAe;wBACzB,OAAO,EAAE,YAAY;wBACrB,OAAO,EAAE,OAAO,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;wBAC7G,MAAM,EAAE,OAAO;wBACf,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAC,WAAW;wBAC9C,IAAI,EAAE,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;qBAC7E,CAAC;oBAEF,MAAM,SAAS,GAAc;wBAC3B,OAAO,EAAE,WAAW;wBACpB,IAAI,EAAE;4BACJ,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,YAAY,CAAC,IAAI;4BACrD,OAAO,EAAE,UAAU;4BACnB,KAAK,EAAE,YAAY,CAAC,IAAI;4BACxB,WAAW,EAAE,YAAY,CAAC,WAAW;yBACtC;wBACD,IAAI,EAAE,gBAAgB;wBACtB,MAAM;qBACP,CAAC;oBAEF,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBAC5B;aACF;SACF;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CAAA;AAED,SAAS,eAAe,CAAC,YAA0B;IACjD,MAAM,OAAO,GAAG,IAAI,KAAK,EAAgB,CAAC;IAE1C,KAAK,MAAM,MAAM,IAAI,YAAY,CAAC,OAAO,IAAI,EAAE,EAAE;QAC/C,MAAM,MAAM,GAAiB;YAC3B,MAAM,EAAE;gBACN,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,OAAO,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;aAChF;SACF,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACtB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,iBAAS,yBAAyB,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/// <reference types="@qualweb/types" />
|
|
2
|
-
import { Assertion } from '@qualweb/earl-reporter';
|
|
3
|
-
import { WCAGTechniquesReport } from '@qualweb/wcag-techniques';
|
|
4
|
-
declare function WCAGTechniquesReportToEARL(report: WCAGTechniquesReport, date?: string): Promise<Assertion[]>;
|
|
5
|
-
export = WCAGTechniquesReportToEARL;
|
|
6
|
-
//# sourceMappingURL=wcag-techniques.reporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wcag-techniques.reporter.d.ts","sourceRoot":"","sources":["../../src/lib/wcag-techniques.reporter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAA4B,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAiB,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAE/E,iBAAe,0BAA0B,CAAC,MAAM,EAAE,oBAAoB,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAmC3G;AAmBD,SAAS,0BAA0B,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
function WCAGTechniquesReportToEARL(report, date) {
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
const assertions = new Array();
|
|
14
|
-
for (const techniqueName in report.assertions || {}) {
|
|
15
|
-
if (report.assertions[techniqueName]) {
|
|
16
|
-
const technique = report.assertions[techniqueName];
|
|
17
|
-
if (technique) {
|
|
18
|
-
const sources = generateSources(technique);
|
|
19
|
-
const result = {
|
|
20
|
-
'@type': 'TestResult',
|
|
21
|
-
outcome: 'earl:' + (technique.metadata.outcome !== 'warning' ? technique.metadata.outcome : 'cantTell'),
|
|
22
|
-
source: sources,
|
|
23
|
-
description: technique.metadata.description,
|
|
24
|
-
date: date ? date : new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '')
|
|
25
|
-
};
|
|
26
|
-
const assertion = {
|
|
27
|
-
'@type': 'Assertion',
|
|
28
|
-
test: {
|
|
29
|
-
'@id': technique.metadata.url,
|
|
30
|
-
'@type': 'TestCase',
|
|
31
|
-
title: technique.name,
|
|
32
|
-
description: technique.description
|
|
33
|
-
},
|
|
34
|
-
mode: 'earl:automatic',
|
|
35
|
-
result
|
|
36
|
-
};
|
|
37
|
-
assertions.push(assertion);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return assertions;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function generateSources(technique) {
|
|
45
|
-
var _a;
|
|
46
|
-
const sources = new Array();
|
|
47
|
-
for (const result of technique.results || []) {
|
|
48
|
-
const source = {
|
|
49
|
-
result: {
|
|
50
|
-
pointer: (_a = result.elements) === null || _a === void 0 ? void 0 : _a.map((e) => e.pointer).join(', '),
|
|
51
|
-
outcome: 'earl:' + (result.verdict !== 'warning' ? result.verdict : 'cantTell')
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
sources.push(source);
|
|
55
|
-
}
|
|
56
|
-
return sources;
|
|
57
|
-
}
|
|
58
|
-
module.exports = WCAGTechniquesReportToEARL;
|
|
59
|
-
//# sourceMappingURL=wcag-techniques.reporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wcag-techniques.reporter.js","sourceRoot":"","sources":["../../src/lib/wcag-techniques.reporter.ts"],"names":[],"mappings":";;;;;;;;;;AAGA,SAAe,0BAA0B,CAAC,MAA4B,EAAE,IAAa;;QACnF,MAAM,UAAU,GAAG,IAAI,KAAK,EAAa,CAAC;QAE1C,KAAK,MAAM,aAAa,I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,SAAS,CAAC,OAAO,IAAI,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAiB;YAC3B,MAAM,EAAE;gBACN,OAAO,QAAE,MAAM,CAAC,QAAQ,0CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC;gBAC1D,OAAO,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;aAChF;SACF,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACtB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,iBAAS,0BAA0B,CAAC"}
|
package/src/index.ts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
2
|
-
import { EvaluationReport } from '@qualweb/core';
|
|
3
|
-
import { Report, EarlReport, TestSubject, Assertor, Assertion, EarlOptions } from '@qualweb/earl-reporter';
|
|
4
|
-
|
|
5
|
-
import ACTRulesReportToEARL from './lib/act-rules.reporter';
|
|
6
|
-
import WCAGTechniquesReportToEARL from './lib/wcag-techniques.reporter';
|
|
7
|
-
import BestPracticesReportToEARL from './lib/best-practices.reporter';
|
|
8
|
-
|
|
9
|
-
const wcagTechniques = 'wcag-techniques';
|
|
10
|
-
const bestPractices = 'best-practices';
|
|
11
|
-
|
|
12
|
-
async function generateEARLAssertions(report: Report | undefined, date?: string): Promise<Assertion[]> {
|
|
13
|
-
if (report) {
|
|
14
|
-
switch (report.type) {
|
|
15
|
-
case 'act-rules':
|
|
16
|
-
return await ACTRulesReportToEARL(report, date);
|
|
17
|
-
case wcagTechniques:
|
|
18
|
-
return await WCAGTechniquesReportToEARL(report, date);
|
|
19
|
-
case bestPractices:
|
|
20
|
-
return await BestPracticesReportToEARL(report, date);
|
|
21
|
-
default:
|
|
22
|
-
throw new Error('Invalid report type');
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
throw new Error('Report is not defined');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function reportModule(module: string, options?: EarlOptions): boolean {
|
|
30
|
-
if (!options || !options.modules) {
|
|
31
|
-
return true;
|
|
32
|
-
} else {
|
|
33
|
-
switch (module) {
|
|
34
|
-
case 'act':
|
|
35
|
-
return !!options.modules.act;
|
|
36
|
-
case 'wcag':
|
|
37
|
-
return !!options.modules.wcag;
|
|
38
|
-
case bestPractices:
|
|
39
|
-
return !!options.modules[bestPractices];
|
|
40
|
-
default:
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function generateSingleEarlReport(report: EvaluationReport, options?: EarlOptions): Promise<EarlReport> {
|
|
47
|
-
const earlReport: EarlReport = {
|
|
48
|
-
'@context': 'https://act-rules.github.io/earl-context.json',
|
|
49
|
-
'@graph': new Array<TestSubject>()
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const assertor: Assertor = {
|
|
53
|
-
'@id': report.system.name,
|
|
54
|
-
'@type': 'Software',
|
|
55
|
-
title: report.system.name,
|
|
56
|
-
description: report.system.description,
|
|
57
|
-
hasVersion: report.system.version,
|
|
58
|
-
homepage: report.system.homepage
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const testSubject: TestSubject = {
|
|
62
|
-
'@type': 'TestSubject',
|
|
63
|
-
source: report.system.url?.inputUrl || '',
|
|
64
|
-
assertor,
|
|
65
|
-
assertions: new Array<Assertion>()
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
if (report.system.url && report.system.url.inputUrl !== report.system.url.completeUrl) {
|
|
69
|
-
testSubject.redirectedTo = report.system.url.completeUrl;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (report.modules['act-rules'] && reportModule('act', options)) {
|
|
73
|
-
testSubject.assertions = [
|
|
74
|
-
...testSubject.assertions,
|
|
75
|
-
...(await generateEARLAssertions(report.modules['act-rules'], report.system.date))
|
|
76
|
-
];
|
|
77
|
-
}
|
|
78
|
-
if (report.modules[wcagTechniques] && reportModule('wcag', options)) {
|
|
79
|
-
testSubject.assertions = [
|
|
80
|
-
...testSubject.assertions,
|
|
81
|
-
...(await generateEARLAssertions(report.modules[wcagTechniques], report.system.date))
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
if (report.modules[bestPractices] && reportModule(bestPractices, options)) {
|
|
85
|
-
testSubject.assertions = [
|
|
86
|
-
...testSubject.assertions,
|
|
87
|
-
...(await generateEARLAssertions(report.modules[bestPractices], report.system.date))
|
|
88
|
-
];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
earlReport['@graph'].push(cloneDeep(testSubject));
|
|
92
|
-
|
|
93
|
-
return earlReport;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async function generateAggregatedEarlReport(reports: EvaluationReport[], options?: EarlOptions): Promise<EarlReport> {
|
|
97
|
-
const aggregatedReport: EarlReport = {
|
|
98
|
-
'@context': 'https://act-rules.github.io/earl-context.json',
|
|
99
|
-
'@graph': new Array<TestSubject>()
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
for (const report of reports || []) {
|
|
103
|
-
const earlReport = await generateSingleEarlReport(report, options);
|
|
104
|
-
aggregatedReport['@graph'].push(cloneDeep(earlReport['@graph'][0]));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return aggregatedReport;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async function generateEARLReport(
|
|
111
|
-
reports: { [url: string]: EvaluationReport },
|
|
112
|
-
options?: EarlOptions
|
|
113
|
-
): Promise<{ [url: string]: EarlReport }> {
|
|
114
|
-
const earlReports: { [url: string]: EarlReport } = {};
|
|
115
|
-
if (options && options.aggregated) {
|
|
116
|
-
const firstUrl = Object.keys(reports)[0];
|
|
117
|
-
earlReports[options.aggregatedName || firstUrl] = await generateAggregatedEarlReport(
|
|
118
|
-
Object.values(reports),
|
|
119
|
-
options
|
|
120
|
-
);
|
|
121
|
-
} else {
|
|
122
|
-
for (const url in reports || {}) {
|
|
123
|
-
const earlReport = await generateSingleEarlReport(reports[url], options);
|
|
124
|
-
earlReports[url] = cloneDeep(earlReport);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return cloneDeep(earlReports);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export { generateEARLAssertions, generateEARLReport };
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { ACTRule, ACTRulesReport } from '@qualweb/act-rules';
|
|
2
|
-
import { Assertion, TestResult, ResultSource } from '@qualweb/earl-reporter';
|
|
3
|
-
|
|
4
|
-
async function ACTRulesReportToEARL(report: ACTRulesReport, date?: string): Promise<Assertion[]> {
|
|
5
|
-
const assertions = new Array<Assertion>();
|
|
6
|
-
|
|
7
|
-
for (const ruleName in report.assertions || {}) {
|
|
8
|
-
if (report.assertions[ruleName]) {
|
|
9
|
-
const rule = report.assertions[ruleName];
|
|
10
|
-
if (rule) {
|
|
11
|
-
const sources = generateSources(rule);
|
|
12
|
-
|
|
13
|
-
const result: TestResult = {
|
|
14
|
-
'@type': 'TestResult',
|
|
15
|
-
outcome: 'earl:' + (rule.metadata.outcome !== 'warning' ? rule.metadata.outcome : 'cantTell'),
|
|
16
|
-
source: sources,
|
|
17
|
-
description: rule.metadata.description,
|
|
18
|
-
date: date ? date : new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '')
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const assertion: Assertion = {
|
|
22
|
-
'@type': 'Assertion',
|
|
23
|
-
test: {
|
|
24
|
-
'@id': rule.metadata.url,
|
|
25
|
-
'@type': 'TestCase',
|
|
26
|
-
title: rule.name,
|
|
27
|
-
description: rule.description
|
|
28
|
-
},
|
|
29
|
-
mode: 'earl:automatic',
|
|
30
|
-
result
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
assertions.push(assertion);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return assertions;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function generateSources(rule: ACTRule): Array<ResultSource> {
|
|
42
|
-
const sources = new Array<ResultSource>();
|
|
43
|
-
|
|
44
|
-
for (const result of rule.results || []) {
|
|
45
|
-
const source: ResultSource = {
|
|
46
|
-
result: {
|
|
47
|
-
pointer: result.elements
|
|
48
|
-
?.filter((e) => e.pointer !== undefined)
|
|
49
|
-
.map((e) => e.pointer)
|
|
50
|
-
.join(', '),
|
|
51
|
-
outcome: 'earl:' + (result.verdict !== 'warning' ? result.verdict : 'cantTell')
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
sources.push(source);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return sources;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export = ACTRulesReportToEARL;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Assertion, TestResult, ResultSource } from '@qualweb/earl-reporter';
|
|
2
|
-
import { BestPractice, BestPracticesReport } from '@qualweb/best-practices';
|
|
3
|
-
|
|
4
|
-
async function BestPracticesReportToEARL(report: BestPracticesReport, date?: string): Promise<Assertion[]> {
|
|
5
|
-
const assertions = new Array<Assertion>();
|
|
6
|
-
|
|
7
|
-
for (const bpName in report.assertions || {}) {
|
|
8
|
-
if (report.assertions[bpName]) {
|
|
9
|
-
const bestPractice = report.assertions[bpName];
|
|
10
|
-
if (bestPractice) {
|
|
11
|
-
const sources = generateSources(bestPractice);
|
|
12
|
-
|
|
13
|
-
const result: TestResult = {
|
|
14
|
-
'@type': 'TestResult',
|
|
15
|
-
outcome: 'earl:' + (bestPractice.metadata.outcome !== 'warning' ? bestPractice.metadata.outcome : 'cantTell'),
|
|
16
|
-
source: sources,
|
|
17
|
-
description: bestPractice.metadata.description,
|
|
18
|
-
date: date || new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '')
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const assertion: Assertion = {
|
|
22
|
-
'@type': 'Assertion',
|
|
23
|
-
test: {
|
|
24
|
-
'@id': bestPractice.metadata.url || bestPractice.name,
|
|
25
|
-
'@type': 'TestCase',
|
|
26
|
-
title: bestPractice.name,
|
|
27
|
-
description: bestPractice.description
|
|
28
|
-
},
|
|
29
|
-
mode: 'earl:automatic',
|
|
30
|
-
result
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
assertions.push(assertion);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return assertions;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function generateSources(bestPractice: BestPractice): Array<ResultSource> {
|
|
42
|
-
const sources = new Array<ResultSource>();
|
|
43
|
-
|
|
44
|
-
for (const result of bestPractice.results || []) {
|
|
45
|
-
const source: ResultSource = {
|
|
46
|
-
result: {
|
|
47
|
-
pointer: result.pointer,
|
|
48
|
-
outcome: 'earl:' + (result.verdict !== 'warning' ? result.verdict : 'cantTell')
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
sources.push(source);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return sources;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export = BestPracticesReportToEARL;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Assertion, TestResult, ResultSource } from '@qualweb/earl-reporter';
|
|
2
|
-
import { WCAGTechnique, WCAGTechniquesReport } from '@qualweb/wcag-techniques';
|
|
3
|
-
|
|
4
|
-
async function WCAGTechniquesReportToEARL(report: WCAGTechniquesReport, date?: string): Promise<Assertion[]> {
|
|
5
|
-
const assertions = new Array<Assertion>();
|
|
6
|
-
|
|
7
|
-
for (const techniqueName in report.assertions || {}) {
|
|
8
|
-
if (report.assertions[techniqueName]) {
|
|
9
|
-
const technique = report.assertions[techniqueName];
|
|
10
|
-
if (technique) {
|
|
11
|
-
const sources = generateSources(technique);
|
|
12
|
-
|
|
13
|
-
const result: TestResult = {
|
|
14
|
-
'@type': 'TestResult',
|
|
15
|
-
outcome: 'earl:' + (technique.metadata.outcome !== 'warning' ? technique.metadata.outcome : 'cantTell'),
|
|
16
|
-
source: sources,
|
|
17
|
-
description: technique.metadata.description,
|
|
18
|
-
date: date ? date : new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '')
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const assertion: Assertion = {
|
|
22
|
-
'@type': 'Assertion',
|
|
23
|
-
test: {
|
|
24
|
-
'@id': technique.metadata.url,
|
|
25
|
-
'@type': 'TestCase',
|
|
26
|
-
title: technique.name,
|
|
27
|
-
description: technique.description
|
|
28
|
-
},
|
|
29
|
-
mode: 'earl:automatic',
|
|
30
|
-
result
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
assertions.push(assertion);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return assertions;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function generateSources(technique: WCAGTechnique): Array<ResultSource> {
|
|
42
|
-
const sources = new Array<ResultSource>();
|
|
43
|
-
|
|
44
|
-
for (const result of technique.results || []) {
|
|
45
|
-
const source: ResultSource = {
|
|
46
|
-
result: {
|
|
47
|
-
pointer: result.elements?.map((e) => e.pointer).join(', '),
|
|
48
|
-
outcome: 'earl:' + (result.verdict !== 'warning' ? result.verdict : 'cantTell')
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
sources.push(source);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return sources;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export = WCAGTechniquesReportToEARL;
|