@axe-core/watcher 3.16.0-next.38153f69 → 3.16.0-next.4165f8f5
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 +6 -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/playwrightWrapping.d.ts +1 -0
- package/dist/playwrightWrapping.js +15 -7
- package/dist/playwrightWrapping.js.map +1 -1
- package/dist/puppeteer.js +4 -0
- package/dist/puppeteer.js.map +1 -1
- package/dist/utils/assertVariablesWereWritten.d.ts +1 -0
- package/dist/utils/assertVariablesWereWritten.js +15 -0
- package/dist/utils/assertVariablesWereWritten.js.map +1 -0
- 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/utils/proxyHandlers.d.ts +2 -0
- package/dist/utils/proxyHandlers.js +14 -1
- package/dist/utils/proxyHandlers.js.map +1 -1
- package/dist/wdio.js +5 -0
- package/dist/wdio.js.map +1 -1
- package/dist/webdriver.js +4 -0
- package/dist/webdriver.js.map +1 -1
- package/extension/axe.js +1 -1
- package/extension/axe.js.LICENSE.txt +1 -1
- package/extension/background.js +1 -1
- package/extension/content.js +1 -1
- package/package.json +2 -2
- 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
@@ -1,97 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
require("mocha");
|
4
|
-
const chai_1 = require("chai");
|
5
|
-
const validateAxeRunContext_1 = require("./validateAxeRunContext");
|
6
|
-
describe('validateAxeRunContext', () => {
|
7
|
-
describe('when no run context is provided', () => {
|
8
|
-
it('does not throw an error', () => {
|
9
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)());
|
10
|
-
});
|
11
|
-
});
|
12
|
-
describe('given a valid run context', () => {
|
13
|
-
describe('when the run context is a string', () => {
|
14
|
-
it('does not throw an error', () => {
|
15
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({ include: 'selector' }));
|
16
|
-
});
|
17
|
-
});
|
18
|
-
describe('when the run context is an array of strings', () => {
|
19
|
-
it('does not throw an error', () => {
|
20
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({ include: ['selector1', 'selector2'] }));
|
21
|
-
});
|
22
|
-
});
|
23
|
-
describe('when the run context is an object', () => {
|
24
|
-
describe('when the object has an `include` property', () => {
|
25
|
-
it('does not throw an error', () => {
|
26
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({ include: 'selector' }));
|
27
|
-
});
|
28
|
-
describe('and a `fromFrames` property', () => {
|
29
|
-
it('does not throw an error', () => {
|
30
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({
|
31
|
-
include: {
|
32
|
-
fromFrames: ['selector', 'selector']
|
33
|
-
}
|
34
|
-
}));
|
35
|
-
});
|
36
|
-
});
|
37
|
-
describe('and a `fromShadowDom` property', () => {
|
38
|
-
it('does not throw an error', () => {
|
39
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({
|
40
|
-
include: {
|
41
|
-
fromShadowDom: ['selector', 'selector']
|
42
|
-
}
|
43
|
-
}));
|
44
|
-
});
|
45
|
-
});
|
46
|
-
});
|
47
|
-
describe('when the object has an `exclude` property', () => {
|
48
|
-
it('does not throw an error', () => {
|
49
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({ exclude: 'selector' }));
|
50
|
-
});
|
51
|
-
describe('and a `fromFrames` property', () => {
|
52
|
-
it('does not throw an error', () => {
|
53
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({
|
54
|
-
exclude: {
|
55
|
-
fromFrames: ['selector', 'selector']
|
56
|
-
}
|
57
|
-
}));
|
58
|
-
});
|
59
|
-
});
|
60
|
-
describe('and a `fromShadowDom` property', () => {
|
61
|
-
it('does not throw an error', () => {
|
62
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({
|
63
|
-
exclude: {
|
64
|
-
fromShadowDom: ['selector', 'selector']
|
65
|
-
}
|
66
|
-
}));
|
67
|
-
});
|
68
|
-
});
|
69
|
-
});
|
70
|
-
describe('when the object has both `include` and `exclude` properties', () => {
|
71
|
-
it('does not throw an error', () => {
|
72
|
-
chai_1.assert.doesNotThrow(() => (0, validateAxeRunContext_1.validateAxeRunContext)({ include: 'selector', exclude: 'selector' }));
|
73
|
-
});
|
74
|
-
});
|
75
|
-
});
|
76
|
-
});
|
77
|
-
describe('given an invalid run context', () => {
|
78
|
-
describe('and does not have an `include` or `exclude` property', () => {
|
79
|
-
describe('and is not a string', () => {
|
80
|
-
it('throws an error', () => {
|
81
|
-
chai_1.assert.throws(() => (0, validateAxeRunContext_1.validateAxeRunContext)(1));
|
82
|
-
});
|
83
|
-
});
|
84
|
-
describe('and is not an array of strings', () => {
|
85
|
-
it('throws an error', () => {
|
86
|
-
chai_1.assert.throws(() => (0, validateAxeRunContext_1.validateAxeRunContext)([1, 2]));
|
87
|
-
});
|
88
|
-
});
|
89
|
-
describe('and does not have a `fromFrames` or `fromShadowDom` property', () => {
|
90
|
-
it('throws an error', () => {
|
91
|
-
chai_1.assert.throws(() => (0, validateAxeRunContext_1.validateAxeRunContext)({ a: 'a' }));
|
92
|
-
});
|
93
|
-
});
|
94
|
-
});
|
95
|
-
});
|
96
|
-
});
|
97
|
-
//# sourceMappingURL=validateAxeRunContext.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"validateAxeRunContext.test.js","sourceRoot":"","sources":["../../src/utils/validateAxeRunContext.test.ts"],"names":[],"mappings":";;AAAA,iBAAc;AACd,+BAA6B;AAC7B,mEAA+D;AAE/D,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC/C,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;YACjC,aAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,IAAA,6CAAqB,GAAE,CAAC,CAAA;QACpD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,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
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
require("mocha");
|
4
|
-
const chai_1 = require("chai");
|
5
|
-
const validateAxeRunOptions_1 = require("./validateAxeRunOptions");
|
6
|
-
describe('validateAxeRunOptions', () => {
|
7
|
-
describe('given no options', () => {
|
8
|
-
it('does not throw', () => {
|
9
|
-
chai_1.assert.doesNotThrow(() => {
|
10
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)();
|
11
|
-
});
|
12
|
-
});
|
13
|
-
});
|
14
|
-
describe('given an option that has not been exposed to be configured', () => {
|
15
|
-
it('throws', () => {
|
16
|
-
chai_1.assert.throws(() => {
|
17
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ a: 'a' });
|
18
|
-
}, /Invalid property found in `runOptions`/i);
|
19
|
-
});
|
20
|
-
});
|
21
|
-
describe('given `ancestry` property is provided', () => {
|
22
|
-
describe('when `ancestry` is not a boolean', () => {
|
23
|
-
it('throws', () => {
|
24
|
-
chai_1.assert.throws(() => {
|
25
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ ancestry: 'a' });
|
26
|
-
}, /`ancestry` property must be a boolean./i);
|
27
|
-
});
|
28
|
-
});
|
29
|
-
describe('when `ancestry` is a boolean', () => {
|
30
|
-
it('does not throw', () => {
|
31
|
-
chai_1.assert.doesNotThrow(() => {
|
32
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ ancestry: true });
|
33
|
-
});
|
34
|
-
});
|
35
|
-
});
|
36
|
-
});
|
37
|
-
describe('given `rules` property is provided', () => {
|
38
|
-
describe('when `rules` is not an object', () => {
|
39
|
-
it('throws', () => {
|
40
|
-
chai_1.assert.throws(() => {
|
41
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ rules: 'a' });
|
42
|
-
}, /`rules` property must be an object./i);
|
43
|
-
});
|
44
|
-
});
|
45
|
-
describe('when `rules` is an array', () => {
|
46
|
-
it('throws', () => {
|
47
|
-
chai_1.assert.throws(() => {
|
48
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ rules: ['a'] });
|
49
|
-
}, /`rules` property must be an object./i);
|
50
|
-
});
|
51
|
-
});
|
52
|
-
describe('when `rules` is an object', () => {
|
53
|
-
describe('when `rules` object has no value', () => {
|
54
|
-
it('throws', () => {
|
55
|
-
chai_1.assert.throws(() => {
|
56
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ rules: {} });
|
57
|
-
}, /`rules` object must contain at least one key-value pair./i);
|
58
|
-
});
|
59
|
-
});
|
60
|
-
describe('when `rules` object has a value', () => {
|
61
|
-
describe('and the value is not an object', () => {
|
62
|
-
it('throws', () => {
|
63
|
-
chai_1.assert.throws(() => {
|
64
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ rules: { a: 'a' } });
|
65
|
-
}, /The value of the `a` key in the `rules` object must be an object./i);
|
66
|
-
});
|
67
|
-
});
|
68
|
-
describe('and the value is an object', () => {
|
69
|
-
describe('and the value has no properties', () => {
|
70
|
-
it('throws', () => {
|
71
|
-
chai_1.assert.throws(() => {
|
72
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ rules: { a: {} } });
|
73
|
-
}, /The `a` key in the `rules` object must only contain the `enabled` property./i);
|
74
|
-
});
|
75
|
-
});
|
76
|
-
describe('and the value has properties', () => {
|
77
|
-
describe('and the value does not have an `enabled` property', () => {
|
78
|
-
it('throws', () => {
|
79
|
-
chai_1.assert.throws(() => {
|
80
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ rules: { a: { b: 'a' } } });
|
81
|
-
}, /The `a` key in the `rules` object must contain an `enabled` property./i);
|
82
|
-
});
|
83
|
-
});
|
84
|
-
describe('and the value has an `enabled` property', () => {
|
85
|
-
describe('and the `enabled` property is not a boolean', () => {
|
86
|
-
it('throws', () => {
|
87
|
-
chai_1.assert.throws(() => {
|
88
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ rules: { a: { enabled: 'a' } } });
|
89
|
-
}, /The `enabled` property of the `a` key in the `rules` object must be a boolean./i);
|
90
|
-
});
|
91
|
-
});
|
92
|
-
describe('and the `enabled` property is a boolean', () => {
|
93
|
-
it('does not throw', () => {
|
94
|
-
chai_1.assert.doesNotThrow(() => {
|
95
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ rules: { a: { enabled: true } } });
|
96
|
-
});
|
97
|
-
});
|
98
|
-
});
|
99
|
-
});
|
100
|
-
});
|
101
|
-
});
|
102
|
-
});
|
103
|
-
});
|
104
|
-
});
|
105
|
-
describe('given `runOnly` property is provided', () => {
|
106
|
-
describe('when `runOnly` is a string', () => {
|
107
|
-
it('does not throw', () => {
|
108
|
-
chai_1.assert.doesNotThrow(() => {
|
109
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: 'a' });
|
110
|
-
});
|
111
|
-
});
|
112
|
-
});
|
113
|
-
describe('when `runOnly` is an array', () => {
|
114
|
-
describe('and the array is empty', () => {
|
115
|
-
it('throws', () => {
|
116
|
-
chai_1.assert.throws(() => {
|
117
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: [] });
|
118
|
-
}, /`runOnly` array must contain at least one string value./i);
|
119
|
-
});
|
120
|
-
});
|
121
|
-
describe('and the array is not empty', () => {
|
122
|
-
describe('and the array is not an array of strings', () => {
|
123
|
-
it('throws', () => {
|
124
|
-
chai_1.assert.throws(() => {
|
125
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: ['a', 1] });
|
126
|
-
}, /`runOnly` array must contain only strings./i);
|
127
|
-
});
|
128
|
-
});
|
129
|
-
describe('and the array is an array of strings', () => {
|
130
|
-
it('does not throw', () => {
|
131
|
-
chai_1.assert.doesNotThrow(() => {
|
132
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: ['a, b'] });
|
133
|
-
});
|
134
|
-
});
|
135
|
-
});
|
136
|
-
});
|
137
|
-
});
|
138
|
-
describe('when `runOnly` is not a string, array or object', () => {
|
139
|
-
it('throws', () => {
|
140
|
-
chai_1.assert.throws(() => {
|
141
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: 1 });
|
142
|
-
}, /`runOnly` property must be an object, an array, or a string./i);
|
143
|
-
});
|
144
|
-
});
|
145
|
-
describe('when `runOnly` is an object', () => {
|
146
|
-
describe('and the object has no `type` property', () => {
|
147
|
-
it('throws', () => {
|
148
|
-
chai_1.assert.throws(() => {
|
149
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: {} });
|
150
|
-
}, /`runOnly` object must contain a `type` property./i);
|
151
|
-
});
|
152
|
-
});
|
153
|
-
describe('and the object has no `values` property', () => {
|
154
|
-
it('throws', () => {
|
155
|
-
chai_1.assert.throws(() => {
|
156
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: { type: 'rule' } });
|
157
|
-
}, /`runOnly` object must contain a `values` property./i);
|
158
|
-
});
|
159
|
-
});
|
160
|
-
describe('and the object has an invalid `type` property', () => {
|
161
|
-
it('throws', () => {
|
162
|
-
chai_1.assert.throws(() => {
|
163
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: { type: 'a', values: ['a'] } });
|
164
|
-
}, /`runOnly` object's `type` property must be one of the following:/i);
|
165
|
-
});
|
166
|
-
});
|
167
|
-
describe('and the object has a valid `type` property', () => {
|
168
|
-
describe('and the `values` property is not an array', () => {
|
169
|
-
it('throws', () => {
|
170
|
-
chai_1.assert.throws(() => {
|
171
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: { type: 'rule', values: 'a' } });
|
172
|
-
}, /`runOnly` object's `values` property must be an array./i);
|
173
|
-
});
|
174
|
-
});
|
175
|
-
describe('and the `values` property is an empty array', () => {
|
176
|
-
it('throws', () => {
|
177
|
-
chai_1.assert.throws(() => {
|
178
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({ runOnly: { type: 'rule', values: [] } });
|
179
|
-
}, /`runOnly` object's `values` property must contain at least one value./i);
|
180
|
-
});
|
181
|
-
});
|
182
|
-
describe('and the `values` property is an array of non-strings', () => {
|
183
|
-
it('throws', () => {
|
184
|
-
chai_1.assert.throws(() => {
|
185
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({
|
186
|
-
runOnly: { type: 'rule', values: ['a', 1] }
|
187
|
-
});
|
188
|
-
}, /`runOnly` object's `values` property must contain only strings./i);
|
189
|
-
});
|
190
|
-
});
|
191
|
-
describe('and the `values` property is an array of strings', () => {
|
192
|
-
it('does not throw', () => {
|
193
|
-
chai_1.assert.doesNotThrow(() => {
|
194
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({
|
195
|
-
runOnly: { type: 'rule', values: ['a', 'b'] }
|
196
|
-
});
|
197
|
-
});
|
198
|
-
});
|
199
|
-
});
|
200
|
-
});
|
201
|
-
});
|
202
|
-
});
|
203
|
-
describe('given a valid `runOnly` object', () => {
|
204
|
-
it('does not throw', () => {
|
205
|
-
chai_1.assert.doesNotThrow(() => {
|
206
|
-
(0, validateAxeRunOptions_1.validateAxeRunOptions)({
|
207
|
-
runOnly: { type: 'rule', values: ['ruleId1'] },
|
208
|
-
ancestry: true,
|
209
|
-
rules: { a: { enabled: true } }
|
210
|
-
});
|
211
|
-
});
|
212
|
-
});
|
213
|
-
});
|
214
|
-
});
|
215
|
-
//# sourceMappingURL=validateAxeRunOptions.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"validateAxeRunOptions.test.js","sourceRoot":"","sources":["../../src/utils/validateAxeRunOptions.test.ts"],"names":[],"mappings":";;AAAA,iBAAc;AACd,+BAA6B;AAC7B,mEAA+D;AAE/D,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;YACxB,aAAM,CAAC,YAAY,CAAC,GAAG,EAAE;gBACvB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AC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
import 'mocha';
|
@@ -1,200 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
-
};
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
require("mocha");
|
30
|
-
const chai_1 = require("chai");
|
31
|
-
const sinon_1 = __importDefault(require("sinon"));
|
32
|
-
const fs_1 = __importDefault(require("fs"));
|
33
|
-
const git = __importStar(require("../git"));
|
34
|
-
const initializeSessionImp = __importStar(require("./initializeSession"));
|
35
|
-
const writeVariables_1 = __importDefault(require("./writeVariables"));
|
36
|
-
describe('writeVariables', () => {
|
37
|
-
beforeEach(() => {
|
38
|
-
sinon_1.default.stub(initializeSessionImp, 'default').returns('123');
|
39
|
-
});
|
40
|
-
afterEach(() => {
|
41
|
-
sinon_1.default.restore();
|
42
|
-
});
|
43
|
-
describe('given `sessionId` variable', () => {
|
44
|
-
describe('when provided', () => {
|
45
|
-
it('should write to variables.json', () => {
|
46
|
-
const gitStub = sinon_1.default.stub(git);
|
47
|
-
gitStub.getBranchName.returns('main');
|
48
|
-
gitStub.getDefaultBranchName.returns('main');
|
49
|
-
gitStub.getRemoteURL.returns('url');
|
50
|
-
gitStub.isRepository.returns(true);
|
51
|
-
gitStub.isDirty.returns(false);
|
52
|
-
gitStub.getTag.returns(null);
|
53
|
-
gitStub.getCommitInfo.returns({
|
54
|
-
message: 'message',
|
55
|
-
author: 'author',
|
56
|
-
email: 'email',
|
57
|
-
hash: 'hash'
|
58
|
-
});
|
59
|
-
const writeFileSync = sinon_1.default.stub(fs_1.default, 'writeFileSync');
|
60
|
-
(0, writeVariables_1.default)({
|
61
|
-
apiKey: 'abc',
|
62
|
-
serverURL: 'http://localhost:3000/',
|
63
|
-
sessionId: '123',
|
64
|
-
takeScreenshots: true,
|
65
|
-
experimentalAdvancedRules: true
|
66
|
-
});
|
67
|
-
chai_1.assert.isTrue(writeFileSync.calledOnce);
|
68
|
-
const stored = JSON.parse(writeFileSync.args[0][1]);
|
69
|
-
chai_1.assert.deepEqual(stored, {
|
70
|
-
api_key: 'abc',
|
71
|
-
server_url: 'http://localhost:3000/',
|
72
|
-
auto_analyze: true,
|
73
|
-
session_id: '123',
|
74
|
-
cypress: false,
|
75
|
-
take_screenshots: true,
|
76
|
-
experimental_advanced_rules: true,
|
77
|
-
run_context: null,
|
78
|
-
run_options: null,
|
79
|
-
exclude_url_patterns: null,
|
80
|
-
git_data: {
|
81
|
-
git_branch: 'main',
|
82
|
-
git_default_branch: 'main',
|
83
|
-
git_url: 'url',
|
84
|
-
git_tag: null,
|
85
|
-
git_commit_message: 'message',
|
86
|
-
git_commit_author: 'author',
|
87
|
-
git_commit_email: 'email',
|
88
|
-
git_commit_sha: 'hash',
|
89
|
-
git_is_dirty: false
|
90
|
-
}
|
91
|
-
});
|
92
|
-
});
|
93
|
-
});
|
94
|
-
describe('when not provided', () => {
|
95
|
-
it('creates a session ID and writes it to variables.json', () => {
|
96
|
-
const writeFileSync = sinon_1.default.stub(fs_1.default, 'writeFileSync');
|
97
|
-
(0, writeVariables_1.default)({
|
98
|
-
apiKey: 'abc'
|
99
|
-
});
|
100
|
-
chai_1.assert.isTrue(writeFileSync.calledOnce);
|
101
|
-
const variables = JSON.parse(writeFileSync.args[0][1]);
|
102
|
-
chai_1.assert.exists(variables.session_id);
|
103
|
-
});
|
104
|
-
});
|
105
|
-
});
|
106
|
-
describe(`runContext`, () => {
|
107
|
-
describe('when provided', () => {
|
108
|
-
it('should write to variables.json', () => {
|
109
|
-
const writeFileSync = sinon_1.default.stub(fs_1.default, 'writeFileSync');
|
110
|
-
(0, writeVariables_1.default)({
|
111
|
-
apiKey: 'abc',
|
112
|
-
runContext: { include: 'foo', exclude: 'bar' }
|
113
|
-
});
|
114
|
-
const stored = JSON.parse(writeFileSync.args[0][1]);
|
115
|
-
const runContext = stored.run_context;
|
116
|
-
chai_1.assert.isDefined(runContext);
|
117
|
-
chai_1.assert.deepEqual(runContext, { include: 'foo', exclude: 'bar' });
|
118
|
-
});
|
119
|
-
});
|
120
|
-
describe('when not provided', () => {
|
121
|
-
it('should not write to variables.json', () => {
|
122
|
-
const writeFileSync = sinon_1.default.stub(fs_1.default, 'writeFileSync');
|
123
|
-
(0, writeVariables_1.default)({
|
124
|
-
apiKey: 'abc'
|
125
|
-
});
|
126
|
-
const stored = JSON.parse(writeFileSync.args[0][1]);
|
127
|
-
chai_1.assert.isNull(stored.run_context);
|
128
|
-
});
|
129
|
-
});
|
130
|
-
});
|
131
|
-
describe(`runOptions`, () => {
|
132
|
-
describe('when provided', () => {
|
133
|
-
it('should write to variables.json', () => {
|
134
|
-
const writeFileSync = sinon_1.default.stub(fs_1.default, 'writeFileSync');
|
135
|
-
(0, writeVariables_1.default)({
|
136
|
-
apiKey: 'abc',
|
137
|
-
runOptions: {
|
138
|
-
ancestry: true,
|
139
|
-
rules: { 'color-contrast': { enabled: false } },
|
140
|
-
runOnly: { type: 'rules', values: ['color-contrast'] }
|
141
|
-
}
|
142
|
-
});
|
143
|
-
const stored = JSON.parse(writeFileSync.args[0][1]);
|
144
|
-
const runOptions = stored.run_options;
|
145
|
-
chai_1.assert.isDefined(runOptions);
|
146
|
-
chai_1.assert.deepEqual(runOptions, {
|
147
|
-
ancestry: true,
|
148
|
-
rules: { 'color-contrast': { enabled: false } },
|
149
|
-
runOnly: { type: 'rules', values: ['color-contrast'] }
|
150
|
-
});
|
151
|
-
});
|
152
|
-
});
|
153
|
-
describe('when not provided', () => {
|
154
|
-
it('should not write to variables.json', () => {
|
155
|
-
const writeFileSync = sinon_1.default.stub(fs_1.default, 'writeFileSync');
|
156
|
-
(0, writeVariables_1.default)({
|
157
|
-
apiKey: 'abc'
|
158
|
-
});
|
159
|
-
const stored = JSON.parse(writeFileSync.args[0][1]);
|
160
|
-
chai_1.assert.isNull(stored.run_options);
|
161
|
-
});
|
162
|
-
});
|
163
|
-
});
|
164
|
-
describe(`excludeUrlPatterns`, () => {
|
165
|
-
describe('when provided', () => {
|
166
|
-
it('should write to variables.json', () => {
|
167
|
-
const writeFileSync = sinon_1.default.stub(fs_1.default, 'writeFileSync');
|
168
|
-
(0, writeVariables_1.default)({
|
169
|
-
apiKey: 'abc',
|
170
|
-
excludeUrlPatterns: ['foo', 'bar']
|
171
|
-
});
|
172
|
-
const stored = JSON.parse(writeFileSync.args[0][1]);
|
173
|
-
const excludeUrlPatterns = stored.exclude_url_patterns;
|
174
|
-
chai_1.assert.isDefined(excludeUrlPatterns);
|
175
|
-
chai_1.assert.deepEqual(excludeUrlPatterns, ['foo', 'bar']);
|
176
|
-
});
|
177
|
-
});
|
178
|
-
describe('when not provided', () => {
|
179
|
-
it('should not write to variables.json', () => {
|
180
|
-
const writeFileSync = sinon_1.default.stub(fs_1.default, 'writeFileSync');
|
181
|
-
(0, writeVariables_1.default)({
|
182
|
-
apiKey: 'abc'
|
183
|
-
});
|
184
|
-
const stored = JSON.parse(writeFileSync.args[0][1]);
|
185
|
-
chai_1.assert.isNull(stored.exclude_url_patterns);
|
186
|
-
});
|
187
|
-
});
|
188
|
-
describe('throws when invalid', () => {
|
189
|
-
it('should throw', () => {
|
190
|
-
chai_1.assert.throws(() => {
|
191
|
-
(0, writeVariables_1.default)({
|
192
|
-
apiKey: 'abc',
|
193
|
-
excludeUrlPatterns: ['foo', 'bar', 1]
|
194
|
-
});
|
195
|
-
});
|
196
|
-
});
|
197
|
-
});
|
198
|
-
});
|
199
|
-
});
|
200
|
-
//# sourceMappingURL=writeVariables.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"writeVariables.test.js","sourceRoot":"","sources":["../../src/utils/writeVariables.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBAAc;AACd,+BAA6B;AAC7B,kDAAyB;AACzB,4CAAmB;AACnB,4CAA6B;AAC7B,0EAA2D;AAC3D,sEAAiE;AAEjE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,UAAU,CAAC,GAAG,EAAE;QACd,eAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,eAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAC1C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;YAC7B,EAAE,CAAC,gCAAgC,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