@axe-core/reporter-earl 4.8.2-9a65b64.0 → 4.8.2-aab6d3c.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.mts +49 -0
- package/jest.config.js +1 -1
- package/package.json +8 -5
- package/tests/commonjsTest.js +6 -0
- package/{esmTest.mjs → tests/esmTest.mjs} +2 -1
- package/tests/tsTest.ts +18 -0
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
type SelectorItem = string[] | string;
|
|
44
|
+
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/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axe-core/reporter-earl",
|
|
3
|
-
"version": "4.8.2-
|
|
3
|
+
"version": "4.8.2-aab6d3c.0+aab6d3c",
|
|
4
4
|
"description": "A EARL+JSON-LD reporter for axe-core",
|
|
5
5
|
"main": "dist/axeReporterEarl.js",
|
|
6
6
|
"module": "./dist/axeReporterEarl.mjs",
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"start": "NODE_OPTIONS=--experimental-vm-modules jest --watch --env=jsdom",
|
|
17
17
|
"test": "npm run build && npm run test:unit",
|
|
18
|
-
"test:
|
|
18
|
+
"test:export": "npm run test:esm && npm run test:commonjs && npm run test:ts",
|
|
19
|
+
"test:esm": "node tests/esmTest.mjs",
|
|
20
|
+
"test:commonjs": "node tests/commonjsTest.js",
|
|
21
|
+
"test:ts": "tsc tests/tsTest.ts --noEmit --skipLibCheck --esModuleInterop",
|
|
19
22
|
"test:unit": "NODE_OPTIONS=--experimental-vm-modules jest --collectCoverage",
|
|
20
23
|
"build": "tsup src/axeReporterEarl.ts --dts --format esm,cjs",
|
|
21
24
|
"prepublishOnly": "npm run build"
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
"devDependencies": {
|
|
43
46
|
"@types/clone": "^2.1.1",
|
|
44
47
|
"@types/jsonld": "github:types/jsonld",
|
|
45
|
-
"@types/node": "^
|
|
48
|
+
"@types/node": "^20.8.10",
|
|
46
49
|
"axe-core": "~4.8.2",
|
|
47
50
|
"clone": "^2.1.2",
|
|
48
51
|
"cross-env": "^7.0.3",
|
|
@@ -51,8 +54,8 @@
|
|
|
51
54
|
"jsonld": "^8.2.1",
|
|
52
55
|
"ts-jest": "^29.0.3",
|
|
53
56
|
"ts-node": "^10.9.1",
|
|
54
|
-
"tsup": "^
|
|
57
|
+
"tsup": "^7.2.0",
|
|
55
58
|
"typescript": "^4.8.4"
|
|
56
59
|
},
|
|
57
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "aab6d3cbbb6b69623b58fd8f4be1126a13740fab"
|
|
58
61
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// ensure backwards compatibility of commonJs format
|
|
2
|
+
const defaultExport = require('../dist/axeReporterEarl.js').default;
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
|
|
5
|
+
const exportIsFunction = typeof defaultExport === 'function';
|
|
6
|
+
assert(exportIsFunction, 'export is not a function');
|
package/tests/tsTest.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// This file isn't executed; we only care that typescript can successfully
|
|
2
|
+
// build/typecheck. It is a smoke test that our build process is producing a
|
|
3
|
+
// basically-reasonable index.d.ts.
|
|
4
|
+
|
|
5
|
+
// Detailed tests of individual types should instead be covered by unit tests.
|
|
6
|
+
|
|
7
|
+
import DefaultImportReporter from '../dist/axeReporterEarl.js';
|
|
8
|
+
// import axe from 'axe-core';
|
|
9
|
+
|
|
10
|
+
// See https://stackoverflow.com/a/55541672
|
|
11
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
12
|
+
|
|
13
|
+
// If the imports don't have typings assigned, these will fail
|
|
14
|
+
// with "ts(2322): Type 'false' is not assignable to type 'true'."
|
|
15
|
+
(x: IsAny<typeof DefaultImportReporter>): false => x;
|
|
16
|
+
|
|
17
|
+
// TODO: this doesn't work as our types are broken
|
|
18
|
+
// axe.configure({ reporter: DefaultImportReporter });
|