@axe-core/reporter-earl 4.8.2-e8094c1.0 → 4.8.3-854eeb3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.8.2](https://github.com/dequelabs/axe-core-npm/compare/v4.8.1...v4.8.2) (2023-11-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * allow cjs version of packages to export a default value ([#943](https://github.com/dequelabs/axe-core-npm/issues/943)) ([b5aee34](https://github.com/dequelabs/axe-core-npm/commit/b5aee3424fe4d0fbc0b2065e9c0bc56ce4032755))
12
+ * **webdriverjs:** fix default commonJs export ([#927](https://github.com/dequelabs/axe-core-npm/issues/927)) ([b07d38c](https://github.com/dequelabs/axe-core-npm/commit/b07d38cc2d85c6127391686482abf762758dce34))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [4.8.1](https://github.com/dequelabs/axe-core-npm/compare/v4.7.3...v4.8.1) (2023-10-11)
7
19
 
8
20
 
@@ -136,3 +136,16 @@ function axeReporterEarl(rawResults, {}, callback) {
136
136
  0 && (module.exports = {
137
137
  createEarlReport
138
138
  });
139
+
140
+ if (module.exports.default) {
141
+ var ___default_export = module.exports.default;
142
+ var ___export_entries = Object.entries(module.exports);
143
+ module.exports = ___default_export;
144
+ ___export_entries.forEach(([key, value]) => {
145
+ if (module.exports[key]) {
146
+ throw new Error(`Export "${key}" already exists on default export`);
147
+ }
148
+
149
+ module.exports[key] = value;
150
+ });
151
+ }
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-e8094c1.0+e8094c1",
3
+ "version": "4.8.3-854eeb3.0+854eeb3",
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"
@@ -54,5 +57,5 @@
54
57
  "tsup": "^7.2.0",
55
58
  "typescript": "^4.8.4"
56
59
  },
57
- "gitHead": "e8094c18cde388c7c4b7218e1daa22151b8054f0"
60
+ "gitHead": "854eeb31d9b540ed30d602452c1d833600ecad20"
58
61
  }
@@ -0,0 +1,18 @@
1
+ // ensure backwards compatibility of commonJs format
2
+ const implicitDefaultExport = require('../dist/axeReporterEarl.js');
3
+ const explicitDefaultExport = require('../dist/axeReporterEarl.js').default;
4
+ const assert = require('assert');
5
+
6
+ assert(
7
+ typeof implicitDefaultExport === 'function',
8
+ 'implicit default export is not a function'
9
+ );
10
+
11
+ assert(
12
+ typeof explicitDefaultExport === 'function',
13
+ 'explicit default export is not a function'
14
+ );
15
+ assert(
16
+ explicitDefaultExport === implicitDefaultExport,
17
+ 'explicit default and named export are not the same'
18
+ );
@@ -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 });
package/tsup.config.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'tsup';
2
+ import { esbuildPluginCJSInterop } from '../../utils/esbuild-plugin-cjs-interop.js';
3
+
4
+ export default defineConfig({
5
+ esbuildPlugins: [esbuildPluginCJSInterop]
6
+ });