@axe-core/watcher 3.16.0-next.acef2936 → 3.16.0-next.b4c367c9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Controller.d.ts +1 -1
- package/dist/Controller.js +33 -34
- package/dist/Controller.js.map +1 -1
- package/dist/cypress.js +2 -0
- package/dist/cypress.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/playwright.d.ts +1 -1
- package/dist/playwright.js +4 -1
- package/dist/playwright.js.map +1 -1
- package/dist/playwrightTest.d.ts +9 -3
- package/dist/playwrightTest.js +10 -5
- package/dist/playwrightTest.js.map +1 -1
- package/dist/puppeteer.js +2 -0
- package/dist/puppeteer.js.map +1 -1
- package/dist/utils/checkUserArgs.d.ts +8 -0
- package/dist/utils/checkUserArgs.js +10 -0
- package/dist/utils/checkUserArgs.js.map +1 -0
- package/dist/wdio.js +3 -0
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.js +2 -0
- package/dist/webdriver.js.map +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +1 -1
- package/dist/testutils.d.ts +0 -13
- package/dist/testutils.js +0 -50
- package/dist/testutils.js.map +0 -1
- package/dist/utils/assertVariablesWereWritten.test.d.ts +0 -1
- package/dist/utils/assertVariablesWereWritten.test.js +0 -31
- package/dist/utils/assertVariablesWereWritten.test.js.map +0 -1
- package/dist/utils/headlessNotSupportedError.test.d.ts +0 -1
- package/dist/utils/headlessNotSupportedError.test.js +0 -21
- package/dist/utils/headlessNotSupportedError.test.js.map +0 -1
- package/dist/utils/initializeSession.test.d.ts +0 -1
- package/dist/utils/initializeSession.test.js +0 -177
- package/dist/utils/initializeSession.test.js.map +0 -1
- package/dist/utils/isValidExcludePattern.test.d.ts +0 -1
- package/dist/utils/isValidExcludePattern.test.js +0 -17
- package/dist/utils/isValidExcludePattern.test.js.map +0 -1
- package/dist/utils/mergeChromeArgs.test.d.ts +0 -1
- package/dist/utils/mergeChromeArgs.test.js +0 -257
- package/dist/utils/mergeChromeArgs.test.js.map +0 -1
- package/dist/utils/proxyHandlers.test.d.ts +0 -1
- package/dist/utils/proxyHandlers.test.js +0 -27
- package/dist/utils/proxyHandlers.test.js.map +0 -1
- package/dist/utils/validateAxeRunContext.test.d.ts +0 -1
- package/dist/utils/validateAxeRunContext.test.js +0 -97
- package/dist/utils/validateAxeRunContext.test.js.map +0 -1
- package/dist/utils/validateAxeRunOptions.test.d.ts +0 -1
- package/dist/utils/validateAxeRunOptions.test.js +0 -215
- package/dist/utils/validateAxeRunOptions.test.js.map +0 -1
- package/dist/utils/writeVariables.test.d.ts +0 -1
- package/dist/utils/writeVariables.test.js +0 -200
- package/dist/utils/writeVariables.test.js.map +0 -1
package/package.json
CHANGED
package/dist/testutils.d.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import { type Variables } from './utils/writeVariables';
|
2
|
-
export declare function createExtensionFolder(): void;
|
3
|
-
export declare function deleteExtensionFolder(): void;
|
4
|
-
export declare function assertVariables(expected: Partial<Variables>): void;
|
5
|
-
export type ForwardCompatible<T = any> = T & {
|
6
|
-
unknownFutureApi: () => any;
|
7
|
-
};
|
8
|
-
export declare class StubUsingPrivate {
|
9
|
-
#private;
|
10
|
-
static for<T>(methods: Partial<{
|
11
|
-
[k in keyof ForwardCompatible<T>]: ForwardCompatible<T>[k];
|
12
|
-
}>): T & StubUsingPrivate;
|
13
|
-
}
|
package/dist/testutils.js
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
6
|
-
};
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
9
|
-
};
|
10
|
-
var _StubUsingPrivate_instances, _StubUsingPrivate_private;
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.StubUsingPrivate = void 0;
|
13
|
-
exports.createExtensionFolder = createExtensionFolder;
|
14
|
-
exports.deleteExtensionFolder = deleteExtensionFolder;
|
15
|
-
exports.assertVariables = assertVariables;
|
16
|
-
const chai_1 = require("chai");
|
17
|
-
const fs_1 = __importDefault(require("fs"));
|
18
|
-
const constants_1 = require("./utils/constants");
|
19
|
-
function createExtensionFolder() {
|
20
|
-
fs_1.default.mkdirSync(constants_1.PATH_TO_EXTENSION, { recursive: true });
|
21
|
-
}
|
22
|
-
function deleteExtensionFolder() {
|
23
|
-
fs_1.default.rmSync(constants_1.PATH_TO_EXTENSION, { recursive: true });
|
24
|
-
}
|
25
|
-
function assertVariables(expected) {
|
26
|
-
const variablesString = fs_1.default.readFileSync(constants_1.PATH_TO_EXTENSION_VARIABLES, 'utf8');
|
27
|
-
const variables = JSON.parse(variablesString);
|
28
|
-
for (const [key, value] of Object.entries(expected)) {
|
29
|
-
chai_1.assert.deepEqual(variables[key], value);
|
30
|
-
}
|
31
|
-
}
|
32
|
-
class StubUsingPrivate {
|
33
|
-
constructor() {
|
34
|
-
_StubUsingPrivate_instances.add(this);
|
35
|
-
}
|
36
|
-
static for(methods) {
|
37
|
-
const stub = new StubUsingPrivate();
|
38
|
-
for (const name in methods) {
|
39
|
-
;
|
40
|
-
stub[name] = function (...args) {
|
41
|
-
__classPrivateFieldGet(this, _StubUsingPrivate_instances, "m", _StubUsingPrivate_private).call(this);
|
42
|
-
return methods[name](...args);
|
43
|
-
};
|
44
|
-
}
|
45
|
-
return stub;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
exports.StubUsingPrivate = StubUsingPrivate;
|
49
|
-
_StubUsingPrivate_instances = new WeakSet(), _StubUsingPrivate_private = function _StubUsingPrivate_private() { };
|
50
|
-
//# sourceMappingURL=testutils.js.map
|
package/dist/testutils.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"testutils.js","sourceRoot":"","sources":["../src/testutils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,sDAEC;AAED,sDAEC;AAED,0CAOC;AAvBD,+BAA6B;AAC7B,4CAAmB;AACnB,iDAG0B;AAG1B,SAAgB,qBAAqB;IACnC,YAAE,CAAC,SAAS,CAAC,6BAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;AACtD,CAAC;AAED,SAAgB,qBAAqB;IACnC,YAAE,CAAC,MAAM,CAAC,6BAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;AACnD,CAAC;AAED,SAAgB,eAAe,CAAC,QAA4B;IAC1D,MAAM,eAAe,GAAG,YAAE,CAAC,YAAY,CAAC,uCAA2B,EAAE,MAAM,CAAC,CAAA;IAC5E,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;IAE7C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,aAAM,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC;AACH,CAAC;AASD,MAAa,gBAAgB;IAA7B;;IAgBA,CAAC;IAdC,MAAM,CAAC,GAAG,CACR,OAEE;QAEF,MAAM,IAAI,GAAG,IAAI,gBAAgB,EAA0B,CAAA;QAC3D,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,CAAC;YAAC,IAAY,CAAC,IAAI,CAAC,GAAG,UAAkC,GAAG,IAAW;gBACrE,uBAAA,IAAI,8DAAS,MAAb,IAAI,CAAW,CAAA;gBACf,OAAQ,OAAe,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;YACxC,CAAQ,CAAA;QACV,CAAC;QACD,OAAO,IAA+C,CAAA;IACxD,CAAC;CACF;AAhBD,4CAgBC;gHAfa,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
import 'mocha';
|
@@ -1,31 +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
|
-
require("mocha");
|
7
|
-
const chai_1 = require("chai");
|
8
|
-
const testutils_1 = require("../testutils");
|
9
|
-
const constants_1 = require("./constants");
|
10
|
-
const fs_1 = __importDefault(require("fs"));
|
11
|
-
const assertVariablesWereWritten_1 = require("./assertVariablesWereWritten");
|
12
|
-
describe('assertVariablesWereWritten', () => {
|
13
|
-
beforeEach(() => {
|
14
|
-
(0, testutils_1.createExtensionFolder)();
|
15
|
-
});
|
16
|
-
afterEach(() => {
|
17
|
-
(0, testutils_1.deleteExtensionFolder)();
|
18
|
-
});
|
19
|
-
describe('when variables were written', () => {
|
20
|
-
it('doesn`t throw an error', () => {
|
21
|
-
fs_1.default.writeFileSync(constants_1.PATH_TO_EXTENSION_VARIABLES, JSON.stringify({}));
|
22
|
-
chai_1.assert.doesNotThrow(() => (0, assertVariablesWereWritten_1.assertVariablesWereWritten)('test', 'test()'));
|
23
|
-
});
|
24
|
-
});
|
25
|
-
describe('when variables were not written', () => {
|
26
|
-
it('throws an error', () => {
|
27
|
-
chai_1.assert.throws(() => (0, assertVariablesWereWritten_1.assertVariablesWereWritten)('test', 'test()'), `test is not configured for @axe-core/watcher. Please ensure that @axe-core/watcher's test() is invoked. All tests will fail with this error.`);
|
28
|
-
});
|
29
|
-
});
|
30
|
-
});
|
31
|
-
//# sourceMappingURL=assertVariablesWereWritten.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"assertVariablesWereWritten.test.js","sourceRoot":"","sources":["../../src/utils/assertVariablesWereWritten.test.ts"],"names":[],"mappings":";;;;;AAAA,iBAAc;AACd,+BAA6B;AAC7B,4CAA2E;AAC3E,2CAAyD;AACzD,4CAAmB;AACnB,6EAAyE;AAEzE,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,UAAU,CAAC,GAAG,EAAE;QACd,IAAA,iCAAqB,GAAE,CAAA;IACzB,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,iCAAqB,GAAE,CAAA;IACzB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC3C,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,YAAE,CAAC,aAAa,CAAC,uCAA2B,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;YAEjE,aAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,IAAA,uDAA0B,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;QACzE,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC/C,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;YACzB,aAAM,CAAC,MAAM,CACX,GAAG,EAAE,CAAC,IAAA,uDAA0B,EAAC,MAAM,EAAE,QAAQ,CAAC,EAClD,8IAA8I,CAC/I,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
import 'mocha';
|
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
require("mocha");
|
4
|
-
const chai_1 = require("chai");
|
5
|
-
const headlessNotSupportedError_1 = require("./headlessNotSupportedError");
|
6
|
-
describe('headlessNotSupportedError', () => {
|
7
|
-
describe('given no `extendedMessage`', () => {
|
8
|
-
it('should return the default message', () => {
|
9
|
-
const error = new headlessNotSupportedError_1.HeadlessNotSupportedError();
|
10
|
-
chai_1.assert.equal(error.message, (0, headlessNotSupportedError_1.generateMessage)());
|
11
|
-
});
|
12
|
-
});
|
13
|
-
describe('given an `extendedMessage`', () => {
|
14
|
-
it('should return the default message with the `extendedMessage` appended', () => {
|
15
|
-
const extendedMessage = 'extended message';
|
16
|
-
const error = new headlessNotSupportedError_1.HeadlessNotSupportedError(extendedMessage);
|
17
|
-
chai_1.assert.equal(error.message, (0, headlessNotSupportedError_1.generateMessage)(extendedMessage));
|
18
|
-
});
|
19
|
-
});
|
20
|
-
});
|
21
|
-
//# sourceMappingURL=headlessNotSupportedError.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"headlessNotSupportedError.test.js","sourceRoot":"","sources":["../../src/utils/headlessNotSupportedError.test.ts"],"names":[],"mappings":";;AAAA,iBAAc;AACd,+BAA6B;AAC7B,2EAGoC;AAEpC,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAC1C,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,KAAK,GAAG,IAAI,qDAAyB,EAAE,CAAA;YAE7C,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,IAAA,2CAAe,GAAE,CAAC,CAAA;QAChD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAC1C,EAAE,CAAC,uEAAuE,EAAE,GAAG,EAAE;YAC/E,MAAM,eAAe,GAAG,kBAAkB,CAAA;YAC1C,MAAM,KAAK,GAAG,IAAI,qDAAyB,CAAC,eAAe,CAAC,CAAA;YAE5D,aAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,IAAA,2CAAe,EAAC,eAAe,CAAC,CAAC,CAAA;QAC/D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
import 'mocha';
|
@@ -1,177 +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
|
-
require("mocha");
|
7
|
-
const chai_1 = require("chai");
|
8
|
-
const sinon_1 = __importDefault(require("sinon"));
|
9
|
-
const proxyquire_1 = __importDefault(require("proxyquire"));
|
10
|
-
const initializeSession_1 = __importDefault(require("./initializeSession"));
|
11
|
-
describe('initializeSession', () => {
|
12
|
-
afterEach(sinon_1.default.restore);
|
13
|
-
const defaultParams = {
|
14
|
-
apiKey: 'abc',
|
15
|
-
serverURL: 'http://localhost:3000',
|
16
|
-
watcherVersion: '1.0.0',
|
17
|
-
sessionID: null,
|
18
|
-
buildID: null,
|
19
|
-
gitCommitSha: null
|
20
|
-
};
|
21
|
-
describe('validating input', () => {
|
22
|
-
describe('when the API key is missing', () => {
|
23
|
-
it('throws an error', () => {
|
24
|
-
chai_1.assert.throws(() => {
|
25
|
-
(0, initializeSession_1.default)({});
|
26
|
-
}, 'API key is required');
|
27
|
-
});
|
28
|
-
});
|
29
|
-
describe('when the server URL is missing', () => {
|
30
|
-
it('throws an error', () => {
|
31
|
-
chai_1.assert.throws(() => {
|
32
|
-
(0, initializeSession_1.default)({ apiKey: 'abc' });
|
33
|
-
}, 'Server URL is required');
|
34
|
-
});
|
35
|
-
});
|
36
|
-
describe('when the watcher version is missing', () => {
|
37
|
-
it('throws an error', () => {
|
38
|
-
chai_1.assert.throws(() => {
|
39
|
-
(0, initializeSession_1.default)({
|
40
|
-
apiKey: 'abc',
|
41
|
-
serverURL: 'http://localhost:3000'
|
42
|
-
});
|
43
|
-
}, 'Watcher version is required');
|
44
|
-
});
|
45
|
-
});
|
46
|
-
describe('when the session ID is not a string', () => {
|
47
|
-
it('throws an error', () => {
|
48
|
-
chai_1.assert.throws(() => {
|
49
|
-
(0, initializeSession_1.default)({
|
50
|
-
...defaultParams,
|
51
|
-
sessionID: 123
|
52
|
-
});
|
53
|
-
}, 'Session ID must be a string');
|
54
|
-
});
|
55
|
-
});
|
56
|
-
describe('when the build ID is not a string', () => {
|
57
|
-
it('throws an error', () => {
|
58
|
-
chai_1.assert.throws(() => {
|
59
|
-
(0, initializeSession_1.default)({
|
60
|
-
...defaultParams,
|
61
|
-
buildID: 123
|
62
|
-
});
|
63
|
-
}, 'Build ID must be a string');
|
64
|
-
});
|
65
|
-
});
|
66
|
-
describe('when both session ID and build ID are provided', () => {
|
67
|
-
it('throws an error', () => {
|
68
|
-
chai_1.assert.throws(() => {
|
69
|
-
(0, initializeSession_1.default)({
|
70
|
-
...defaultParams,
|
71
|
-
sessionID: 'abc',
|
72
|
-
buildID: '123'
|
73
|
-
});
|
74
|
-
}, 'Session ID and Build ID are mutually exclusive. `sessionId` is deprecated, please use `buildID` instead');
|
75
|
-
});
|
76
|
-
});
|
77
|
-
describe('when the git commit SHA is not a string', () => {
|
78
|
-
it('throws an error', () => {
|
79
|
-
chai_1.assert.throws(() => {
|
80
|
-
(0, initializeSession_1.default)({
|
81
|
-
...defaultParams,
|
82
|
-
gitCommitSha: 123
|
83
|
-
});
|
84
|
-
}, 'Git commit SHA must be a string');
|
85
|
-
});
|
86
|
-
});
|
87
|
-
});
|
88
|
-
describe('when the server returns a non-200 response', () => {
|
89
|
-
afterEach(sinon_1.default.restore);
|
90
|
-
it('throws an error', () => {
|
91
|
-
const requestStub = sinon_1.default
|
92
|
-
.stub()
|
93
|
-
.returns({ statusCode: 500, getBody: () => '{"errors":["boom"]}' });
|
94
|
-
const fn = (0, proxyquire_1.default)('./initializeSession', {
|
95
|
-
'sync-request': requestStub
|
96
|
-
}).default;
|
97
|
-
chai_1.assert.throws(() => {
|
98
|
-
fn(defaultParams);
|
99
|
-
}, 'boom');
|
100
|
-
});
|
101
|
-
});
|
102
|
-
describe('when the server returns a 200 response', () => {
|
103
|
-
it('does not throw an error', () => {
|
104
|
-
const expectedBody = {
|
105
|
-
errors: [],
|
106
|
-
warnings: [],
|
107
|
-
session_id: 'abc'
|
108
|
-
};
|
109
|
-
const requestStub = sinon_1.default.stub().returns({
|
110
|
-
statusCode: 200,
|
111
|
-
getBody: () => JSON.stringify(expectedBody)
|
112
|
-
});
|
113
|
-
const fn = (0, proxyquire_1.default)('./initializeSession', {
|
114
|
-
'sync-request': requestStub
|
115
|
-
}).default;
|
116
|
-
const invoke = fn(defaultParams);
|
117
|
-
chai_1.assert.doesNotThrow(() => invoke);
|
118
|
-
chai_1.assert.deepEqual(invoke, expectedBody.session_id);
|
119
|
-
});
|
120
|
-
describe('and no session_id is returned', () => {
|
121
|
-
const expectedBody = {
|
122
|
-
errors: [],
|
123
|
-
warnings: []
|
124
|
-
};
|
125
|
-
const sessionID = 'xyz';
|
126
|
-
describe('and a sessionID is provided', () => {
|
127
|
-
it('uses the sessionID', () => {
|
128
|
-
const requestStub = sinon_1.default.stub().returns({
|
129
|
-
statusCode: 200,
|
130
|
-
getBody: () => JSON.stringify(expectedBody)
|
131
|
-
});
|
132
|
-
const fn = (0, proxyquire_1.default)('./initializeSession', {
|
133
|
-
'sync-request': requestStub
|
134
|
-
}).default;
|
135
|
-
const invoke = fn({
|
136
|
-
...defaultParams,
|
137
|
-
...{ sessionID }
|
138
|
-
});
|
139
|
-
chai_1.assert.deepEqual(invoke, sessionID);
|
140
|
-
});
|
141
|
-
});
|
142
|
-
describe('and a buildID is provided', () => {
|
143
|
-
it('throws', () => {
|
144
|
-
const requestStub = sinon_1.default.stub().returns({
|
145
|
-
statusCode: 200,
|
146
|
-
getBody: () => JSON.stringify(expectedBody)
|
147
|
-
});
|
148
|
-
const fn = (0, proxyquire_1.default)('./initializeSession', {
|
149
|
-
'sync-request': requestStub
|
150
|
-
}).default;
|
151
|
-
const buildID = 'def';
|
152
|
-
chai_1.assert.throws(() => fn({
|
153
|
-
...defaultParams,
|
154
|
-
...{ buildID }
|
155
|
-
}), 'Failed to initialize session based on build_id. Try again later.');
|
156
|
-
});
|
157
|
-
});
|
158
|
-
describe('and neither a sessionID nor a buildID are provided', () => {
|
159
|
-
it('uses a generated UUID', () => {
|
160
|
-
const requestStub = sinon_1.default.stub().returns({
|
161
|
-
statusCode: 200,
|
162
|
-
getBody: () => JSON.stringify(expectedBody)
|
163
|
-
});
|
164
|
-
const generatedID = 'ghi';
|
165
|
-
const uuidStub = sinon_1.default.stub().returns(generatedID);
|
166
|
-
const fn = (0, proxyquire_1.default)('./initializeSession', {
|
167
|
-
'sync-request': requestStub,
|
168
|
-
uuid: { v4: uuidStub }
|
169
|
-
}).default;
|
170
|
-
const invoke = fn(defaultParams);
|
171
|
-
chai_1.assert.deepEqual(invoke, generatedID);
|
172
|
-
});
|
173
|
-
});
|
174
|
-
});
|
175
|
-
});
|
176
|
-
});
|
177
|
-
//# sourceMappingURL=initializeSession.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"initializeSession.test.js","sourceRoot":"","sources":["../../src/utils/initializeSession.test.ts"],"names":[],"mappings":";;;;;AAAA,iBAAc;AACd,+BAA6B;AAC7B,kDAAyB;AACzB,4DAAmC;AACnC,4EAE4B;AAE5B,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,SAAS,CAAC,eAAK,CAAC,OAAO,CAAC,CAAA;IAExB,MAAM,aAAa,GAA4B;QAC7C,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,uBAAuB;QAClC,cAAc,EAAE,OAAO;QACvB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,IAAI;KACnB,CAAA;IAED,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,QAAQ,CAAC,6BAA6B,EAAE,GAAG,E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AAE,GAAG,EAAE;oBAC/B,MAAM,WAAW,GAAG,eAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC;wBACvC,UAAU,EAAE,GAAG;wBACf,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;qBAC5C,CAAC,CAAA;oBACF,MAAM,WAAW,GAAG,KAAK,CAAA;oBACzB,MAAM,QAAQ,GAAG,eAAK,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;oBAClD,MAAM,EAAE,GAAG,IAAA,oBAAU,EAAC,qBAAqB,EAAE;wBAC3C,cAAc,EAAE,WAAW;wBAC3B,IAAI,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE;qBACvB,CAAC,CAAC,OAAmC,CAAA;oBAEtC,MAAM,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC,CAAA;oBAEhC,aAAM,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;gBACvC,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
import 'mocha';
|
@@ -1,17 +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
|
-
require("mocha");
|
7
|
-
const chai_1 = require("chai");
|
8
|
-
const isValidExcludePattern_1 = __importDefault(require("./isValidExcludePattern"));
|
9
|
-
describe('isValidExcludePattern', () => {
|
10
|
-
it('returns true for valid exclude patterns', () => {
|
11
|
-
chai_1.assert.doesNotThrow(() => (0, isValidExcludePattern_1.default)(['foo', 'bar']));
|
12
|
-
});
|
13
|
-
it('returns false for invalid exclude patterns', () => {
|
14
|
-
chai_1.assert.throws(() => (0, isValidExcludePattern_1.default)(['foo', 'bar', 1]));
|
15
|
-
});
|
16
|
-
});
|
17
|
-
//# sourceMappingURL=isValidExcludePattern.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"isValidExcludePattern.test.js","sourceRoot":"","sources":["../../src/utils/isValidExcludePattern.test.ts"],"names":[],"mappings":";;;;;AAAA,iBAAc;AACd,+BAA6B;AAC7B,oFAA2D;AAE3D,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,aAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,IAAA,+BAAqB,EAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IAClE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,aAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,+BAAqB,EAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
import 'mocha';
|
@@ -1,257 +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
|
-
require("mocha");
|
7
|
-
const chai_1 = require("chai");
|
8
|
-
const constants_1 = require("./constants");
|
9
|
-
const mergeChromeArgs_1 = __importDefault(require("./mergeChromeArgs"));
|
10
|
-
describe('mergeChromeArgs', () => {
|
11
|
-
describe('given the user has not provided any args', () => {
|
12
|
-
describe('when `disableOtherExtensions` is true', () => {
|
13
|
-
it('returns the `--load-extension` when `--disable-extensions-except` flags', () => {
|
14
|
-
const args = (0, mergeChromeArgs_1.default)([], {
|
15
|
-
disableOtherExtensions: true
|
16
|
-
});
|
17
|
-
const [loadExtension, disableExtensionsExcept] = args;
|
18
|
-
chai_1.assert.lengthOf(args, 2);
|
19
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
20
|
-
chai_1.assert.equal(disableExtensionsExcept, `--disable-extensions-except=${constants_1.PATH_TO_EXTENSION}`);
|
21
|
-
});
|
22
|
-
});
|
23
|
-
describe('and `disableOtherExtensions` is false', () => {
|
24
|
-
it('only returns the `--load-extension` flag', () => {
|
25
|
-
const args = (0, mergeChromeArgs_1.default)([], {
|
26
|
-
disableOtherExtensions: false
|
27
|
-
});
|
28
|
-
const [loadExtension] = args;
|
29
|
-
chai_1.assert.lengthOf(args, 1);
|
30
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
31
|
-
});
|
32
|
-
});
|
33
|
-
});
|
34
|
-
describe('given the user has provided args', () => {
|
35
|
-
describe('when the user has not provided extension flags', () => {
|
36
|
-
describe('when `disableOtherExtensions` is true', () => {
|
37
|
-
describe('and the user args and not prefixed with `--`', () => {
|
38
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
39
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'baz=qux,quz', 'quux'], {
|
40
|
-
disableOtherExtensions: true
|
41
|
-
});
|
42
|
-
const [foo, baz, quux, loadExtension, disableExtensionsExcept] = args;
|
43
|
-
chai_1.assert.lengthOf(args, 5);
|
44
|
-
chai_1.assert.equal(foo, 'foo=bar');
|
45
|
-
chai_1.assert.equal(baz, 'baz=qux,quz');
|
46
|
-
chai_1.assert.equal(quux, 'quux');
|
47
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
48
|
-
chai_1.assert.equal(disableExtensionsExcept, `--disable-extensions-except=${constants_1.PATH_TO_EXTENSION}`);
|
49
|
-
});
|
50
|
-
describe('and the user adds multiple instances of the same flag', () => {
|
51
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
52
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'foo=baz'], {
|
53
|
-
disableOtherExtensions: true
|
54
|
-
});
|
55
|
-
const [foo1, foo2, loadExtension, disableExtensionsExcept] = args;
|
56
|
-
chai_1.assert.lengthOf(args, 4);
|
57
|
-
chai_1.assert.equal(foo1, 'foo=bar');
|
58
|
-
chai_1.assert.equal(foo2, 'foo=baz');
|
59
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
60
|
-
chai_1.assert.equal(disableExtensionsExcept, `--disable-extensions-except=${constants_1.PATH_TO_EXTENSION}`);
|
61
|
-
});
|
62
|
-
describe('and some values are comma-separated', () => {
|
63
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
64
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'foo=baz,qux'], {
|
65
|
-
disableOtherExtensions: true
|
66
|
-
});
|
67
|
-
const [foo1, foo2, loadExtension, disableExtensionsExcept] = args;
|
68
|
-
chai_1.assert.lengthOf(args, 4);
|
69
|
-
chai_1.assert.equal(foo1, 'foo=bar');
|
70
|
-
chai_1.assert.equal(foo2, 'foo=baz,qux');
|
71
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
72
|
-
chai_1.assert.equal(disableExtensionsExcept, `--disable-extensions-except=${constants_1.PATH_TO_EXTENSION}`);
|
73
|
-
});
|
74
|
-
});
|
75
|
-
});
|
76
|
-
});
|
77
|
-
});
|
78
|
-
describe('and `disableOtherExtensions` is false', () => {
|
79
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
80
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'baz=qux,quz', 'quux'], {
|
81
|
-
disableOtherExtensions: false
|
82
|
-
});
|
83
|
-
const [foo, baz, quux, loadExtension] = args;
|
84
|
-
chai_1.assert.lengthOf(args, 4);
|
85
|
-
chai_1.assert.equal(foo, 'foo=bar');
|
86
|
-
chai_1.assert.equal(baz, 'baz=qux,quz');
|
87
|
-
chai_1.assert.equal(quux, 'quux');
|
88
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
89
|
-
});
|
90
|
-
describe('and the user adds multiple instances of the same flag', () => {
|
91
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
92
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'foo=baz'], {
|
93
|
-
disableOtherExtensions: false
|
94
|
-
});
|
95
|
-
chai_1.assert.lengthOf(args, 3);
|
96
|
-
const [foo1, foo2, loadExtension] = args;
|
97
|
-
chai_1.assert.equal(foo1, 'foo=bar');
|
98
|
-
chai_1.assert.equal(foo2, 'foo=baz');
|
99
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
100
|
-
});
|
101
|
-
describe('and some values are comma-separated', () => {
|
102
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
103
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'foo=baz,qux'], {
|
104
|
-
disableOtherExtensions: false
|
105
|
-
});
|
106
|
-
chai_1.assert.lengthOf(args, 3);
|
107
|
-
const [foo1, foo2, loadExtension] = args;
|
108
|
-
chai_1.assert.equal(foo1, 'foo=bar');
|
109
|
-
chai_1.assert.equal(foo2, 'foo=baz,qux');
|
110
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
111
|
-
});
|
112
|
-
});
|
113
|
-
});
|
114
|
-
});
|
115
|
-
});
|
116
|
-
describe('when the user has provided extension flags', () => {
|
117
|
-
describe('when `disableOtherExtensions` is true', () => {
|
118
|
-
describe('and the user extension flags are not prefixed with `--`', () => {
|
119
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
120
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'baz=qux,quz', 'quux', 'load-extension=foo'], {
|
121
|
-
disableOtherExtensions: true
|
122
|
-
});
|
123
|
-
const [foo, baz, quux, loadExtension, disableExtensionsExcept] = args;
|
124
|
-
chai_1.assert.lengthOf(args, 5);
|
125
|
-
chai_1.assert.equal(foo, 'foo=bar');
|
126
|
-
chai_1.assert.equal(baz, 'baz=qux,quz');
|
127
|
-
chai_1.assert.equal(quux, 'quux');
|
128
|
-
chai_1.assert.equal(loadExtension, `load-extension=foo,${constants_1.PATH_TO_EXTENSION}`);
|
129
|
-
chai_1.assert.equal(disableExtensionsExcept, `--disable-extensions-except=${constants_1.PATH_TO_EXTENSION}`);
|
130
|
-
});
|
131
|
-
describe('and the user adds multiple instances of the same flag', () => {
|
132
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
133
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'load-extension=baz', 'load-extension=qux'], {
|
134
|
-
disableOtherExtensions: true
|
135
|
-
});
|
136
|
-
const [foo, loadExtension1, loadExtension2, disableExtensionsExcept] = args;
|
137
|
-
chai_1.assert.lengthOf(args, 4);
|
138
|
-
chai_1.assert.equal(foo, 'foo=bar');
|
139
|
-
chai_1.assert.equal(loadExtension1, 'load-extension=baz');
|
140
|
-
chai_1.assert.equal(loadExtension2, `load-extension=qux,${constants_1.PATH_TO_EXTENSION}`);
|
141
|
-
chai_1.assert.equal(disableExtensionsExcept, `--disable-extensions-except=${constants_1.PATH_TO_EXTENSION}`);
|
142
|
-
});
|
143
|
-
describe('and some values are comma-separated', () => {
|
144
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
145
|
-
const args = (0, mergeChromeArgs_1.default)([
|
146
|
-
'foo=bar',
|
147
|
-
'foo=baz,qux',
|
148
|
-
'load-extension=foo',
|
149
|
-
'disable-extensions-except=quz,quux'
|
150
|
-
], {
|
151
|
-
disableOtherExtensions: true
|
152
|
-
});
|
153
|
-
const [foo1, foo2, loadExtension, disableExtensionsExcept] = args;
|
154
|
-
chai_1.assert.lengthOf(args, 4);
|
155
|
-
chai_1.assert.equal(foo1, 'foo=bar');
|
156
|
-
chai_1.assert.equal(foo2, 'foo=baz,qux');
|
157
|
-
chai_1.assert.equal(loadExtension, `load-extension=foo,${constants_1.PATH_TO_EXTENSION}`);
|
158
|
-
chai_1.assert.equal(disableExtensionsExcept, `disable-extensions-except=quz,quux,${constants_1.PATH_TO_EXTENSION}`);
|
159
|
-
});
|
160
|
-
});
|
161
|
-
});
|
162
|
-
});
|
163
|
-
});
|
164
|
-
describe('and `disableOtherExtensions` is false', () => {
|
165
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
166
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'baz=qux,quz', 'quux', 'load-extension=foo'], {
|
167
|
-
disableOtherExtensions: false
|
168
|
-
});
|
169
|
-
const [foo, baz, quux, loadExtension] = args;
|
170
|
-
chai_1.assert.lengthOf(args, 4);
|
171
|
-
chai_1.assert.equal(foo, 'foo=bar');
|
172
|
-
chai_1.assert.equal(baz, 'baz=qux,quz');
|
173
|
-
chai_1.assert.equal(quux, 'quux');
|
174
|
-
chai_1.assert.equal(loadExtension, `load-extension=foo,${constants_1.PATH_TO_EXTENSION}`);
|
175
|
-
});
|
176
|
-
describe('and the user adds multiple instances of the same flag', () => {
|
177
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
178
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'load-extension=baz', 'load-extension=qux'], {
|
179
|
-
disableOtherExtensions: false
|
180
|
-
});
|
181
|
-
const [foo, loadExtension1, loadExtension2] = args;
|
182
|
-
chai_1.assert.lengthOf(args, 3);
|
183
|
-
chai_1.assert.equal(foo, 'foo=bar');
|
184
|
-
chai_1.assert.equal(loadExtension1, 'load-extension=baz');
|
185
|
-
chai_1.assert.equal(loadExtension2, `load-extension=qux,${constants_1.PATH_TO_EXTENSION}`);
|
186
|
-
});
|
187
|
-
describe('and some values are comma-separated', () => {
|
188
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
189
|
-
const args = (0, mergeChromeArgs_1.default)(['foo=bar', 'foo=baz,qux', 'load-extension=foo,quz,quux'], {
|
190
|
-
disableOtherExtensions: false
|
191
|
-
});
|
192
|
-
const [foo1, foo2, loadExtension] = args;
|
193
|
-
chai_1.assert.lengthOf(args, 3);
|
194
|
-
chai_1.assert.equal(foo1, 'foo=bar');
|
195
|
-
chai_1.assert.equal(foo2, 'foo=baz,qux');
|
196
|
-
chai_1.assert.equal(loadExtension, `load-extension=foo,quz,quux,${constants_1.PATH_TO_EXTENSION}`);
|
197
|
-
});
|
198
|
-
});
|
199
|
-
});
|
200
|
-
describe('and the user explicity sets the `--disable-extensions-except` flag', () => {
|
201
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
202
|
-
const args = (0, mergeChromeArgs_1.default)([
|
203
|
-
'foo=bar',
|
204
|
-
'baz=qux,quz',
|
205
|
-
'quux',
|
206
|
-
'disable-extensions-except=foo'
|
207
|
-
], {
|
208
|
-
disableOtherExtensions: false
|
209
|
-
});
|
210
|
-
const [foo, baz, quux, disableExtensionsExcept, loadExtension] = args;
|
211
|
-
chai_1.assert.lengthOf(args, 5);
|
212
|
-
chai_1.assert.equal(foo, 'foo=bar');
|
213
|
-
chai_1.assert.equal(baz, 'baz=qux,quz');
|
214
|
-
chai_1.assert.equal(quux, 'quux');
|
215
|
-
chai_1.assert.equal(disableExtensionsExcept, `disable-extensions-except=foo,${constants_1.PATH_TO_EXTENSION}`);
|
216
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
217
|
-
});
|
218
|
-
describe('and the user adds multiple instances of the same flag', () => {
|
219
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
220
|
-
const args = (0, mergeChromeArgs_1.default)([
|
221
|
-
'foo=bar',
|
222
|
-
'disable-extensions-except=baz',
|
223
|
-
'--disable-extensions-except=qux'
|
224
|
-
], {
|
225
|
-
disableOtherExtensions: false
|
226
|
-
});
|
227
|
-
const [foo, disableExtensionsExcept1, disableExtensionsExcept2, loadExtension] = args;
|
228
|
-
chai_1.assert.lengthOf(args, 4);
|
229
|
-
chai_1.assert.equal(foo, 'foo=bar');
|
230
|
-
chai_1.assert.equal(disableExtensionsExcept1, 'disable-extensions-except=baz');
|
231
|
-
chai_1.assert.equal(disableExtensionsExcept2, `--disable-extensions-except=qux,${constants_1.PATH_TO_EXTENSION}`);
|
232
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
233
|
-
});
|
234
|
-
describe('and some values are comma-separated', () => {
|
235
|
-
it('does not modify the user provided args and appends the extension flags', () => {
|
236
|
-
const args = (0, mergeChromeArgs_1.default)([
|
237
|
-
'foo=bar',
|
238
|
-
'foo=baz,qux',
|
239
|
-
'disable-extensions-except=foo,quz,quux'
|
240
|
-
], {
|
241
|
-
disableOtherExtensions: false
|
242
|
-
});
|
243
|
-
const [foo1, foo2, disableExtensionsExcept, loadExtension] = args;
|
244
|
-
chai_1.assert.lengthOf(args, 4);
|
245
|
-
chai_1.assert.equal(foo1, 'foo=bar');
|
246
|
-
chai_1.assert.equal(foo2, 'foo=baz,qux');
|
247
|
-
chai_1.assert.equal(disableExtensionsExcept, `disable-extensions-except=foo,quz,quux,${constants_1.PATH_TO_EXTENSION}`);
|
248
|
-
chai_1.assert.equal(loadExtension, `--load-extension=${constants_1.PATH_TO_EXTENSION}`);
|
249
|
-
});
|
250
|
-
});
|
251
|
-
});
|
252
|
-
});
|
253
|
-
});
|
254
|
-
});
|
255
|
-
});
|
256
|
-
});
|
257
|
-
//# sourceMappingURL=mergeChromeArgs.test.js.map
|