@axe-core/watcher 2.0.0-next.3e4ae779 → 2.0.0-next.7e99a295

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/webdriver.js CHANGED
@@ -1,19 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -23,49 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
24
9
  });
25
10
  };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
54
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
55
- if (ar || !(i in from)) {
56
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
57
- ar[i] = from[i];
58
- }
59
- }
60
- return to.concat(ar || Array.prototype.slice.call(from));
61
- };
62
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
63
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
64
13
  };
65
14
  Object.defineProperty(exports, "__esModule", { value: true });
66
15
  exports.WebdriverController = exports.webdriverConfig = void 0;
67
- var util_1 = require("./util");
68
- var Controller_1 = __importDefault(require("./Controller"));
16
+ const util_1 = require("./util");
17
+ const Controller_1 = __importDefault(require("./Controller"));
69
18
  /**
70
19
  * Creates a Selenium config that uses axe extension
71
20
  *
@@ -75,11 +24,11 @@ function webdriverConfig(arg) {
75
24
  var _a, _b;
76
25
  // Lazily require `chrome` to avoid Puppeteer/Playwright/WDIO users from needing `selenium-webdriver` installed.
77
26
  // eslint-disable-next-line @typescript-eslint/no-var-requires
78
- var chrome = require('selenium-webdriver/chrome');
79
- var axe = arg.axe, options = arg.options;
27
+ const chrome = require('selenium-webdriver/chrome');
28
+ const { axe, options } = arg;
80
29
  (0, util_1.writeVariables)(axe);
81
- var opts = options ? options : new chrome.Options();
82
- opts.addArguments.apply(opts, util_1.extensionArgs);
30
+ const opts = options ? options : new chrome.Options();
31
+ opts.addArguments(...util_1.extensionArgs);
83
32
  // Note: fragile, but selenium does not give us a real way to check this
84
33
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
34
  if ((_b = (_a = opts === null || opts === void 0 ? void 0 : opts.options_) === null || _a === void 0 ? void 0 : _a.args) === null || _b === void 0 ? void 0 : _b.includes('headless')) {
@@ -88,34 +37,22 @@ function webdriverConfig(arg) {
88
37
  return opts;
89
38
  }
90
39
  exports.webdriverConfig = webdriverConfig;
91
- var WebdriverController = /** @class */ (function (_super) {
92
- __extends(WebdriverController, _super);
93
- function WebdriverController(driver) {
94
- var _this = _super.call(this) || this;
95
- _this.driver = driver;
96
- return _this;
40
+ class WebdriverController extends Controller_1.default {
41
+ constructor(driver) {
42
+ super();
43
+ this.driver = driver;
97
44
  }
98
- WebdriverController.prototype.executeScript = function (fn) {
99
- var args = [];
100
- for (var _i = 1; _i < arguments.length; _i++) {
101
- args[_i - 1] = arguments[_i];
102
- }
103
- return __awaiter(this, void 0, void 0, function () {
104
- var script;
105
- var _a;
106
- return __generator(this, function (_b) {
107
- switch (_b.label) {
108
- case 0:
109
- script = "\n const callback = arguments[arguments.length - 1];\n Promise.resolve(...arguments)\n .then(".concat(fn, ")\n .then(callback);\n ");
110
- return [4 /*yield*/, (_a = this.driver).executeAsyncScript.apply(_a, __spreadArray([script], args, false))];
111
- case 1:
112
- _b.sent();
113
- return [2 /*return*/];
114
- }
115
- });
45
+ executeScript(fn, ...args) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const script = `
48
+ const callback = arguments[arguments.length - 1];
49
+ Promise.resolve(...arguments)
50
+ .then(${fn})
51
+ .then(callback);
52
+ `;
53
+ yield this.driver.executeAsyncScript(script, ...args);
116
54
  });
117
- };
118
- return WebdriverController;
119
- }(Controller_1.default));
55
+ }
56
+ }
120
57
  exports.WebdriverController = WebdriverController;
121
58
  //# sourceMappingURL=webdriver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webdriver.js","sourceRoot":"","sources":["../src/webdriver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+BAKe;AACf,4DAAqC;AAMrC;;;;GAIG;AAEH,SAAgB,eAAe,CAAC,GAAkB;;IAChD,gHAAgH;IAChH,8DAA8D;IAC9D,IAAM,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAA;IAE3C,IAAA,GAAG,GAAc,GAAG,IAAjB,EAAE,OAAO,GAAK,GAAG,QAAR,CAAQ;IAC5B,IAAA,qBAAc,EAAC,GAAG,CAAC,CAAA;IAEnB,IAAM,IAAI,GAAY,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAA;IAC9D,IAAI,CAAC,YAAY,OAAjB,IAAI,EAAiB,oBAAa,EAAC;IAEnC,wEAAwE;IACxE,8DAA8D;IAC9D,IAAI,MAAA,MAAC,IAAY,aAAZ,IAAI,uBAAJ,IAAI,CAAU,QAAQ,0CAAE,IAAI,0CAAE,QAAQ,CAAC,UAAU,CAAC,EAAE;QACvD,MAAM,IAAI,gCAAyB,EAAE,CAAA;KACtC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAlBD,0CAkBC;AAED;IAAyC,uCAAU;IAGjD,6BAAY,MAAiB;QAA7B,YACE,iBAAO,SAER;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAA;;IACtB,CAAC;IAEe,2CAAa,GAA7B,UACE,EAAkC;QAClC,cA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