@axe-core/watcher 4.5.0-next.2bcc7462 → 4.5.0
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/utils/assertVariablesWereWritten.d.ts +1 -1
- package/dist/utils/assertVariablesWereWritten.js +7 -8
- package/dist/utils/assertVariablesWereWritten.js.map +1 -1
- package/dist/utils/mergeChromeArgs.js +5 -6
- package/dist/utils/mergeChromeArgs.js.map +1 -1
- package/dist/utils/readVariables.js +2 -3
- package/dist/utils/readVariables.js.map +1 -1
- package/dist/utils/writeExtensionManifest.js +2 -2
- package/dist/utils/writeExtensionManifest.js.map +1 -1
- package/dist/utils/writeVariables.js +1 -4
- package/dist/utils/writeVariables.js.map +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +1 -1
- package/dist/utils/runExtensionDir.d.ts +0 -43
- package/dist/utils/runExtensionDir.js +0 -86
- package/dist/utils/runExtensionDir.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-run extension directory management.
|
|
3
|
-
*
|
|
4
|
-
* The browser extension is installed once at `PATH_TO_EXTENSION`
|
|
5
|
-
* (`node_modules/@axe-core/watcher/extension`). Historically every test run
|
|
6
|
-
* wrote its `variables.json` (carrying `project_id`, `session_id`, run
|
|
7
|
-
* options, …) and mutated `manifest.json` *inside that single shared
|
|
8
|
-
* directory*. When two runs — two terminals, two CI workers resolving
|
|
9
|
-
* different `projectId`s — overlapped, the last writer won and scans uploaded
|
|
10
|
-
* to the wrong project (Developer Hub stuck "waiting for data").
|
|
11
|
-
*
|
|
12
|
-
* To make parallel runs safe, each Node process gets its own copy of the
|
|
13
|
-
* extension in a unique temp directory, and the browser is pointed at it via
|
|
14
|
-
* `--load-extension`. The whole install is copied: Chrome's unpacked-extension
|
|
15
|
-
* loader does not load an extension whose scripts are symlinks (the content
|
|
16
|
-
* script never runs, every controller action then times out), so every entry
|
|
17
|
-
* must be a real file. `manifest.json` and `variables.json` are copied with the
|
|
18
|
-
* rest and then overwritten per-run by `writeExtensionManifest`/`writeVariables`.
|
|
19
|
-
*
|
|
20
|
-
* The shared session file (`PATH_TO_SESSION_FILE`) is intentionally NOT
|
|
21
|
-
* per-run — its whole purpose is to share one session ID across the workers of
|
|
22
|
-
* a single suite — so it continues to live at the shared install path and is
|
|
23
|
-
* excluded from the per-run copy (see `copyDereferenced`).
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Return this process's per-run extension directory, creating and populating it
|
|
27
|
-
* on first use. If the shared install is missing (a broken installation), the
|
|
28
|
-
* shared path is returned unchanged so the failure surfaces exactly as before.
|
|
29
|
-
*/
|
|
30
|
-
export declare function ensureRunExtensionDir(): string;
|
|
31
|
-
/**
|
|
32
|
-
* Return the active per-run extension directory, or the shared install path if
|
|
33
|
-
* one has not been prepared yet. Read-only callers (`readVariables`,
|
|
34
|
-
* `mergeChromeArgs`, …) use this; in every integration `writeVariables` has
|
|
35
|
-
* already prepared the directory before these run.
|
|
36
|
-
*/
|
|
37
|
-
export declare function getRunExtensionDir(): string;
|
|
38
|
-
/**
|
|
39
|
-
* Test-only: remove the prepared per-run directory (if any) and forget it so a
|
|
40
|
-
* subsequent `ensureRunExtensionDir()` starts fresh. The process-exit cleanup
|
|
41
|
-
* handler stays registered but is harmless once the reference is cleared.
|
|
42
|
-
*/
|
|
43
|
-
export declare function resetRunExtensionDirForTests(): void;
|
|
@@ -1,86 +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.ensureRunExtensionDir = ensureRunExtensionDir;
|
|
7
|
-
exports.getRunExtensionDir = getRunExtensionDir;
|
|
8
|
-
exports.resetRunExtensionDirForTests = resetRunExtensionDirForTests;
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const os_1 = __importDefault(require("os"));
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const constantsNode_1 = require("./constantsNode");
|
|
13
|
-
const createDebugger_1 = __importDefault(require("../createDebugger"));
|
|
14
|
-
const debugLogger = (0, createDebugger_1.default)('config:runExtensionDir');
|
|
15
|
-
const SESSION_FILE_NAME = path_1.default.basename(constantsNode_1.PATH_TO_SESSION_FILE);
|
|
16
|
-
let runExtensionDir = null;
|
|
17
|
-
let cleanupRegistered = false;
|
|
18
|
-
function copyDereferenced(src, dest) {
|
|
19
|
-
fs_1.default.mkdirSync(dest, { recursive: true });
|
|
20
|
-
for (const entry of fs_1.default.readdirSync(src, { withFileTypes: true })) {
|
|
21
|
-
if (entry.name === SESSION_FILE_NAME) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const from = path_1.default.join(src, entry.name);
|
|
25
|
-
const to = path_1.default.join(dest, entry.name);
|
|
26
|
-
if (fs_1.default.statSync(from).isDirectory()) {
|
|
27
|
-
copyDereferenced(from, to);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
fs_1.default.copyFileSync(from, to);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function populate(dir) {
|
|
35
|
-
copyDereferenced(constantsNode_1.PATH_TO_EXTENSION, dir);
|
|
36
|
-
}
|
|
37
|
-
function disposeRunExtensionDir() {
|
|
38
|
-
if (!runExtensionDir) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
fs_1.default.rmSync(runExtensionDir, { recursive: true, force: true });
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function registerCleanup() {
|
|
48
|
-
if (cleanupRegistered) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
cleanupRegistered = true;
|
|
52
|
-
process.once('exit', disposeRunExtensionDir);
|
|
53
|
-
}
|
|
54
|
-
function ensureRunExtensionDir() {
|
|
55
|
-
if (runExtensionDir) {
|
|
56
|
-
return runExtensionDir;
|
|
57
|
-
}
|
|
58
|
-
if (!fs_1.default.existsSync(constantsNode_1.PATH_TO_EXTENSION)) {
|
|
59
|
-
return constantsNode_1.PATH_TO_EXTENSION;
|
|
60
|
-
}
|
|
61
|
-
const dir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'axe-watcher-ext-'));
|
|
62
|
-
try {
|
|
63
|
-
populate(dir);
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
debugLogger('Failed to prepare per-run extension directory, using shared install', error instanceof Error ? error.message : error);
|
|
67
|
-
try {
|
|
68
|
-
fs_1.default.rmSync(dir, { recursive: true, force: true });
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
}
|
|
72
|
-
return constantsNode_1.PATH_TO_EXTENSION;
|
|
73
|
-
}
|
|
74
|
-
runExtensionDir = dir;
|
|
75
|
-
registerCleanup();
|
|
76
|
-
debugLogger('Prepared per-run extension directory', dir);
|
|
77
|
-
return dir;
|
|
78
|
-
}
|
|
79
|
-
function getRunExtensionDir() {
|
|
80
|
-
return runExtensionDir ?? constantsNode_1.PATH_TO_EXTENSION;
|
|
81
|
-
}
|
|
82
|
-
function resetRunExtensionDirForTests() {
|
|
83
|
-
disposeRunExtensionDir();
|
|
84
|
-
runExtensionDir = null;
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=runExtensionDir.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runExtensionDir.js","sourceRoot":"","sources":["../../src/utils/runExtensionDir.ts"],"names":[],"mappings":";;;;;AA8GA,sDA+BC;AAQD,gDAEC;AAOD,oEAGC;AAxID,4CAAmB;AACnB,4CAAmB;AACnB,gDAAuB;AACvB,mDAAyE;AACzE,uEAA8C;AAE9C,MAAM,WAAW,G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