Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@axe-core/watcher

Package Overview
Dependencies
Maintainers
4
Versions
897
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axe-core/watcher - npm Package Compare versions

Comparing version 0.0.1-next.47b61783 to 0.0.1-next.4c1b6e82

dist/cli.d.ts

9

dist/index.d.ts

@@ -1,4 +0,5 @@

export { puppeteerConfig, PuppeteerManualController } from './puppeteer';
export { wdioConfig, wdioTestRunner, WdioManualController } from './wdio';
export { webdriverConfig, WebdriverManualController } from './webdriver';
export { playwrightConfig, PlaywrightManualController } from './playwright';
/*! Copyright Deque 2021-2022 All Rights Reserved */
export { puppeteerConfig, PuppeteerController } from './puppeteer';
export { wdioConfig, wdioTestRunner, WdioController } from './wdio';
export { webdriverConfig, WebdriverController } from './webdriver';
export { playwrightConfig, PlaywrightController } from './playwright';
"use strict";
/*! Copyright Deque 2021-2022 All Rights Reserved */
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlaywrightManualController = exports.playwrightConfig = exports.WebdriverManualController = exports.webdriverConfig = exports.WdioManualController = exports.wdioTestRunner = exports.wdioConfig = exports.PuppeteerManualController = exports.puppeteerConfig = void 0;
exports.PlaywrightController = exports.playwrightConfig = exports.WebdriverController = exports.webdriverConfig = exports.WdioController = exports.wdioTestRunner = exports.wdioConfig = exports.PuppeteerController = exports.puppeteerConfig = void 0;
var puppeteer_1 = require("./puppeteer");
Object.defineProperty(exports, "puppeteerConfig", { enumerable: true, get: function () { return puppeteer_1.puppeteerConfig; } });
Object.defineProperty(exports, "PuppeteerManualController", { enumerable: true, get: function () { return puppeteer_1.PuppeteerManualController; } });
Object.defineProperty(exports, "PuppeteerController", { enumerable: true, get: function () { return puppeteer_1.PuppeteerController; } });
var wdio_1 = require("./wdio");
Object.defineProperty(exports, "wdioConfig", { enumerable: true, get: function () { return wdio_1.wdioConfig; } });
Object.defineProperty(exports, "wdioTestRunner", { enumerable: true, get: function () { return wdio_1.wdioTestRunner; } });
Object.defineProperty(exports, "WdioManualController", { enumerable: true, get: function () { return wdio_1.WdioManualController; } });
Object.defineProperty(exports, "WdioController", { enumerable: true, get: function () { return wdio_1.WdioController; } });
var webdriver_1 = require("./webdriver");
Object.defineProperty(exports, "webdriverConfig", { enumerable: true, get: function () { return webdriver_1.webdriverConfig; } });
Object.defineProperty(exports, "WebdriverManualController", { enumerable: true, get: function () { return webdriver_1.WebdriverManualController; } });
Object.defineProperty(exports, "WebdriverController", { enumerable: true, get: function () { return webdriver_1.WebdriverController; } });
var playwright_1 = require("./playwright");
Object.defineProperty(exports, "playwrightConfig", { enumerable: true, get: function () { return playwright_1.playwrightConfig; } });
Object.defineProperty(exports, "PlaywrightManualController", { enumerable: true, get: function () { return playwright_1.PlaywrightManualController; } });
Object.defineProperty(exports, "PlaywrightController", { enumerable: true, get: function () { return playwright_1.PlaywrightController; } });
//# sourceMappingURL=index.js.map

@@ -1,3 +0,3 @@

import { Configuration, ManualController } from './util';
import type { LaunchOptions, Page } from 'playwright';
import { Configuration, Controller } from './util';
/**

@@ -9,3 +9,3 @@ * Creates a Playwright config that uses axe extension

export declare function playwrightConfig(opts: Configuration & LaunchOptions): LaunchOptions;
export declare class PlaywrightManualController extends ManualController {
export declare class PlaywrightController extends Controller {
private driver;

@@ -12,0 +12,0 @@ constructor(driver: Page);

@@ -76,3 +76,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.PlaywrightManualController = exports.playwrightConfig = void 0;
exports.PlaywrightController = exports.playwrightConfig = void 0;
var util_1 = require("./util");

@@ -89,3 +89,3 @@ /**

if (config.headless) {
throw new Error('Cannot use extension while headless.');
throw new util_1.HeadlessNotSupportedError();
}

@@ -96,5 +96,5 @@ args = args.concat(util_1.extensionArgs);

exports.playwrightConfig = playwrightConfig;
var PlaywrightManualController = /** @class */ (function (_super) {
__extends(PlaywrightManualController, _super);
function PlaywrightManualController(driver) {
var PlaywrightController = /** @class */ (function (_super) {
__extends(PlaywrightController, _super);
function PlaywrightController(driver) {
var _this = _super.call(this) || this;

@@ -104,3 +104,3 @@ _this.driver = driver;

}
PlaywrightManualController.prototype.executeScript = function (fn) {
PlaywrightController.prototype.executeScript = function (fn) {
return __awaiter(this, void 0, void 0, function () {

@@ -117,5 +117,5 @@ return __generator(this, function (_a) {

};
return PlaywrightManualController;
}(util_1.ManualController));
exports.PlaywrightManualController = PlaywrightManualController;
return PlaywrightController;
}(util_1.Controller));
exports.PlaywrightController = PlaywrightController;
//# sourceMappingURL=playwright.js.map

@@ -1,3 +0,3 @@

import { Configuration, ManualController } from './util';
import type { LaunchOptions, BrowserLaunchArgumentOptions, BrowserConnectOptions, Page } from 'puppeteer';
import { Configuration, Controller } from './util';
declare type Options = LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions;

@@ -10,3 +10,3 @@ /**

export declare function puppeteerConfig(opts: Configuration & Options): Options;
export declare class PuppeteerManualController extends ManualController {
export declare class PuppeteerController extends Controller {
private driver;

@@ -13,0 +13,0 @@ constructor(driver: Page);

@@ -76,3 +76,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.PuppeteerManualController = exports.puppeteerConfig = void 0;
exports.PuppeteerController = exports.puppeteerConfig = void 0;
var util_1 = require("./util");

@@ -89,3 +89,3 @@ /**

if (config.headless) {
throw new Error('Cannot use extension while headless.');
throw new util_1.HeadlessNotSupportedError();
}

@@ -96,5 +96,5 @@ args = args.concat(util_1.extensionArgs);

exports.puppeteerConfig = puppeteerConfig;
var PuppeteerManualController = /** @class */ (function (_super) {
__extends(PuppeteerManualController, _super);
function PuppeteerManualController(driver) {
var PuppeteerController = /** @class */ (function (_super) {
__extends(PuppeteerController, _super);
function PuppeteerController(driver) {
var _this = _super.call(this) || this;

@@ -104,3 +104,3 @@ _this.driver = driver;

}
PuppeteerManualController.prototype.executeScript = function (fn) {
PuppeteerController.prototype.executeScript = function (fn) {
return __awaiter(this, void 0, void 0, function () {

@@ -117,5 +117,5 @@ return __generator(this, function (_a) {

};
return PuppeteerManualController;
}(util_1.ManualController));
exports.PuppeteerManualController = PuppeteerManualController;
return PuppeteerController;
}(util_1.Controller));
exports.PuppeteerController = PuppeteerController;
//# sourceMappingURL=puppeteer.js.map
export declare const PATH_TO_EXTENSION: string;
export declare const DEFAULT_SERVER_URL = "https://axe.deque.com/";
export declare const PATH_TO_SESSION_FILE: string;
export declare const PATH_TO_EXTENSION_VARIABLES: string;
export declare const extensionArgs: readonly [`--disable-extensions-except=${string}`, `--load-extension=${string}`];
export declare class HeadlessNotSupportedError extends Error {
name: string;
constructor();
}
export interface Configuration {

@@ -25,4 +31,5 @@ axe: {

}
/** Write the user's settings to the disk, so the extension can load them. */
export declare function writeVariables({ apiKey, serverURL, sessionId, autoAnalyze }: WriteVariablesParams): void;
export declare abstract class ManualController {
export declare abstract class Controller {
protected abstract executeScript(fn: string | (() => Promise<void>)): Promise<void>;

@@ -32,3 +39,5 @@ start(): Promise<void>;

analyze(): Promise<void>;
/** Flush all axe-core results by sending them to the server. */
flush(): Promise<void>;
}
export {};
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -61,8 +53,14 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManualController = exports.writeVariables = exports.extensionArgs = exports.DEFAULT_SERVER_URL = exports.PATH_TO_EXTENSION = void 0;
var fs = __importStar(require("fs"));
var path = __importStar(require("path"));
exports.PATH_TO_EXTENSION = path.join(__dirname, '..', 'extension');
exports.Controller = exports.writeVariables = exports.HeadlessNotSupportedError = exports.extensionArgs = exports.PATH_TO_EXTENSION_VARIABLES = exports.PATH_TO_SESSION_FILE = exports.DEFAULT_SERVER_URL = exports.PATH_TO_EXTENSION = void 0;
var fs_1 = __importDefault(require("fs"));
var path_1 = __importDefault(require("path"));
var os_1 = __importDefault(require("os"));
exports.PATH_TO_EXTENSION = path_1.default.join(__dirname, '..', 'extension');
exports.DEFAULT_SERVER_URL = 'https://axe.deque.com/';
exports.PATH_TO_SESSION_FILE = path_1.default.join(os_1.default.tmpdir(), 'axe-watcher-session.json');
exports.PATH_TO_EXTENSION_VARIABLES = path_1.default.join(exports.PATH_TO_EXTENSION, 'variables.json');
exports.extensionArgs = [

@@ -72,3 +70,13 @@ "--disable-extensions-except=".concat(exports.PATH_TO_EXTENSION),

];
// Write the user's settings to the disk, so the extension can load them
var HeadlessNotSupportedError = /** @class */ (function (_super) {
__extends(HeadlessNotSupportedError, _super);
function HeadlessNotSupportedError() {
var _this = _super.call(this, 'Cannot use extension while headless.') || this;
_this.name = 'HeadlessNotSupportedError';
return _this;
}
return HeadlessNotSupportedError;
}(Error));
exports.HeadlessNotSupportedError = HeadlessNotSupportedError;
/** Write the user's settings to the disk, so the extension can load them. */
function writeVariables(_a) {

@@ -89,4 +97,14 @@ var apiKey = _a.apiKey, serverURL = _a.serverURL, sessionId = _a.sessionId, autoAnalyze = _a.autoAnalyze;

}
var filePath = path.join(exports.PATH_TO_EXTENSION, 'variables.json');
fs.writeFileSync(filePath, JSON.stringify({
// When a custom session ID is not provided, attempt to read it from the filesystem.
// This enables multi-process/multi-browser test suites to all use the same session ID.
if (!sessionId && fs_1.default.existsSync(exports.PATH_TO_SESSION_FILE)) {
try {
var data = JSON.parse(fs_1.default.readFileSync(exports.PATH_TO_SESSION_FILE, 'utf8'));
sessionId = data.id;
}
catch (error) {
throw new Error("Unable to read session configuration: ".concat(error));
}
}
fs_1.default.writeFileSync(exports.PATH_TO_EXTENSION_VARIABLES, JSON.stringify({
api_key: apiKey,

@@ -100,12 +118,11 @@ server_url: urlString,

function updateAutoAnalyze(newVal) {
var filePath = path.join(exports.PATH_TO_EXTENSION, 'variables.json');
var fileContents = fs.readFileSync(filePath, 'utf-8');
var fileContents = fs_1.default.readFileSync(exports.PATH_TO_EXTENSION_VARIABLES, 'utf-8');
var jsonValue = JSON.parse(fileContents);
jsonValue['auto_analyze'] = newVal;
fs.writeFileSync(filePath, JSON.stringify(jsonValue));
fs_1.default.writeFileSync(exports.PATH_TO_EXTENSION_VARIABLES, JSON.stringify(jsonValue));
}
var ManualController = /** @class */ (function () {
function ManualController() {
var Controller = /** @class */ (function () {
function Controller() {
}
ManualController.prototype.start = function () {
Controller.prototype.start = function () {
return __awaiter(this, void 0, void 0, function () {

@@ -128,3 +145,3 @@ return __generator(this, function (_a) {

};
ManualController.prototype.stop = function () {
Controller.prototype.stop = function () {
return __awaiter(this, void 0, void 0, function () {

@@ -147,3 +164,3 @@ return __generator(this, function (_a) {

};
ManualController.prototype.analyze = function () {
Controller.prototype.analyze = function () {
return __awaiter(this, void 0, void 0, function () {

@@ -155,8 +172,31 @@ return __generator(this, function (_a) {

var event = new CustomEvent('axe:manual-mode-analyze');
var fn = function () {
window.removeEventListener('axe:manual-mode-analyze-done', fn);
resolve();
};
window.addEventListener('axe:manual-mode-analyze-done', fn);
window.dispatchEvent(event);
var p = function () {
window.removeEventListener('axe:manual-mode-analyze-done', p);
});
})];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
};
/** Flush all axe-core results by sending them to the server. */
Controller.prototype.flush = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.executeScript(function () {
return new Promise(function (resolve) {
var fn = function () {
window.removeEventListener('axe:flush-end', fn);
resolve();
};
window.addEventListener('axe:manual-mode-analyze-done', p);
window.addEventListener('axe:flush-end', fn);
var event = new CustomEvent('axe:flush-start');
window.dispatchEvent(event);
});

@@ -171,5 +211,5 @@ })];

};
return ManualController;
return Controller;
}());
exports.ManualController = ManualController;
exports.Controller = Controller;
//# sourceMappingURL=util.js.map

@@ -1,3 +0,3 @@

import { Configuration, ManualController } from './util';
import type { Options } from '@wdio/types';
import { Configuration, Controller } from './util';
interface Browser {

@@ -16,3 +16,3 @@ executeAsyncScript(script: string, args: object[]): void;

export declare function wdioTestRunner(axe: Configuration['axe'], config: Options.Testrunner): Options.Testrunner;
export declare class WdioManualController extends ManualController {
export declare class WdioController extends Controller {
private driver;

@@ -19,0 +19,0 @@ constructor(driver: Browser);

@@ -65,3 +65,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.WdioManualController = exports.wdioTestRunner = exports.wdioConfig = void 0;
exports.WdioController = exports.wdioTestRunner = exports.wdioConfig = void 0;
var util_1 = require("./util");

@@ -81,3 +81,3 @@ /**

if (args.includes('--headless')) {
throw new Error('Cannot use extension while headless.');
throw new util_1.HeadlessNotSupportedError();
}

@@ -107,3 +107,3 @@ return __assign(__assign({}, arg.options), { capabilities: __assign(__assign({}, (_c = arg.options) === null || _c === void 0 ? void 0 : _c.capabilities), { browserName: 'chrome', 'goog:chromeOptions': {

if (args.includes('--headless')) {
throw new Error('Cannot use extension while headless.');
throw new util_1.HeadlessNotSupportedError();
}

@@ -114,5 +114,5 @@ chromeOpts.args = util_1.extensionArgs.concat(args);

exports.wdioTestRunner = wdioTestRunner;
var WdioManualController = /** @class */ (function (_super) {
__extends(WdioManualController, _super);
function WdioManualController(driver) {
var WdioController = /** @class */ (function (_super) {
__extends(WdioController, _super);
function WdioController(driver) {
var _this = _super.call(this) || this;

@@ -122,3 +122,3 @@ _this.driver = driver;

}
WdioManualController.prototype.executeScript = function (fn) {
WdioController.prototype.executeScript = function (fn) {
return __awaiter(this, void 0, void 0, function () {

@@ -138,5 +138,5 @@ var script;

};
return WdioManualController;
}(util_1.ManualController));
exports.WdioManualController = WdioManualController;
return WdioController;
}(util_1.Controller));
exports.WdioController = WdioController;
//# sourceMappingURL=wdio.js.map

@@ -1,4 +0,4 @@

import { Configuration, ManualController } from './util';
import type { WebDriver } from 'selenium-webdriver';
import type { Options } from 'selenium-webdriver/chrome';
import { Configuration, Controller } from './util';
interface WebDriverArgs extends Configuration {

@@ -13,3 +13,3 @@ options?: Options;

export declare function webdriverConfig(arg: WebDriverArgs): Options;
export declare class WebdriverManualController extends ManualController {
export declare class WebdriverController extends Controller {
private driver;

@@ -16,0 +16,0 @@ constructor(driver: WebDriver);

@@ -54,3 +54,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.WebdriverManualController = exports.webdriverConfig = void 0;
exports.WebdriverController = exports.webdriverConfig = void 0;
var util_1 = require("./util");

@@ -74,3 +74,3 @@ /**

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')) {
throw new Error('Cannot use extension while headless.');
throw new util_1.HeadlessNotSupportedError();
}

@@ -80,5 +80,5 @@ return opts;

exports.webdriverConfig = webdriverConfig;
var WebdriverManualController = /** @class */ (function (_super) {
__extends(WebdriverManualController, _super);
function WebdriverManualController(driver) {
var WebdriverController = /** @class */ (function (_super) {
__extends(WebdriverController, _super);
function WebdriverController(driver) {
var _this = _super.call(this) || this;

@@ -88,3 +88,3 @@ _this.driver = driver;

}
WebdriverManualController.prototype.executeScript = function (fn) {
WebdriverController.prototype.executeScript = function (fn) {
return __awaiter(this, void 0, void 0, function () {

@@ -104,5 +104,5 @@ var script;

};
return WebdriverManualController;
}(util_1.ManualController));
exports.WebdriverManualController = WebdriverManualController;
return WebdriverController;
}(util_1.Controller));
exports.WebdriverController = WebdriverController;
//# sourceMappingURL=webdriver.js.map

@@ -1,2 +0,4 @@

/*! axe v4.4.2
/*! Copyright Deque 2021-2022 All Rights Reserved */
/*! axe v4.4.3
* Copyright (c) 2022 Deque Systems, Inc.

@@ -3,0 +5,0 @@ *

@@ -10,2 +10,3 @@ {

},
"permissions": ["storage", "unlimitedStorage"],
"content_scripts": [

@@ -12,0 +13,0 @@ {

{
"name": "@axe-core/watcher",
"version": "0.0.1-next.47b61783",
"version": "0.0.1-next.4c1b6e82",
"description": "",
"license": "UNLICENSED",
"main": "dist/index.js",
"bin": {
"axe-watcher": "dist/cli.js"
},
"scripts": {
"build": "tsc",
"test": "npm run test:unit && npm run test:integration",
"test:unit": "mocha 'test/**.test.ts'",
"test:unit": "mocha 'src/*.test.ts'",
"pretest:integration": "mkdir -p extension; cp fixtures/extension/* extension/",
"test:integration": "mocha 'test/**.integration.ts'",
"test:integration": "mocha 'src/*.integration.ts'",
"coverage": "nyc npm t"
},
"dependencies": {
"pkg-up": "3",
"uuid": "^9.0.0"
},
"devDependencies": {
"@types/chai": "^4.3.1",
"@types/chrome": "^0.0.193",
"@types/express": "^4.17.13",
"@types/mocha": "^9.1.1",
"@types/node": "^18.0.1",
"@types/chai": "^4.3.3",
"@types/chrome": "^0.0.197",
"@types/express": "^4.17.14",
"@types/mocha": "^10.0.0",
"@types/node": "^18.8.3",
"@types/puppeteer": "^5.4.6",
"@types/selenium-webdriver": "^4.1.1",
"@types/selenium-webdriver": "^4.1.5",
"@types/test-listen": "^1.1.0",
"@wdio/types": "^7.20.3",
"@types/uuid": "^8.3.4",
"@wdio/types": "^7.25.1",
"chai": "^4.3.6",
"chromedriver": "^105.0.0",
"express": "^4.18.1",
"chromedriver": "^106.0.1",
"execa": "5",
"express": "^4.18.2",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"playwright": "^1.23.1",
"puppeteer": "^15.3.0",
"selenium-webdriver": "^4.3.0",
"playwright": "^1.27.0",
"puppeteer": "^18.2.1",
"selenium-webdriver": "^4.5.0",
"tempy": "1",
"test-listen": "^1.1.0",
"ts-node": "^10.8.2",
"typescript": "^4.7.4",
"webdriverio": "^7.20.5"
"ts-node": "^10.9.1",
"typescript": "^4.8.4",
"webdriverio": "^7.25.1"
},

@@ -38,0 +48,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc