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

@axe-core/watcher

Package Overview
Dependencies
Maintainers
0
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 3.16.1-next.7d85c159 to 3.16.1-next.91007e95

dist/utils/runOptions.d.ts

8

dist/Controller.d.ts

@@ -5,2 +5,6 @@ import type { Debugger } from 'debug';

debugLoggerName: string;
/** The name of the integration. Used for variables assertion */
integrationName?: string;
/** Configuration function name. Use for variables assertion */
configurationFunction?: string;
}

@@ -11,4 +15,4 @@ declare abstract class Controller {

protected debugLogger: Debugger;
constructor({ debugLoggerName }: ControllerParams);
start(): void;
constructor({ debugLoggerName, integrationName, configurationFunction }: ControllerParams);
start(): Promise<void>;
stop(): Promise<void>;

@@ -15,0 +19,0 @@ analyze({ __Method, __UserRequestedAnalyze }?: {

@@ -6,12 +6,17 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const readVariables_1 = __importDefault(require("./utils/readVariables"));
const sendResultsToServer_1 = __importDefault(require("./sendResultsToServer"));
const createDebugger_1 = __importDefault(require("./createDebugger"));
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten");
class Controller {
constructor({ debugLoggerName }) {
this.isStopped = false;
constructor({ debugLoggerName, integrationName, configurationFunction }) {
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)(integrationName, configurationFunction);
const variables = (0, readVariables_1.default)();
this.isStopped = !(variables === null || variables === void 0 ? void 0 : variables.auto_analyze);
this.debugLogger = (0, createDebugger_1.default)(debugLoggerName);
}
start() {
async start() {
this.debugLogger(`Start: Invoked`);
this.isStopped = false;
return Promise.resolve();
}

@@ -21,3 +26,3 @@ async stop() {

if (this.isStopped) {
return;
return Promise.resolve();
}

@@ -46,3 +51,3 @@ const result = await this.executeScript(() => {

isStopped: this.isStopped,
__UserRequestedAnalyze
userRequestedAnalyze: __UserRequestedAnalyze
});

@@ -52,3 +57,3 @@ if (this.isStopped && !__UserRequestedAnalyze) {

isStopped: this.isStopped,
__UserRequestedAnalyze
userRequestedAnalyze: __UserRequestedAnalyze
});

@@ -55,0 +60,0 @@ return;

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

const event = new CustomEvent('axe:manual-mode-analyze', {
detail: { userRequestedAnalyze, isCypress: true }
detail: { userRequestedAnalyze }
});

@@ -168,2 +168,3 @@ win.dispatchEvent(event);

if (!shouldAnalyzeLocation(win.location)) {
isStopped = true;
logDebugAxeWatcher({

@@ -177,2 +178,8 @@ message: `Stop: Skipped - invalid protocol`

}
if (isStopped) {
logDebugAxeWatcher({
message: `Stop: Analysis skipped - manual mode`
});
return Promise.resolve({ message: `Skipped (Manual mode)`, subject });
}
return new Promise(resolve => {

@@ -184,5 +191,3 @@ const fn = (event) => {

win.addEventListener('axe:manual-mode-analyze-done', fn);
const event = new CustomEvent('axe:manual-mode-analyze', {
detail: { isCypress: true }
});
const event = new CustomEvent('axe:manual-mode-analyze');
win.dispatchEvent(event);

@@ -189,0 +194,0 @@ }).then(result => {

@@ -14,3 +14,3 @@ import type { LaunchOptions, Page, BrowserContext } from 'playwright-core';

private driver;
constructor(driver: Page, isStopped?: boolean);
constructor(driver: Page);
protected executeScript<T>(fn: string | (() => Promise<T>), ...args: unknown[]): Promise<T>;

@@ -17,0 +17,0 @@ }

@@ -13,3 +13,2 @@ "use strict";

const checkUserArgs_1 = require("./utils/checkUserArgs");
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten");
function playwrightConfig(opts) {

@@ -32,7 +31,9 @@ const { axe, ...config } = opts;

class PlaywrightController extends Controller_1.default {
constructor(driver, isStopped = false) {
super({ debugLoggerName: 'PlaywrightController' });
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)('Playwright', 'playwrightConfig()');
constructor(driver) {
super({
debugLoggerName: 'PlaywrightController',
integrationName: 'Playwright',
configurationFunction: 'playwrightConfig()'
});
this.driver = driver;
this.isStopped = isStopped;
}

@@ -39,0 +40,0 @@ async executeScript(fn, ...args) {

@@ -22,3 +22,2 @@ "use strict";

}
const isStopped = typeof axe.autoAnalyze === 'undefined' ? false : !axe.autoAnalyze;
(0, checkUserArgs_1.checkUserArgs)(config.args || []);

@@ -40,3 +39,3 @@ (0, writeVariables_1.default)(axe);

if (!controller) {
controller = new playwright_1.PlaywrightController(page, isStopped);
controller = new playwright_1.PlaywrightController(page);
page.axeWatcher = controller;

@@ -43,0 +42,0 @@ page = (0, playwright_1.wrapPlaywrightPage)(page, controller);

@@ -13,3 +13,2 @@ "use strict";

const checkUserArgs_1 = require("./utils/checkUserArgs");
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten");
function headlessNotSupportedError(config) {

@@ -40,4 +39,7 @@ if (!(config === null || config === void 0 ? void 0 : config.headless) || config.headless === 'new') {

constructor(driver) {
super({ debugLoggerName: 'PuppeteerController' });
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)('Puppeteer', 'puppeteerConfig()');
super({
debugLoggerName: 'PuppeteerController',
integrationName: 'Puppeteer',
configurationFunction: 'puppeteerConfig()'
});
this.driver = driver;

@@ -44,0 +46,0 @@ }

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

import type { AxeResults, ElementContext, RunOptions } from 'axe-core';
import type { AxeResults, ElementContext } from 'axe-core';
import type { RunOptions } from './utils/validateAxeRunOptions';
import type debug from 'debug';

@@ -3,0 +4,0 @@ /**

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

export declare const assertVariablesWereWritten: (integration: string, method: string) => void;
export declare const assertVariablesWereWritten: (integration?: string, method?: string) => void;

@@ -10,4 +10,5 @@ "use strict";

const constants_1 = require("./constants");
const assertVariablesWereWritten = (integration, method) => {
const exists = fs_1.default.existsSync(constants_1.PATH_TO_EXTENSION_VARIABLES);
const assertVariablesWereWritten = (integration = 'integration', method = 'method') => {
const exists = fs_1.default.existsSync(constants_1.PATH_TO_EXTENSION) &&
fs_1.default.existsSync(constants_1.PATH_TO_EXTENSION_VARIABLES);
(0, assert_1.default)(exists, `${integration} is not configured for @axe-core/watcher. Please ensure that @axe-core/watcher's ${method} is invoked. All tests will fail with this error.`);

@@ -14,0 +15,0 @@ };

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

import type { RunOptions as AxeRunOptions } from 'axe-core';
import type { RunOptions as AxeRunOptions } from './runOptions';
export type RunOptions = Pick<AxeRunOptions, 'runOnly' | 'rules' | 'ancestry'>;

@@ -3,0 +3,0 @@ /**

@@ -16,3 +16,2 @@ "use strict";

const checkUserArgs_1 = require("./utils/checkUserArgs");
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten");
const noop = () => {

@@ -90,4 +89,7 @@ };

constructor(driver) {
super({ debugLoggerName: 'WdioController' });
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)('WDIO', 'wdioConfig()');
super({
debugLoggerName: 'WdioController',
integrationName: 'WDIO',
configurationFunction: 'wdioConfig()'
});
this.driver = driver;

@@ -94,0 +96,0 @@ }

@@ -13,3 +13,2 @@ "use strict";

const checkUserArgs_1 = require("./utils/checkUserArgs");
const assertVariablesWereWritten_1 = require("./utils/assertVariablesWereWritten");
var webdriverWrapping_1 = require("./webdriverWrapping");

@@ -35,4 +34,7 @@ Object.defineProperty(exports, "wrapWebdriver", { enumerable: true, get: function () { return webdriverWrapping_1.wrapDriver; } });

constructor(driver) {
super({ debugLoggerName: 'WebdriverController' });
(0, assertVariablesWereWritten_1.assertVariablesWereWritten)('WebDriver', 'webdriverConfig()');
super({
debugLoggerName: 'WebdriverController',
integrationName: 'WebDriver',
configurationFunction: 'webdriverConfig()'
});
this.driver = driver;

@@ -39,0 +41,0 @@ }

{
"name": "@axe-core/watcher",
"version": "3.16.1-next.7d85c159",
"version": "3.16.1-next.91007e95",
"description": "",

@@ -5,0 +5,0 @@ "license": "UNLICENSED",

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 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