testaro 78.0.4 → 78.0.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tests/htmlcs.js +11 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "78.0.4",
3
+ "version": "78.0.5",
4
4
  "description": "Run 1300 web accessibility tests from 10 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tests/htmlcs.js CHANGED
@@ -62,8 +62,19 @@ exports.reporter = async (page, report, actIndex) => {
62
62
  const script = document.createElement('script');
63
63
  script.nonce = scriptNonce;
64
64
  script.textContent = scriptText;
65
+ // HTMLCS.js is a UMD bundle. If the page exposes an AMD loader (define.amd, e.g. Wix or RequireJS) or leaked CommonJS globals (exports, module), the UMD wrapper registers HTMLCS as a module and never attaches HTMLCS_RUNNER to window, so the run() call below throws and the tool is reported prevented. Hide those loader globals for the duration of the synchronous script execution, so the wrapper falls through to its browser-global branch.
66
+ const umdDefine = window.define;
67
+ const umdExports = window.exports;
68
+ const umdModule = window.module;
69
+ window.define = undefined;
70
+ window.exports = undefined;
71
+ window.module = undefined;
65
72
  // Add the HTMLCS script to the page.
66
73
  document.head.insertAdjacentElement('beforeend', script);
74
+ // Restore the loader globals.
75
+ window.define = umdDefine;
76
+ window.exports = umdExports;
77
+ window.module = umdModule;
67
78
  // If only some rules are to be employed:
68
79
  if (rules && Array.isArray(rules) && rules.length) {
69
80
  // Redefine WCAG 2 AAA as including only them.