@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.
@@ -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
@@ -4,7 +4,7 @@ module.exports = {
4
4
  transform: {
5
5
  '\\.(ts|tsx)$': 'ts-jest'
6
6
  },
7
- testRegex: '/tests/.*\\.(ts|tsx|js)$',
7
+ testPathDirs: 'tests',
8
8
  testPathIgnorePatterns: ['/node_modules/', '/dist/', '/tests/utils.ts'],
9
9
  silent: false,
10
10
  coverageThreshold: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axe-core/reporter-earl",
3
- "version": "4.8.2-9a65b64.0+9a65b64",
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:esm": "node esmTest.mjs",
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": "^18.8.3",
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": "^6.7.0",
57
+ "tsup": "^7.2.0",
55
58
  "typescript": "^4.8.4"
56
59
  },
57
- "gitHead": "9a65b64304f7b4c375892eeb2d2fa6fb6c71ac87"
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');
@@ -1,4 +1,5 @@
1
- import defaultExport from './dist/axeReporterEarl.mjs';
1
+ // ensure compatibility of ESM format
2
+ import defaultExport from '../dist/axeReporterEarl.mjs';
2
3
  import assert from 'assert';
3
4
 
4
5
  const exportIsFunction = typeof defaultExport === 'function';
@@ -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 });