@axe-core/watcher 0.0.1-next.fb7f7c3c → 1.0.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/README.md +5 -0
- package/dist/git.d.ts +19 -0
- package/dist/git.js +104 -0
- package/dist/git.js.map +1 -0
- package/dist/util.js +39 -2
- package/dist/util.js.map +1 -1
- package/dist/wdio.js +33 -1
- package/dist/wdio.js.map +1 -1
- package/extension/content.js +1 -1
- package/extension/manifest.json +1 -1
- package/extension/worker.js +1 -1
- package/package.json +4 -6
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -134
- package/dist/cli.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# axe™ Watcher
|
|
2
|
+
|
|
3
|
+
Using this module requires an account on the [axe Developer Hub](https://axe.deque.com/axe-watcher/projects). In order to get a trial account, please [contact Deque](https://www.deque.com/company/contact/). For information on how to use this module, please follow the instructions on the [axe Developer Hub](https://axe.deque.com/axe-watcher/projects) projects page.
|
|
4
|
+
|
|
5
|
+
[For support on axe-core, axe Watcher and accessibility. Join the axe Communiity Slack](https://accessibility.deque.com/axe-community)
|
package/dist/git.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Check if the given `dir` is contained by a Git repository. */
|
|
2
|
+
export declare const isRepository: (dir?: string) => boolean;
|
|
3
|
+
/** Get the current branch name. */
|
|
4
|
+
export declare const getBranchName: (dir?: string) => string | null;
|
|
5
|
+
/** Get the default branch name. */
|
|
6
|
+
export declare const getDefaultBranchName: (dir?: string) => string | null;
|
|
7
|
+
/** Get the repository's remote URL. */
|
|
8
|
+
export declare const getRemoteURL: (dir?: string) => string | null;
|
|
9
|
+
interface CommitInfo {
|
|
10
|
+
message: string;
|
|
11
|
+
hash: string;
|
|
12
|
+
author: string;
|
|
13
|
+
email: string;
|
|
14
|
+
}
|
|
15
|
+
/** Get info on the most recent commit. */
|
|
16
|
+
export declare const getCommitInfo: (dir?: string) => CommitInfo | null;
|
|
17
|
+
/** Check if the repository contains unstaged changes. */
|
|
18
|
+
export declare const isDirty: (dir?: string) => boolean;
|
|
19
|
+
export {};
|
package/dist/git.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDirty = exports.getCommitInfo = exports.getRemoteURL = exports.getDefaultBranchName = exports.getBranchName = exports.isRepository = void 0;
|
|
4
|
+
var child_process_1 = require("child_process");
|
|
5
|
+
/** Check if the given `dir` is contained by a Git repository. */
|
|
6
|
+
var isRepository = function (dir) {
|
|
7
|
+
if (dir === void 0) { dir = process.cwd(); }
|
|
8
|
+
try {
|
|
9
|
+
(0, child_process_1.execSync)('git rev-parse --is-inside-work-tree', {
|
|
10
|
+
cwd: dir,
|
|
11
|
+
// Prevent printing "fatal: not a git repository".
|
|
12
|
+
stdio: 'ignore'
|
|
13
|
+
});
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
catch (_a) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.isRepository = isRepository;
|
|
21
|
+
/** Get the current branch name. */
|
|
22
|
+
var getBranchName = function (dir) {
|
|
23
|
+
if (dir === void 0) { dir = process.cwd(); }
|
|
24
|
+
try {
|
|
25
|
+
return (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', {
|
|
26
|
+
cwd: dir,
|
|
27
|
+
// Ignore stderr to prevent printing "fatal: not a git repository" in tests.
|
|
28
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
29
|
+
})
|
|
30
|
+
.toString()
|
|
31
|
+
.trim();
|
|
32
|
+
}
|
|
33
|
+
catch (_a) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.getBranchName = getBranchName;
|
|
38
|
+
/** Get the default branch name. */
|
|
39
|
+
var getDefaultBranchName = function (dir) {
|
|
40
|
+
if (dir === void 0) { dir = process.cwd(); }
|
|
41
|
+
try {
|
|
42
|
+
return (0, child_process_1.execSync)('git symbolic-ref --short refs/remotes/origin/HEAD', {
|
|
43
|
+
cwd: dir,
|
|
44
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
45
|
+
})
|
|
46
|
+
.toString()
|
|
47
|
+
.trim()
|
|
48
|
+
.replace('origin/', '');
|
|
49
|
+
}
|
|
50
|
+
catch (_a) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.getDefaultBranchName = getDefaultBranchName;
|
|
55
|
+
/** Get the repository's remote URL. */
|
|
56
|
+
var getRemoteURL = function (dir) {
|
|
57
|
+
if (dir === void 0) { dir = process.cwd(); }
|
|
58
|
+
try {
|
|
59
|
+
return (0, child_process_1.execSync)('git config --get remote.origin.url', {
|
|
60
|
+
cwd: dir,
|
|
61
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
62
|
+
})
|
|
63
|
+
.toString()
|
|
64
|
+
.trim();
|
|
65
|
+
}
|
|
66
|
+
catch (_a) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.getRemoteURL = getRemoteURL;
|
|
71
|
+
/** Get info on the most recent commit. */
|
|
72
|
+
var getCommitInfo = function (dir) {
|
|
73
|
+
if (dir === void 0) { dir = process.cwd(); }
|
|
74
|
+
try {
|
|
75
|
+
// %s=subject (message), %H=hash, %an=author name, %ae=author email, %n=newline
|
|
76
|
+
// See https://git-scm.com/docs/git-show#_pretty_formats
|
|
77
|
+
var stdout = (0, child_process_1.execSync)('git show --no-patch --format="%s%n%H%n%an%n%ae"', {
|
|
78
|
+
cwd: dir,
|
|
79
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
80
|
+
});
|
|
81
|
+
var _a = stdout.toString().trim().split('\n'), message = _a[0], hash = _a[1], author = _a[2], email = _a[3];
|
|
82
|
+
return { message: message, hash: hash, author: author, email: email };
|
|
83
|
+
}
|
|
84
|
+
catch (_b) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.getCommitInfo = getCommitInfo;
|
|
89
|
+
/** Check if the repository contains unstaged changes. */
|
|
90
|
+
var isDirty = function (dir) {
|
|
91
|
+
if (dir === void 0) { dir = process.cwd(); }
|
|
92
|
+
try {
|
|
93
|
+
var stdout = (0, child_process_1.execSync)('git status --short', {
|
|
94
|
+
cwd: dir,
|
|
95
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
96
|
+
});
|
|
97
|
+
return stdout.length > 0;
|
|
98
|
+
}
|
|
99
|
+
catch (_a) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
exports.isDirty = isDirty;
|
|
104
|
+
//# sourceMappingURL=git.js.map
|
package/dist/git.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AAExC,iEAAiE;AAC1D,IAAM,YAAY,GAAG,UAAC,GAAmB;IAAnB,oBAAA,EAAA,MAAM,OAAO,CAAC,GAAG,EAAE;IAC9C,IAAI;QACF,IAAA,wBAAQ,EAAC,qCAAqC,EAAE;YAC9C,GAAG,EAAE,GAAG;YACR,kDAAkD;YAClD,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;KACZ;IAAC,WAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA;AAXY,QAAA,YAAY,gBAWxB;AAED,mCAAmC;AAC5B,IAAM,aAAa,GAAG,UAAC,GAAmB;IAAnB,oBAAA,EAAA,MAAM,OAAO,CAAC,GAAG,EAAE;IAC/C,IAAI;QACF,OAAO,IAAA,wBAAQ,EAAC,iCAAiC,EAAE;YACjD,GAAG,EAAE,GAAG;YACR,4EAA4E;YAC5E,KAAK,EAAE,C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G;YACR,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAA;QACI,IAAA,KAAiC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAApE,OAAO,QAAA,EAAE,IAAI,QAAA,EAAE,MAAM,QAAA,EAAE,KAAK,QAAwC,CAAA;QAC3E,OAAO,EAAE,OAAO,SAAA,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,KAAK,OAAA,EAAE,CAAA;KACxC;IAAC,WAAM;QACN,OAAO,IAAI,CAAA;KACZ;AACH,CAAC,CAAA;AAbY,QAAA,aAAa,iBAazB;AAED,yDAAyD;AAClD,IAAM,OAAO,GAAG,UAAC,GAAmB;IAAnB,oBAAA,EAAA,MAAM,OAAO,CAAC,GAAG,EAAE;IACzC,IAAI;QACF,IAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,oBAAoB,EAAE;YAC5C,GAAG,EAAE,GAAG;YACR,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAA;QACF,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;KACzB;IAAC,WAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA;AAVY,QAAA,OAAO,WAUnB"}
|
package/dist/util.js
CHANGED
|
@@ -14,6 +14,29 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
24
|
+
}) : (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
o[k2] = m[k];
|
|
27
|
+
}));
|
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
+
}) : function(o, v) {
|
|
31
|
+
o["default"] = v;
|
|
32
|
+
});
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
17
40
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
41
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
42
|
};
|
|
@@ -22,6 +45,7 @@ exports.writeManifest = exports.writeVariables = exports.HeadlessNotSupportedErr
|
|
|
22
45
|
var fs_1 = __importDefault(require("fs"));
|
|
23
46
|
var path_1 = __importDefault(require("path"));
|
|
24
47
|
var os_1 = __importDefault(require("os"));
|
|
48
|
+
var git = __importStar(require("./git"));
|
|
25
49
|
exports.PATH_TO_EXTENSION = path_1.default.join(__dirname, '..', 'extension');
|
|
26
50
|
exports.DEFAULT_SERVER_URL = 'https://axe.deque.com/';
|
|
27
51
|
exports.PATH_TO_SESSION_FILE = path_1.default.join(os_1.default.tmpdir(), 'axe-watcher-session.json');
|
|
@@ -67,12 +91,25 @@ function writeVariables(_a) {
|
|
|
67
91
|
throw new Error("Unable to read session configuration: ".concat(error));
|
|
68
92
|
}
|
|
69
93
|
}
|
|
70
|
-
|
|
94
|
+
var variables = {
|
|
71
95
|
api_key: apiKey,
|
|
72
96
|
server_url: urlString,
|
|
73
97
|
session_id: sessionId,
|
|
74
98
|
auto_analyze: !!autoAnalyze
|
|
75
|
-
}
|
|
99
|
+
};
|
|
100
|
+
// If the repository is a git repository, add git info to the variables.
|
|
101
|
+
if (git.isRepository()) {
|
|
102
|
+
variables.git_branch = git.getBranchName();
|
|
103
|
+
variables.git_default_branch = git.getDefaultBranchName();
|
|
104
|
+
var info = git.getCommitInfo();
|
|
105
|
+
variables.git_commit_sha = info === null || info === void 0 ? void 0 : info.hash;
|
|
106
|
+
variables.git_commit_author = info === null || info === void 0 ? void 0 : info.author;
|
|
107
|
+
variables.git_commit_email = info === null || info === void 0 ? void 0 : info.email;
|
|
108
|
+
variables.git_commit_message = info === null || info === void 0 ? void 0 : info.message;
|
|
109
|
+
variables.git_url = git.getRemoteURL();
|
|
110
|
+
variables.git_is_dirty = git.isDirty();
|
|
111
|
+
}
|
|
112
|
+
fs_1.default.writeFileSync(exports.PATH_TO_EXTENSION_VARIABLES, JSON.stringify(variables));
|
|
76
113
|
}
|
|
77
114
|
exports.writeVariables = writeVariables;
|
|
78
115
|
/** Update the extension manifest file. */
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAmB;AACnB,8CAAuB;AACvB,0CAAmB;AACnB,yCAA4B;AAEf,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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AC,CAAC,CAAC,CAAC,UAAU,GAAG,UAAU,CAAA;IACnD,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,aAAa,GAAG,aAAa,CAAA;IACzD,YAAE,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AACnE,CAAC;AATD,sCASC"}
|
package/dist/wdio.js
CHANGED
|
@@ -66,8 +66,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
66
66
|
};
|
|
67
67
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
68
|
exports.WdioController = exports.wdioTestRunner = exports.wdioConfig = void 0;
|
|
69
|
+
var uuid_1 = require("uuid");
|
|
70
|
+
var fs_1 = __importDefault(require("fs"));
|
|
69
71
|
var util_1 = require("./util");
|
|
70
72
|
var Controller_1 = __importDefault(require("./Controller"));
|
|
73
|
+
var noop = function () {
|
|
74
|
+
// Nothing.
|
|
75
|
+
};
|
|
71
76
|
/**
|
|
72
77
|
* Creates a WebDriverIO config that uses axe extension
|
|
73
78
|
*
|
|
@@ -109,7 +114,34 @@ function wdioTestRunner(axe, config) {
|
|
|
109
114
|
throw new util_1.HeadlessNotSupportedError();
|
|
110
115
|
}
|
|
111
116
|
chromeOpts.args = util_1.extensionArgs.concat(args);
|
|
112
|
-
|
|
117
|
+
var _a = config.onPrepare, onPrepare = _a === void 0 ? noop : _a, _b = config.onComplete, onComplete = _b === void 0 ? noop : _b;
|
|
118
|
+
return __assign(__assign({}, config), { capabilities: capabilities,
|
|
119
|
+
// Write a static/persistent session to disk so that each worker uses the same session ID.
|
|
120
|
+
onPrepare: function () {
|
|
121
|
+
var params = [];
|
|
122
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
123
|
+
params[_i] = arguments[_i];
|
|
124
|
+
}
|
|
125
|
+
var sessionId = axe.sessionId || (0, uuid_1.v4)();
|
|
126
|
+
fs_1.default.writeFileSync(util_1.PATH_TO_SESSION_FILE, JSON.stringify({ id: sessionId }));
|
|
127
|
+
// @ts-expect-error TS is angry about calling this ¯\_(ツ)_/¯
|
|
128
|
+
return onPrepare.apply(void 0, params);
|
|
129
|
+
},
|
|
130
|
+
// Remove the file, preventing other sessions from reusing its ID.
|
|
131
|
+
onComplete: function () {
|
|
132
|
+
var params = [];
|
|
133
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
134
|
+
params[_i] = arguments[_i];
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
fs_1.default.unlinkSync(util_1.PATH_TO_SESSION_FILE);
|
|
138
|
+
}
|
|
139
|
+
catch (_a) {
|
|
140
|
+
// Oh well.
|
|
141
|
+
}
|
|
142
|
+
// @ts-expect-error TS is angry about calling this ¯\_(ツ)_/¯
|
|
143
|
+
return onComplete.apply(void 0, params);
|
|
144
|
+
} });
|
|
113
145
|
}
|
|
114
146
|
exports.wdioTestRunner = wdioTestRunner;
|
|
115
147
|
var WdioController = /** @class */ (function (_super) {
|
package/dist/wdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wdio.js","sourceRoot":"","sources":["../src/wdio.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+
|
|
1
|
+
{"version":3,"file":"wdio.js","sourceRoot":"","sources":["../src/wdio.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAAiC;AACjC,0CAAmB;AACnB,+BAMe;AACf,4DAAqC;AAErC,IAAM,IAAI,GAAG;IACX,WAAW;AACb,CAAC,CAAA;AAUD;;;;GAIG;AAEH,SAAgB,UAAU,CAAC,GAAY;;IACrC,IAAA,qBAAc,EAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAEvB,iFAAiF;IACjF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