@axe-core/watcher 3.12.0 → 3.13.1-rc.bb823fcd
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/Controller.js +3 -3
- package/dist/Controller.js.map +1 -1
- package/dist/cypress.d.ts +1 -1
- package/dist/cypress.js +8 -5
- package/dist/cypress.js.map +1 -1
- package/dist/git.d.ts +2 -1
- package/dist/git.js +5 -4
- package/dist/git.js.map +1 -1
- package/dist/playwright.d.ts +1 -1
- package/dist/playwright.js +6 -4
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.js +7 -3
- package/dist/playwrightTest.js.map +1 -1
- package/dist/playwrightWrapping.d.ts +1 -1
- package/dist/playwrightWrapping.js +41 -41
- package/dist/playwrightWrapping.js.map +1 -1
- package/dist/puppeteer.d.ts +1 -1
- package/dist/puppeteer.js +7 -5
- package/dist/puppeteer.js.map +1 -1
- package/dist/puppeteerWrapping.d.ts +1 -1
- package/dist/puppeteerWrapping.js +45 -45
- package/dist/puppeteerWrapping.js.map +1 -1
- package/dist/sendResultsToServer.js +3 -43
- package/dist/sendResultsToServer.js.map +1 -1
- package/dist/utils/constants.d.ts +4 -0
- package/dist/utils/constants.js +16 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/headlessNotSupportedError.d.ts +5 -0
- package/dist/utils/headlessNotSupportedError.js +17 -0
- package/dist/utils/headlessNotSupportedError.js.map +1 -0
- package/dist/utils/headlessNotSupportedError.test.d.ts +1 -0
- package/dist/utils/headlessNotSupportedError.test.js +21 -0
- package/dist/utils/headlessNotSupportedError.test.js.map +1 -0
- package/dist/utils/isValidExcludePattern.d.ts +2 -0
- package/dist/utils/isValidExcludePattern.js +10 -0
- package/dist/utils/isValidExcludePattern.js.map +1 -0
- package/dist/utils/isValidExcludePattern.test.d.ts +1 -0
- package/dist/utils/isValidExcludePattern.test.js +17 -0
- package/dist/utils/isValidExcludePattern.test.js.map +1 -0
- package/dist/utils/mergeChromeArgs.d.ts +12 -0
- package/dist/utils/mergeChromeArgs.js +73 -0
- package/dist/utils/mergeChromeArgs.js.map +1 -0
- package/dist/utils/mergeChromeArgs.test.d.ts +1 -0
- package/dist/utils/mergeChromeArgs.test.js +260 -0
- package/dist/utils/mergeChromeArgs.test.js.map +1 -0
- package/dist/utils/proxyHandlers.d.ts +12 -0
- package/dist/utils/proxyHandlers.js +62 -0
- package/dist/utils/proxyHandlers.js.map +1 -0
- package/dist/utils/proxyHandlers.test.d.ts +1 -0
- package/dist/utils/proxyHandlers.test.js +28 -0
- package/dist/utils/proxyHandlers.test.js.map +1 -0
- package/dist/utils/readVariables.d.ts +7 -0
- package/dist/utils/readVariables.js +17 -0
- package/dist/utils/readVariables.js.map +1 -0
- package/dist/utils/updateAutoAnalyze.d.ts +7 -0
- package/dist/utils/updateAutoAnalyze.js +20 -0
- package/dist/utils/updateAutoAnalyze.js.map +1 -0
- package/dist/utils/validateApiKey.d.ts +7 -0
- package/dist/utils/validateApiKey.js +34 -0
- package/dist/utils/validateApiKey.js.map +1 -0
- package/dist/utils/validateApiKey.test.d.ts +1 -0
- package/dist/utils/validateApiKey.test.js +66 -0
- package/dist/utils/validateApiKey.test.js.map +1 -0
- package/dist/utils/writeExtensionManifest.d.ts +7 -0
- package/dist/utils/writeExtensionManifest.js +18 -0
- package/dist/utils/writeExtensionManifest.js.map +1 -0
- package/dist/utils/writeVariables.d.ts +77 -0
- package/dist/utils/writeVariables.js +124 -0
- package/dist/utils/writeVariables.js.map +1 -0
- package/dist/utils/writeVariables.test.d.ts +1 -0
- package/dist/utils/writeVariables.test.js +220 -0
- package/dist/utils/writeVariables.test.js.map +1 -0
- package/dist/wdio.d.ts +1 -1
- package/dist/wdio.js +12 -9
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.d.ts +1 -1
- package/dist/webdriver.js +6 -4
- package/dist/webdriver.js.map +1 -1
- package/dist/webdriverWrapping.d.ts +1 -1
- package/dist/webdriverWrapping.js +16 -16
- package/dist/webdriverWrapping.js.map +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +2 -2
- package/dist/util.d.ts +0 -96
- package/dist/util.js +0 -243
- package/dist/util.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -20
- package/dist/utils/index.js.map +0 -1
package/package.json
CHANGED
package/dist/util.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type Controller from './Controller';
|
|
2
|
-
import type axe from 'axe-core';
|
|
3
|
-
import { type RunOptions } from './utils';
|
|
4
|
-
export declare const PATH_TO_EXTENSION: string;
|
|
5
|
-
export declare const DEFAULT_SERVER_URL = "https://axe.deque.com/";
|
|
6
|
-
export declare const PATH_TO_SESSION_FILE: string;
|
|
7
|
-
export declare const PATH_TO_EXTENSION_VARIABLES: string;
|
|
8
|
-
export declare class HeadlessNotSupportedError extends Error {
|
|
9
|
-
name: string;
|
|
10
|
-
constructor(extendedMessage?: string);
|
|
11
|
-
}
|
|
12
|
-
interface AxeConfiguration {
|
|
13
|
-
/** Your axe API key. */
|
|
14
|
-
apiKey: string;
|
|
15
|
-
/** Custom axe server URL. */
|
|
16
|
-
serverURL?: string;
|
|
17
|
-
/** Your session ID. */
|
|
18
|
-
sessionId?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Whether or not to automatically run axe on the page when loaded and
|
|
21
|
-
* when changes are made.
|
|
22
|
-
*/
|
|
23
|
-
autoAnalyze?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* By default we'll scan the entire page. Provide a context object to limit
|
|
26
|
-
* the scope of the scan.
|
|
27
|
-
*
|
|
28
|
-
* @see https://www.deque.com/axe/core-documentation/api-documentation/#context-parameter
|
|
29
|
-
*/
|
|
30
|
-
runContext?: axe.ElementContext;
|
|
31
|
-
/**
|
|
32
|
-
* Provide options on how to run axe.
|
|
33
|
-
* - `rules`: Enable or disable rules using the enabled property
|
|
34
|
-
* - `runOnly`: Limit which rules are executed, based on names or tags
|
|
35
|
-
* - `ancestry`: Return CSS selector for elements, with all the element's ancestors
|
|
36
|
-
*
|
|
37
|
-
* @see https://www.deque.com/axe/core-documentation/api-documentation/#options-parameter
|
|
38
|
-
*/
|
|
39
|
-
runOptions?: RunOptions;
|
|
40
|
-
}
|
|
41
|
-
export interface Configuration {
|
|
42
|
-
axe: AxeConfiguration;
|
|
43
|
-
}
|
|
44
|
-
interface WriteVariablesParams extends AxeConfiguration {
|
|
45
|
-
cypress?: boolean;
|
|
46
|
-
}
|
|
47
|
-
/** variables.json shape. */
|
|
48
|
-
export interface Variables {
|
|
49
|
-
api_key: string;
|
|
50
|
-
server_url: string;
|
|
51
|
-
auto_analyze: boolean;
|
|
52
|
-
cypress: boolean;
|
|
53
|
-
session_id?: string;
|
|
54
|
-
run_context: axe.ElementContext | null;
|
|
55
|
-
run_options: RunOptions | null;
|
|
56
|
-
take_screenshots?: boolean;
|
|
57
|
-
experimental_advanced_rules?: boolean;
|
|
58
|
-
}
|
|
59
|
-
/** Write the user's settings to the disk, so the extension can load them. */
|
|
60
|
-
export declare function writeVariables({ apiKey, autoAnalyze, cypress, serverURL, sessionId, runContext, runOptions, takeScreenshots, experimentalAdvancedRules }: WriteVariablesParams): void;
|
|
61
|
-
interface ValidateApiKeyParams {
|
|
62
|
-
apiKey: string;
|
|
63
|
-
serverURL: string;
|
|
64
|
-
}
|
|
65
|
-
/** Validate the given `apiKey`. This method is blocking and should not be called unnecessarily. */
|
|
66
|
-
export declare const validateApiKey: ({ apiKey, serverURL }: ValidateApiKeyParams) => void;
|
|
67
|
-
interface WriteManifestParams {
|
|
68
|
-
all_frames: boolean;
|
|
69
|
-
exclude_globs: string[];
|
|
70
|
-
}
|
|
71
|
-
/** Update the extension manifest file. */
|
|
72
|
-
export declare function writeManifest({ all_frames, exclude_globs }: WriteManifestParams): void;
|
|
73
|
-
export declare const readVariables: () => Variables;
|
|
74
|
-
export declare const updateAutoAnalyze: (val: boolean) => void;
|
|
75
|
-
declare const kWrapped: unique symbol;
|
|
76
|
-
export type PossiblyWrapped<T> = T & {
|
|
77
|
-
[kWrapped]?: boolean;
|
|
78
|
-
};
|
|
79
|
-
/** Is the given object wrapped? */
|
|
80
|
-
export declare const isWrapped: <T>(o: PossiblyWrapped<T> | null) => boolean;
|
|
81
|
-
/** Mark the given object as wrapped. */
|
|
82
|
-
export declare const markAsWrapped: (o: unknown) => void;
|
|
83
|
-
export declare const proxiedGetFuncWithAnalyze: <T>(target: T, prop: keyof T, controller: Controller) => (...args: unknown[]) => Promise<unknown>;
|
|
84
|
-
export declare const proxiedGetWithoutAnalyze: <T>(target: T, prop: keyof T) => unknown;
|
|
85
|
-
/**
|
|
86
|
-
* A helper function to merge the user provided arguments with the extension args
|
|
87
|
-
* for Chrome.
|
|
88
|
-
*
|
|
89
|
-
* @param args The user provided arguments to merge with the extension args.
|
|
90
|
-
* @param disableOtherExtensions Whether to disable other extensions.
|
|
91
|
-
* @returns The merged arguments to pass to Chrome.
|
|
92
|
-
*/
|
|
93
|
-
export declare const mergeChromeArgs: (userArgs: string[], { disableOtherExtensions }: {
|
|
94
|
-
disableOtherExtensions: boolean;
|
|
95
|
-
}) => string[];
|
|
96
|
-
export {};
|
package/dist/util.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.mergeChromeArgs = exports.proxiedGetWithoutAnalyze = exports.proxiedGetFuncWithAnalyze = exports.markAsWrapped = exports.isWrapped = exports.updateAutoAnalyze = exports.readVariables = exports.validateApiKey = exports.HeadlessNotSupportedError = exports.PATH_TO_EXTENSION_VARIABLES = exports.PATH_TO_SESSION_FILE = exports.DEFAULT_SERVER_URL = exports.PATH_TO_EXTENSION = void 0;
|
|
7
|
-
exports.writeVariables = writeVariables;
|
|
8
|
-
exports.writeManifest = writeManifest;
|
|
9
|
-
const uuid_1 = require("uuid");
|
|
10
|
-
const sync_request_1 = __importDefault(require("sync-request"));
|
|
11
|
-
const assert_1 = __importDefault(require("assert"));
|
|
12
|
-
const fs_1 = __importDefault(require("fs"));
|
|
13
|
-
const path_1 = __importDefault(require("path"));
|
|
14
|
-
const os_1 = __importDefault(require("os"));
|
|
15
|
-
const utils_1 = require("./utils");
|
|
16
|
-
// TODO: https://github.com/dequelabs/jazzband/issues/1227
|
|
17
|
-
exports.PATH_TO_EXTENSION = path_1.default.join(__dirname, '..', 'extension');
|
|
18
|
-
exports.DEFAULT_SERVER_URL = 'https://axe.deque.com/';
|
|
19
|
-
exports.PATH_TO_SESSION_FILE = path_1.default.join(os_1.default.tmpdir(), 'axe-watcher-session.json');
|
|
20
|
-
exports.PATH_TO_EXTENSION_VARIABLES = path_1.default.join(exports.PATH_TO_EXTENSION, 'variables.json');
|
|
21
|
-
// Extension flags for Chrome
|
|
22
|
-
const DISABLE_OTHER_EXTENSIONS_FLAG = '--disable-extensions-except';
|
|
23
|
-
const LOAD_EXTENSION_FLAG = '--load-extension';
|
|
24
|
-
class HeadlessNotSupportedError extends Error {
|
|
25
|
-
constructor(extendedMessage) {
|
|
26
|
-
super('@axe-core/watcher does not support Chrome\'s older "--headless" mode. ' +
|
|
27
|
-
'Use either "--headless=new" or a headful browser.' +
|
|
28
|
-
(extendedMessage ? ` ${extendedMessage}` : ''));
|
|
29
|
-
this.name = 'HeadlessNotSupportedError';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.HeadlessNotSupportedError = HeadlessNotSupportedError;
|
|
33
|
-
/** Write the user's settings to the disk, so the extension can load them. */
|
|
34
|
-
function writeVariables({ apiKey, autoAnalyze, cypress, serverURL, sessionId, runContext, runOptions,
|
|
35
|
-
// @ts-expect-error Feature flag, not part of public type
|
|
36
|
-
takeScreenshots,
|
|
37
|
-
// @ts-expect-error Feature flag, not part of public type
|
|
38
|
-
experimentalAdvancedRules }) {
|
|
39
|
-
if (!serverURL) {
|
|
40
|
-
serverURL = exports.DEFAULT_SERVER_URL;
|
|
41
|
-
}
|
|
42
|
-
let urlString;
|
|
43
|
-
try {
|
|
44
|
-
urlString = new URL(serverURL).toString();
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
throw new Error(`Error when converting serverURL to URL. Ensure it is formatted properly: ${err}`);
|
|
48
|
-
}
|
|
49
|
-
(0, utils_1.validateAxeRunContext)(runContext);
|
|
50
|
-
(0, utils_1.validateAxeRunOptions)(runOptions);
|
|
51
|
-
(0, exports.validateApiKey)({ apiKey, serverURL: urlString });
|
|
52
|
-
if (typeof autoAnalyze === 'undefined') {
|
|
53
|
-
autoAnalyze = true;
|
|
54
|
-
}
|
|
55
|
-
// When a custom session ID is not provided, attempt to read it from the filesystem.
|
|
56
|
-
// This enables multi-process/multi-browser test suites to all use the same session ID.
|
|
57
|
-
if (!sessionId && fs_1.default.existsSync(exports.PATH_TO_SESSION_FILE)) {
|
|
58
|
-
try {
|
|
59
|
-
const data = JSON.parse(fs_1.default.readFileSync(exports.PATH_TO_SESSION_FILE, 'utf8'));
|
|
60
|
-
sessionId = data.id;
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
throw new Error(`Unable to read session configuration: ${error}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const variables = {
|
|
67
|
-
api_key: apiKey,
|
|
68
|
-
server_url: urlString,
|
|
69
|
-
/* Ensure only one session ID is created per test run if `sessionId` is not provided */
|
|
70
|
-
session_id: sessionId || (0, uuid_1.v4)(),
|
|
71
|
-
take_screenshots: !!takeScreenshots,
|
|
72
|
-
auto_analyze: !!autoAnalyze,
|
|
73
|
-
cypress: !!cypress,
|
|
74
|
-
experimental_advanced_rules: !!experimentalAdvancedRules,
|
|
75
|
-
run_context: runContext || null,
|
|
76
|
-
run_options: runOptions || null
|
|
77
|
-
};
|
|
78
|
-
fs_1.default.writeFileSync(exports.PATH_TO_EXTENSION_VARIABLES, JSON.stringify(variables));
|
|
79
|
-
}
|
|
80
|
-
/** Validate the given `apiKey`. This method is blocking and should not be called unnecessarily. */
|
|
81
|
-
const validateApiKey = ({ apiKey, serverURL }) => {
|
|
82
|
-
(0, assert_1.default)(apiKey, 'API key is required');
|
|
83
|
-
const url = new URL(`/api/api-keys/validate/axe-devtools-watcher`, serverURL);
|
|
84
|
-
const res = (0, sync_request_1.default)('GET', url.toString(), {
|
|
85
|
-
headers: {
|
|
86
|
-
'X-API-Key': apiKey
|
|
87
|
-
},
|
|
88
|
-
maxRedirects: 2,
|
|
89
|
-
followRedirects: true,
|
|
90
|
-
maxRetries: 2,
|
|
91
|
-
retry: true,
|
|
92
|
-
retryDelay: 100
|
|
93
|
-
});
|
|
94
|
-
const body = JSON.parse(res.getBody('utf8'));
|
|
95
|
-
if (body.error) {
|
|
96
|
-
throw new Error(body.error);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
exports.validateApiKey = validateApiKey;
|
|
100
|
-
/** Update the extension manifest file. */
|
|
101
|
-
function writeManifest({ all_frames, exclude_globs }) {
|
|
102
|
-
const manifestPath = path_1.default.join(exports.PATH_TO_EXTENSION, 'manifest.json');
|
|
103
|
-
const manifest = JSON.parse(fs_1.default.readFileSync(manifestPath, 'utf-8'));
|
|
104
|
-
manifest.content_scripts[0].all_frames = all_frames;
|
|
105
|
-
manifest.content_scripts[0].exclude_globs = exclude_globs;
|
|
106
|
-
fs_1.default.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
107
|
-
}
|
|
108
|
-
const readVariables = () => {
|
|
109
|
-
const fileContents = fs_1.default.readFileSync(exports.PATH_TO_EXTENSION_VARIABLES, 'utf-8');
|
|
110
|
-
return JSON.parse(fileContents);
|
|
111
|
-
};
|
|
112
|
-
exports.readVariables = readVariables;
|
|
113
|
-
const updateAutoAnalyze = (val) => {
|
|
114
|
-
const variables = (0, exports.readVariables)();
|
|
115
|
-
variables.auto_analyze = val;
|
|
116
|
-
fs_1.default.writeFileSync(exports.PATH_TO_EXTENSION_VARIABLES, JSON.stringify(variables));
|
|
117
|
-
};
|
|
118
|
-
exports.updateAutoAnalyze = updateAutoAnalyze;
|
|
119
|
-
const kWrapped = Symbol('axe watcher wrapped');
|
|
120
|
-
/** Is the given object wrapped? */
|
|
121
|
-
const isWrapped = (o) => {
|
|
122
|
-
if (!o) {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
return o[kWrapped] === true;
|
|
126
|
-
};
|
|
127
|
-
exports.isWrapped = isWrapped;
|
|
128
|
-
/** Mark the given object as wrapped. */
|
|
129
|
-
const markAsWrapped = (o) => {
|
|
130
|
-
Object.defineProperty(o, kWrapped, {
|
|
131
|
-
configurable: false,
|
|
132
|
-
enumerable: false,
|
|
133
|
-
value: true
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
exports.markAsWrapped = markAsWrapped;
|
|
137
|
-
const proxiedGetFuncWithAnalyze = (target, prop, controller) => async (...args) => {
|
|
138
|
-
await controller.analyze({
|
|
139
|
-
__Method: prop,
|
|
140
|
-
__UserRequestedAnalyze: false
|
|
141
|
-
});
|
|
142
|
-
// We use .call(target, ...) for the same reason that
|
|
143
|
-
// proxiedGetWithoutAnalyze uses .bind(target), see below.
|
|
144
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
145
|
-
const result = await target[prop].call(target, ...args);
|
|
146
|
-
return result;
|
|
147
|
-
};
|
|
148
|
-
exports.proxiedGetFuncWithAnalyze = proxiedGetFuncWithAnalyze;
|
|
149
|
-
const proxiedGetWithoutAnalyze = (target, prop) => {
|
|
150
|
-
const original = target[prop];
|
|
151
|
-
if (typeof original === 'function') {
|
|
152
|
-
// Override the proxied function with the original function bound to the target.
|
|
153
|
-
// This allows the "this" context to mimic the original object, rather than the proxy.
|
|
154
|
-
// Doing it this way still satisfies if:
|
|
155
|
-
// 1. The original function uses a private field of the target,
|
|
156
|
-
// it will throw an error if we try to call it in the context of
|
|
157
|
-
// a proxy rather than the original object. See #1052.
|
|
158
|
-
// 2. The original function is implemented in terms of a different
|
|
159
|
-
// method which we *do* wrap, we *don't* want to hook that inner
|
|
160
|
-
// call with an analyze(); we want to be intentional about the
|
|
161
|
-
// specific user-facing methods that we hook.
|
|
162
|
-
const originalFnName = original.name;
|
|
163
|
-
const boundNameOverride = {
|
|
164
|
-
// ends up identical to the original; JavaScript names anonymous functions
|
|
165
|
-
// in objects after the key they're bound to.
|
|
166
|
-
// @see https://github.com/dequelabs/jazzband/issues/1107
|
|
167
|
-
// @see https://stackoverflow.com/a/41854075
|
|
168
|
-
[originalFnName]: function (...args) {
|
|
169
|
-
return original.call(target, ...args);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
return boundNameOverride[originalFnName];
|
|
173
|
-
}
|
|
174
|
-
return original;
|
|
175
|
-
};
|
|
176
|
-
exports.proxiedGetWithoutAnalyze = proxiedGetWithoutAnalyze;
|
|
177
|
-
/**
|
|
178
|
-
* A helper function to merge the user provided arguments with the extension args
|
|
179
|
-
* for Chrome.
|
|
180
|
-
*
|
|
181
|
-
* @param args The user provided arguments to merge with the extension args.
|
|
182
|
-
* @param disableOtherExtensions Whether to disable other extensions.
|
|
183
|
-
* @returns The merged arguments to pass to Chrome.
|
|
184
|
-
*/
|
|
185
|
-
const mergeChromeArgs = (userArgs, { disableOtherExtensions }) => {
|
|
186
|
-
/**
|
|
187
|
-
* It's possible for the user to do:
|
|
188
|
-
* `--load-extension=/path/A, --load-extension=/path/B`
|
|
189
|
-
*
|
|
190
|
-
* We only want to append our extension path onto
|
|
191
|
-
* the last occurrence of `--load-extension`.
|
|
192
|
-
*/
|
|
193
|
-
let loadExtensionFlagIndex = -1;
|
|
194
|
-
let disableExtensionsFlagIndex = -1;
|
|
195
|
-
/**
|
|
196
|
-
* We do not want to modify the user's args directly.
|
|
197
|
-
* We only want to modify and merge the extension args
|
|
198
|
-
* with the user's args if they exist.
|
|
199
|
-
*
|
|
200
|
-
* It's possible for some integrations like WebDriverJS
|
|
201
|
-
* to optionally include the `--` prefix in the flag,
|
|
202
|
-
* when we check for the extension flag we need to account for this.
|
|
203
|
-
*/
|
|
204
|
-
for (const [index, arg] of userArgs.entries()) {
|
|
205
|
-
if (arg.includes(LOAD_EXTENSION_FLAG) || arg.includes('load-extension')) {
|
|
206
|
-
loadExtensionFlagIndex = index;
|
|
207
|
-
}
|
|
208
|
-
if (arg.includes(DISABLE_OTHER_EXTENSIONS_FLAG) ||
|
|
209
|
-
arg.includes('disable-extensions-except')) {
|
|
210
|
-
disableExtensionsFlagIndex = index;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
// The user has provided a `--load-extension` flag
|
|
214
|
-
// We want to append our extension path to the list of extensions.
|
|
215
|
-
if (loadExtensionFlagIndex !== -1) {
|
|
216
|
-
userArgs[loadExtensionFlagIndex] += `,${exports.PATH_TO_EXTENSION}`;
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
userArgs.push(`${LOAD_EXTENSION_FLAG}=${exports.PATH_TO_EXTENSION}`);
|
|
220
|
-
}
|
|
221
|
-
// If the user has already disabled other extensions, we want to append
|
|
222
|
-
// our extension path to the list of disabled extensions.
|
|
223
|
-
if (disableExtensionsFlagIndex !== -1) {
|
|
224
|
-
userArgs[disableExtensionsFlagIndex] += `,${exports.PATH_TO_EXTENSION}`;
|
|
225
|
-
/**
|
|
226
|
-
* Puppeteer and Playwright by default include `--disable-extensions` which
|
|
227
|
-
* disables all extensions. We need to explicitly enable the axe-core/watcher
|
|
228
|
-
* extension.
|
|
229
|
-
*
|
|
230
|
-
* @see https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md#sources
|
|
231
|
-
*
|
|
232
|
-
* Cypress does not include `--disable-extensions` by default but does include
|
|
233
|
-
* their own extension outside of `--load-extension` so we do not able to disable it
|
|
234
|
-
* when injecting the axe-core/watcher extension.
|
|
235
|
-
*/
|
|
236
|
-
}
|
|
237
|
-
else if (disableOtherExtensions) {
|
|
238
|
-
userArgs.push(`${DISABLE_OTHER_EXTENSIONS_FLAG}=${exports.PATH_TO_EXTENSION}`);
|
|
239
|
-
}
|
|
240
|
-
return userArgs;
|
|
241
|
-
};
|
|
242
|
-
exports.mergeChromeArgs = mergeChromeArgs;
|
|
243
|
-
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;;;;AAqGA,wCA2DC;AAoCD,sCASC;AA7MD,+BAAiC;AACjC,gEAAkC;AAClC,oDAA2B;AAC3B,4CAAmB;AACnB,gDAAuB;AACvB,4CAAmB;AAGnB,mCAIgB;AAEhB,0DAA0D;AAE7C,QAAA,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;AAC3D,QAAA,kBAAkB,GAAG,wBAAwB,CAAA;AAC7C,QAAA,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAC3C,YAAE,CAAC,MAAM,EAAE,EACX,0BAA0B,CAC3B,CAAA;AACY,QAAA,2BAA2B,GAAG,cAAI,CAAC,IAAI,CAClD,yBAAiB,EACjB,gBAAgB,CACjB,CAAA;AAED,6BAA6B;AAC7B,MAAM,6BAA6B,GAAG,6BAA6B,CAAA;AACnE,MAAM,mBAAmB,GAAG,kBAAkB,CAAA;AAE9C,MAAa,yBAA0B,SAAQ,KAAK;IAGlD,YAAY,eAAwB;QAClC,KAAK,CACH,wEAAwE;YACtE,mDAAmD;YACnD,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACjD,CAAA;QAPI,SAAI,GAAG,2BAA2B,CAAA;IAQzC,CAAC;CACF;AAVD,8DAUC;AA2DD,6EAA6E;AAC7E,SAAgB,cAAc,CAAC,EAC7B,MA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B,EAAE,CAAC;QAClC,QAAQ,CAAC,IAAI,CAAC,GAAG,6BAA6B,IAAI,yBAAiB,EAAE,CAAC,CAAA;IACxE,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA;AArEY,QAAA,eAAe,mBAqE3B"}
|
package/dist/utils/index.d.ts
DELETED
package/dist/utils/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// TODO: https://github.com/dequelabs/jazzband/issues/1227
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
__exportStar(require("./validateAxeRunOptions"), exports);
|
|
19
|
-
__exportStar(require("./validateAxeRunContext"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,0DAA0D;;;;;;;;;;;;;;;;AAE1D,0DAAuC;AACvC,0DAAuC"}
|