cypress 4.4.1 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +15 -6
- package/lib/cli.js +56 -53
- package/lib/cypress.js +8 -9
- package/lib/errors.js +216 -84
- package/lib/exec/info.js +17 -13
- package/lib/exec/open.js +4 -1
- package/lib/exec/run.js +20 -24
- package/lib/exec/spawn.js +56 -53
- package/lib/exec/versions.js +9 -6
- package/lib/exec/xvfb.js +29 -27
- package/lib/fs.js +1 -1
- package/lib/logger.js +16 -12
- package/lib/tasks/cache.js +11 -12
- package/lib/tasks/download.js +100 -73
- package/lib/tasks/install.js +125 -73
- package/lib/tasks/state.js +35 -19
- package/lib/tasks/unzip.js +38 -44
- package/lib/tasks/verify.js +101 -64
- package/lib/util.js +112 -107
- package/package.json +1 -1
package/lib/errors.js
CHANGED
@@ -1,23 +1,166 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _templateObject16() {
|
4
|
+
var data = _taggedTemplateLiteral(["\n To skip the binary install, set CYPRESS_INSTALL_BINARY=0\n "]);
|
5
|
+
|
6
|
+
_templateObject16 = function _templateObject16() {
|
7
|
+
return data;
|
8
|
+
};
|
9
|
+
|
10
|
+
return data;
|
11
|
+
}
|
12
|
+
|
13
|
+
function _templateObject15() {
|
14
|
+
var data = _taggedTemplateLiteral(["\n The environment variable CYPRESS_SKIP_BINARY_INSTALL has been removed as of version ", "\n "]);
|
15
|
+
|
16
|
+
_templateObject15 = function _templateObject15() {
|
17
|
+
return data;
|
18
|
+
};
|
19
|
+
|
20
|
+
return data;
|
21
|
+
}
|
22
|
+
|
23
|
+
function _templateObject14() {
|
24
|
+
var data = _taggedTemplateLiteral(["\n You should set CYPRESS_INSTALL_BINARY instead.\n "]);
|
25
|
+
|
26
|
+
_templateObject14 = function _templateObject14() {
|
27
|
+
return data;
|
28
|
+
};
|
29
|
+
|
30
|
+
return data;
|
31
|
+
}
|
32
|
+
|
33
|
+
function _templateObject13() {
|
34
|
+
var data = _taggedTemplateLiteral(["\n The environment variable CYPRESS_BINARY_VERSION has been renamed to CYPRESS_INSTALL_BINARY as of version ", "\n "]);
|
35
|
+
|
36
|
+
_templateObject13 = function _templateObject13() {
|
37
|
+
return data;
|
38
|
+
};
|
39
|
+
|
40
|
+
return data;
|
41
|
+
}
|
42
|
+
|
43
|
+
function _templateObject12() {
|
44
|
+
var data = _taggedTemplateLiteral(["\n Please search Cypress documentation for possible solutions:\n\n ", "\n\n Check if there is a GitHub issue describing this crash:\n\n ", "\n\n Consider opening a new issue.\n"]);
|
45
|
+
|
46
|
+
_templateObject12 = function _templateObject12() {
|
47
|
+
return data;
|
48
|
+
};
|
49
|
+
|
50
|
+
return data;
|
51
|
+
}
|
52
|
+
|
53
|
+
function _templateObject11() {
|
54
|
+
var data = _taggedTemplateLiteral(["\n See discussion and possible solutions at\n ", "\n "]);
|
55
|
+
|
56
|
+
_templateObject11 = function _templateObject11() {
|
57
|
+
return data;
|
58
|
+
};
|
59
|
+
|
60
|
+
return data;
|
61
|
+
}
|
62
|
+
|
63
|
+
function _templateObject10() {
|
64
|
+
var data = _taggedTemplateLiteral(["\n This is usually caused by a missing library or dependency.\n\n The error below should indicate which dependency is missing.\n\n ", "\n\n If you are using Docker, we provide containers with all required dependencies installed.\n "]);
|
65
|
+
|
66
|
+
_templateObject10 = function _templateObject10() {
|
67
|
+
return data;
|
68
|
+
};
|
69
|
+
|
70
|
+
return data;
|
71
|
+
}
|
72
|
+
|
73
|
+
function _templateObject9() {
|
74
|
+
var data = _taggedTemplateLiteral(["\n Cypress failed to start after spawning a new Xvfb server.\n\n The error logs we received were:\n\n ", "\n\n ", "\n\n ", "\n\n This is usually caused by a missing library or dependency.\n\n The error above should indicate which dependency is missing.\n\n ", "\n\n If you are using Docker, we provide containers with all required dependencies installed.\n "]);
|
75
|
+
|
76
|
+
_templateObject9 = function _templateObject9() {
|
77
|
+
return data;
|
78
|
+
};
|
79
|
+
|
80
|
+
return data;
|
81
|
+
}
|
82
|
+
|
83
|
+
function _templateObject8() {
|
84
|
+
var data = _taggedTemplateLiteral(["\n This command failed with the following output:\n\n ", "\n\n "]);
|
85
|
+
|
86
|
+
_templateObject8 = function _templateObject8() {
|
87
|
+
return data;
|
88
|
+
};
|
89
|
+
|
90
|
+
return data;
|
91
|
+
}
|
92
|
+
|
93
|
+
function _templateObject7() {
|
94
|
+
var data = _taggedTemplateLiteral(["\n Install Xvfb and run Cypress again.\n\n Read our documentation on dependencies for more information:\n\n ", "\n\n If you are using Docker, we provide containers with all required dependencies installed.\n "]);
|
95
|
+
|
96
|
+
_templateObject7 = function _templateObject7() {
|
97
|
+
return data;
|
98
|
+
};
|
99
|
+
|
100
|
+
return data;
|
101
|
+
}
|
102
|
+
|
103
|
+
function _templateObject6() {
|
104
|
+
var data = _taggedTemplateLiteral(["\n There was a problem spawning Xvfb.\n\n This is likely a problem with your system, permissions, or installation of Xvfb.\n "]);
|
105
|
+
|
106
|
+
_templateObject6 = function _templateObject6() {
|
107
|
+
return data;
|
108
|
+
};
|
109
|
+
|
110
|
+
return data;
|
111
|
+
}
|
112
|
+
|
113
|
+
function _templateObject5() {
|
114
|
+
var data = _taggedTemplateLiteral(["\n\n We expected the binary to be installed here: ", "\n\n Reasons it may be missing:\n\n - You're caching 'node_modules' but are not caching this path: ", "\n - You ran 'npm install' at an earlier build step but did not persist: ", "\n\n Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.\n\n Alternatively, you can run 'cypress install' to download the binary again.\n\n ", "\n "], ["\\n\n We expected the binary to be installed here: ", "\n\n Reasons it may be missing:\n\n - You're caching 'node_modules' but are not caching this path: ", "\n - You ran 'npm install' at an earlier build step but did not persist: ", "\n\n Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.\n\n Alternatively, you can run 'cypress install' to download the binary again.\n\n ", "\n "]);
|
115
|
+
|
116
|
+
_templateObject5 = function _templateObject5() {
|
117
|
+
return data;
|
118
|
+
};
|
119
|
+
|
120
|
+
return data;
|
121
|
+
}
|
122
|
+
|
123
|
+
function _templateObject4() {
|
124
|
+
var data = _taggedTemplateLiteral(["\n\n Reasons this may happen:\n\n - node was installed as 'root' or with 'sudo'\n - the cypress npm package as 'root' or with 'sudo'\n\n Please check that you have the appropriate user permissions.\n "], ["\\n\n Reasons this may happen:\n\n - node was installed as 'root' or with 'sudo'\n - the cypress npm package as 'root' or with 'sudo'\n\n Please check that you have the appropriate user permissions.\n "]);
|
125
|
+
|
126
|
+
_templateObject4 = function _templateObject4() {
|
127
|
+
return data;
|
128
|
+
};
|
129
|
+
|
130
|
+
return data;
|
131
|
+
}
|
132
|
+
|
133
|
+
function _templateObject3() {
|
134
|
+
var data = _taggedTemplateLiteral(["\n \nPlease reinstall Cypress by running: ", "\n "], ["\n \\nPlease reinstall Cypress by running: ", "\n "]);
|
135
|
+
|
136
|
+
_templateObject3 = function _templateObject3() {
|
137
|
+
return data;
|
138
|
+
};
|
139
|
+
|
140
|
+
return data;
|
141
|
+
}
|
142
|
+
|
143
|
+
function _templateObject2() {
|
144
|
+
var data = _taggedTemplateLiteral(["\n Search for an existing issue or open a GitHub issue at\n\n ", "\n "]);
|
145
|
+
|
146
|
+
_templateObject2 = function _templateObject2() {
|
147
|
+
return data;
|
148
|
+
};
|
149
|
+
|
150
|
+
return data;
|
151
|
+
}
|
152
|
+
|
153
|
+
function _templateObject() {
|
154
|
+
var data = _taggedTemplateLiteral(["\n Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration\n\n Otherwise, please check network connectivity and try again:"]);
|
155
|
+
|
156
|
+
_templateObject = function _templateObject() {
|
157
|
+
return data;
|
158
|
+
};
|
159
|
+
|
160
|
+
return data;
|
161
|
+
}
|
162
|
+
|
163
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
21
164
|
|
22
165
|
var chalk = require('chalk');
|
23
166
|
|
@@ -29,65 +172,62 @@ var _require2 = require('ramda'),
|
|
29
172
|
merge = _require2.merge;
|
30
173
|
|
31
174
|
var la = require('lazy-ass');
|
175
|
+
|
32
176
|
var is = require('check-more-types');
|
33
177
|
|
34
178
|
var util = require('./util');
|
179
|
+
|
35
180
|
var state = require('./tasks/state');
|
36
181
|
|
37
182
|
var docsUrl = 'https://on.cypress.io';
|
38
|
-
var requiredDependenciesUrl = docsUrl
|
39
|
-
|
40
|
-
// TODO it would be nice if all error objects could be enforced via types
|
183
|
+
var requiredDependenciesUrl = "".concat(docsUrl, "/required-dependencies"); // TODO it would be nice if all error objects could be enforced via types
|
41
184
|
// to only have description + solution properties
|
42
185
|
|
43
|
-
var hr = '----------';
|
186
|
+
var hr = '----------'; // common errors Cypress application can encounter
|
44
187
|
|
45
|
-
// common errors Cypress application can encounter
|
46
188
|
var failedDownload = {
|
47
189
|
description: 'The Cypress App could not be downloaded.',
|
48
|
-
solution: stripIndent(_templateObject)
|
190
|
+
solution: stripIndent(_templateObject())
|
49
191
|
};
|
50
|
-
|
51
192
|
var failedUnzip = {
|
52
193
|
description: 'The Cypress App could not be unzipped.',
|
53
|
-
solution: stripIndent(_templateObject2, chalk.blue(util.issuesUrl))
|
194
|
+
solution: stripIndent(_templateObject2(), chalk.blue(util.issuesUrl))
|
54
195
|
};
|
55
196
|
|
56
197
|
var missingApp = function missingApp(binaryDir) {
|
57
198
|
return {
|
58
|
-
description:
|
59
|
-
solution: stripIndent(_templateObject3, chalk.cyan('cypress install'))
|
199
|
+
description: "No version of Cypress is installed in: ".concat(chalk.cyan(binaryDir)),
|
200
|
+
solution: stripIndent(_templateObject3(), chalk.cyan('cypress install'))
|
60
201
|
};
|
61
202
|
};
|
62
203
|
|
63
204
|
var binaryNotExecutable = function binaryNotExecutable(executable) {
|
64
205
|
return {
|
65
|
-
description:
|
66
|
-
solution: stripIndent(_templateObject4)
|
206
|
+
description: "Cypress cannot run because this binary file does not have executable permissions here:\n\n".concat(executable),
|
207
|
+
solution: stripIndent(_templateObject4())
|
67
208
|
};
|
68
209
|
};
|
69
210
|
|
70
211
|
var notInstalledCI = function notInstalledCI(executable) {
|
71
212
|
return {
|
72
213
|
description: 'The cypress npm package is installed, but the Cypress binary is missing.',
|
73
|
-
solution: stripIndent(_templateObject5, chalk.cyan(executable), util.getCacheDir(), util.getCacheDir(), chalk.blue('https://on.cypress.io/not-installed-ci-error'))
|
214
|
+
solution: stripIndent(_templateObject5(), chalk.cyan(executable), util.getCacheDir(), util.getCacheDir(), chalk.blue('https://on.cypress.io/not-installed-ci-error'))
|
74
215
|
};
|
75
216
|
};
|
76
217
|
|
77
218
|
var nonZeroExitCodeXvfb = {
|
78
219
|
description: 'Xvfb exited with a non zero exit code.',
|
79
|
-
solution: stripIndent(_templateObject6)
|
220
|
+
solution: stripIndent(_templateObject6())
|
80
221
|
};
|
81
|
-
|
82
222
|
var missingXvfb = {
|
83
223
|
description: 'Your system is missing the dependency: Xvfb',
|
84
|
-
solution: stripIndent(_templateObject7, chalk.blue(requiredDependenciesUrl))
|
224
|
+
solution: stripIndent(_templateObject7(), chalk.blue(requiredDependenciesUrl))
|
85
225
|
};
|
86
226
|
|
87
227
|
var smokeTestFailure = function smokeTestFailure(smokeTestCommand, timedOut) {
|
88
228
|
return {
|
89
|
-
description:
|
90
|
-
solution: stripIndent(_templateObject8, smokeTestCommand)
|
229
|
+
description: "Cypress verification ".concat(timedOut ? 'timed out' : 'failed', "."),
|
230
|
+
solution: stripIndent(_templateObject8(), smokeTestCommand)
|
91
231
|
};
|
92
232
|
};
|
93
233
|
|
@@ -95,84 +235,78 @@ var invalidSmokeTestDisplayError = {
|
|
95
235
|
code: 'INVALID_SMOKE_TEST_DISPLAY_ERROR',
|
96
236
|
description: 'Cypress verification failed.',
|
97
237
|
solution: function solution(msg) {
|
98
|
-
return stripIndent(_templateObject9, hr, msg, hr, chalk.blue(requiredDependenciesUrl));
|
238
|
+
return stripIndent(_templateObject9(), hr, msg, hr, chalk.blue(requiredDependenciesUrl));
|
99
239
|
}
|
100
240
|
};
|
101
|
-
|
102
241
|
var missingDependency = {
|
103
242
|
description: 'Cypress failed to start.',
|
104
243
|
// this message is too Linux specific
|
105
|
-
solution: stripIndent(_templateObject10, chalk.blue(requiredDependenciesUrl))
|
244
|
+
solution: stripIndent(_templateObject10(), chalk.blue(requiredDependenciesUrl))
|
106
245
|
};
|
107
|
-
|
108
246
|
var invalidCacheDirectory = {
|
109
247
|
description: 'Cypress cannot write to the cache directory due to file permissions',
|
110
|
-
solution: stripIndent(_templateObject11, chalk.blue(util.getGitHubIssueUrl(1281)))
|
248
|
+
solution: stripIndent(_templateObject11(), chalk.blue(util.getGitHubIssueUrl(1281)))
|
111
249
|
};
|
112
|
-
|
113
250
|
var versionMismatch = {
|
114
251
|
description: 'Installed version does not match package version.',
|
115
252
|
solution: 'Install Cypress and verify app again'
|
116
253
|
};
|
117
|
-
|
118
254
|
var incompatibleHeadlessFlags = {
|
119
255
|
description: '`--headed` and `--headless` cannot both be passed.',
|
120
256
|
solution: 'Either pass `--headed` or `--headless`, but not both.'
|
121
257
|
};
|
122
|
-
|
123
|
-
var solutionUnknown = stripIndent(_templateObject12, chalk.blue(docsUrl), chalk.blue(util.issuesUrl));
|
258
|
+
var solutionUnknown = stripIndent(_templateObject12(), chalk.blue(docsUrl), chalk.blue(util.issuesUrl));
|
124
259
|
var unexpected = {
|
125
260
|
description: 'An unexpected error occurred while verifying the Cypress executable.',
|
126
261
|
solution: solutionUnknown
|
127
262
|
};
|
128
|
-
|
129
263
|
var invalidCypressEnv = {
|
130
264
|
description: chalk.red('The environment variable with the reserved name "CYPRESS_INTERNAL_ENV" is set.'),
|
131
265
|
solution: chalk.red('Unset the "CYPRESS_INTERNAL_ENV" environment variable and run Cypress again.'),
|
132
266
|
exitCode: 11
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
267
|
+
};
|
268
|
+
/**
|
269
|
+
* This error happens when CLI detects that the child Test Runner process
|
270
|
+
* was killed with a signal, like SIGBUS
|
271
|
+
* @see https://github.com/cypress-io/cypress/issues/5808
|
272
|
+
* @param {'close'|'event'} eventName Child close event name
|
273
|
+
* @param {string} signal Signal that closed the child process, like "SIGBUS"
|
274
|
+
*/
|
275
|
+
|
276
|
+
var childProcessKilled = function childProcessKilled(eventName, signal) {
|
142
277
|
return {
|
143
|
-
description:
|
278
|
+
description: "The Test Runner unexpectedly exited via a ".concat(chalk.cyan(eventName), " event with signal ").concat(chalk.cyan(signal)),
|
144
279
|
solution: solutionUnknown
|
145
280
|
};
|
146
281
|
};
|
147
282
|
|
148
283
|
var removed = {
|
149
284
|
CYPRESS_BINARY_VERSION: {
|
150
|
-
description: stripIndent(_templateObject13, chalk.green('3.0.0')),
|
151
|
-
solution: stripIndent(_templateObject14)
|
285
|
+
description: stripIndent(_templateObject13(), chalk.green('3.0.0')),
|
286
|
+
solution: stripIndent(_templateObject14())
|
152
287
|
},
|
153
288
|
CYPRESS_SKIP_BINARY_INSTALL: {
|
154
|
-
description: stripIndent(_templateObject15, chalk.green('3.0.0')),
|
155
|
-
solution: stripIndent(_templateObject16)
|
289
|
+
description: stripIndent(_templateObject15(), chalk.green('3.0.0')),
|
290
|
+
solution: stripIndent(_templateObject16())
|
156
291
|
}
|
157
292
|
};
|
158
|
-
|
159
293
|
var CYPRESS_RUN_BINARY = {
|
160
294
|
notValid: function notValid(value) {
|
161
|
-
var properFormat =
|
162
|
-
|
295
|
+
var properFormat = "**/".concat(state.getPlatformExecutable());
|
163
296
|
return {
|
164
|
-
description:
|
165
|
-
solution:
|
297
|
+
description: "Could not run binary set by environment variable: CYPRESS_RUN_BINARY=".concat(value),
|
298
|
+
solution: "Ensure the environment variable is a path to the Cypress binary, matching ".concat(properFormat)
|
166
299
|
};
|
167
300
|
}
|
168
301
|
};
|
169
302
|
|
170
303
|
function addPlatformInformation(info) {
|
171
304
|
return util.getPlatformInfo().then(function (platform) {
|
172
|
-
return merge(info, {
|
305
|
+
return merge(info, {
|
306
|
+
platform: platform
|
307
|
+
});
|
173
308
|
});
|
174
309
|
}
|
175
|
-
|
176
310
|
/**
|
177
311
|
* Given an error object (see the errors above), forms error message text with details,
|
178
312
|
* then resolves with Error instance you can throw or reject with.
|
@@ -185,20 +319,21 @@ function addPlatformInformation(info) {
|
|
185
319
|
return getError(errorObject).then(reject)
|
186
320
|
```
|
187
321
|
*/
|
322
|
+
|
323
|
+
|
188
324
|
function getError(errorObject) {
|
189
325
|
return formErrorText(errorObject).then(function (errorMessage) {
|
190
326
|
var err = new Error(errorMessage);
|
191
|
-
|
192
327
|
err.known = true;
|
193
|
-
|
194
328
|
return err;
|
195
329
|
});
|
196
330
|
}
|
197
|
-
|
198
331
|
/**
|
199
332
|
* Forms nice error message with error and platform information,
|
200
333
|
* and if possible a way to solve it. Resolves with a string.
|
201
334
|
*/
|
335
|
+
|
336
|
+
|
202
337
|
function formErrorText(info, msg, prevMessage) {
|
203
338
|
return addPlatformInformation(info).then(function (obj) {
|
204
339
|
var formatted = [];
|
@@ -207,30 +342,26 @@ function formErrorText(info, msg, prevMessage) {
|
|
207
342
|
formatted.push(stripIndents(msg));
|
208
343
|
}
|
209
344
|
|
210
|
-
la(is.unemptyString(obj.description), 'expected error description to be text', obj.description);
|
211
|
-
|
212
|
-
// assuming that if there the solution is a function it will handle
|
345
|
+
la(is.unemptyString(obj.description), 'expected error description to be text', obj.description); // assuming that if there the solution is a function it will handle
|
213
346
|
// error message and (optional previous error message)
|
347
|
+
|
214
348
|
if (is.fn(obj.solution)) {
|
215
349
|
var text = obj.solution(msg, prevMessage);
|
216
|
-
|
217
350
|
la(is.unemptyString(text), 'expected solution to be text', text);
|
218
|
-
|
219
|
-
add('\n ' + obj.description + '\n\n ' + text + '\n\n ');
|
351
|
+
add("\n ".concat(obj.description, "\n\n ").concat(text, "\n\n "));
|
220
352
|
} else {
|
221
353
|
la(is.unemptyString(obj.solution), 'expected error solution to be text', obj.solution);
|
222
|
-
|
223
|
-
add('\n ' + obj.description + '\n\n ' + obj.solution + '\n\n ');
|
354
|
+
add("\n ".concat(obj.description, "\n\n ").concat(obj.solution, "\n\n "));
|
224
355
|
|
225
356
|
if (msg) {
|
226
|
-
add(
|
357
|
+
add("\n ".concat(hr, "\n\n ").concat(msg, "\n\n "));
|
227
358
|
}
|
228
359
|
}
|
229
360
|
|
230
|
-
add(
|
361
|
+
add("\n ".concat(hr, "\n\n ").concat(obj.platform, "\n "));
|
231
362
|
|
232
363
|
if (obj.footer) {
|
233
|
-
add(
|
364
|
+
add("\n\n ".concat(hr, "\n\n ").concat(obj.footer, "\n "));
|
234
365
|
}
|
235
366
|
|
236
367
|
return formatted.join('\n\n');
|
@@ -255,13 +386,14 @@ var throwFormErrorText = function throwFormErrorText(info) {
|
|
255
386
|
return formErrorText(info, msg, prevMessage).then(raise(info));
|
256
387
|
};
|
257
388
|
};
|
258
|
-
|
259
389
|
/**
|
260
390
|
* Forms full error message with error and OS details, prints to the error output
|
261
391
|
* and then exits the process.
|
262
392
|
* @param {ErrorInformation} info Error information {description, solution}
|
263
393
|
* @example return exitWithError(errors.invalidCypressEnv)('foo')
|
264
394
|
*/
|
395
|
+
|
396
|
+
|
265
397
|
var exitWithError = function exitWithError(info) {
|
266
398
|
return function (msg) {
|
267
399
|
return formErrorText(info, msg).then(function (text) {
|
package/lib/exec/info.js
CHANGED
@@ -1,23 +1,29 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
/* eslint-disable no-console */
|
4
4
|
var spawn = require('./spawn');
|
5
|
+
|
5
6
|
var util = require('../util');
|
7
|
+
|
6
8
|
var state = require('../tasks/state');
|
9
|
+
|
7
10
|
var os = require('os');
|
11
|
+
|
8
12
|
var chalk = require('chalk');
|
13
|
+
|
9
14
|
var prettyBytes = require('pretty-bytes');
|
15
|
+
|
10
16
|
var _ = require('lodash');
|
11
|
-
var R = require('ramda');
|
12
17
|
|
13
|
-
// color for numbers and show values
|
14
|
-
|
15
|
-
|
16
|
-
var
|
17
|
-
|
18
|
-
var
|
18
|
+
var R = require('ramda'); // color for numbers and show values
|
19
|
+
|
20
|
+
|
21
|
+
var g = chalk.green; // color for paths
|
22
|
+
|
23
|
+
var p = chalk.cyan; // urls
|
24
|
+
|
25
|
+
var link = chalk.blue.underline; // to be exported
|
19
26
|
|
20
|
-
// to be exported
|
21
27
|
var methods = {};
|
22
28
|
|
23
29
|
methods.findProxyEnvironmentVariables = function () {
|
@@ -38,15 +44,12 @@ methods.findCypressEnvironmentVariables = function () {
|
|
38
44
|
|
39
45
|
var formatCypressVariables = function formatCypressVariables() {
|
40
46
|
var vars = methods.findCypressEnvironmentVariables();
|
41
|
-
|
42
47
|
return maskSensitiveVariables(vars);
|
43
48
|
};
|
44
49
|
|
45
50
|
methods.start = function () {
|
46
51
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
47
|
-
|
48
52
|
var args = ['--mode=info'];
|
49
|
-
|
50
53
|
return spawn.start(args, {
|
51
54
|
dev: options.dev
|
52
55
|
}).then(function () {
|
@@ -57,6 +60,7 @@ methods.start = function () {
|
|
57
60
|
console.log('Proxy Settings: none detected');
|
58
61
|
} else {
|
59
62
|
console.log('Proxy Settings:');
|
63
|
+
|
60
64
|
_.forEach(proxyVars, function (value, key) {
|
61
65
|
console.log('%s: %s', key, g(value));
|
62
66
|
});
|
@@ -72,6 +76,7 @@ methods.start = function () {
|
|
72
76
|
console.log('Environment Variables: none detected');
|
73
77
|
} else {
|
74
78
|
console.log('Environment Variables:');
|
79
|
+
|
75
80
|
_.forEach(cyVars, function (value, key) {
|
76
81
|
console.log('%s: %s', key, g(value));
|
77
82
|
});
|
@@ -83,7 +88,6 @@ methods.start = function () {
|
|
83
88
|
console.log('Binary Caches: %s', p(state.getCacheDir()));
|
84
89
|
}).then(function () {
|
85
90
|
console.log();
|
86
|
-
|
87
91
|
return util.getOsVersionAsync().then(function (osVersion) {
|
88
92
|
console.log('Cypress Version: %s', g(util.pkgVersion()));
|
89
93
|
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion));
|
package/lib/exec/open.js
CHANGED
package/lib/exec/run.js
CHANGED
@@ -1,25 +1,24 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
var _ = require('lodash');
|
4
|
+
|
4
5
|
var debug = require('debug')('cypress:cli:run');
|
5
6
|
|
6
7
|
var util = require('../util');
|
8
|
+
|
7
9
|
var spawn = require('./spawn');
|
10
|
+
|
8
11
|
var verify = require('../tasks/verify');
|
9
12
|
|
10
13
|
var _require = require('../errors'),
|
11
14
|
exitWithError = _require.exitWithError,
|
12
|
-
errors = _require.errors;
|
13
|
-
|
14
|
-
// maps options collected by the CLI
|
15
|
+
errors = _require.errors; // maps options collected by the CLI
|
15
16
|
// and forms list of CLI arguments to the server
|
16
17
|
|
17
18
|
|
18
19
|
var processRunOptions = function processRunOptions() {
|
19
20
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
20
|
-
|
21
21
|
debug('processing run options %o', options);
|
22
|
-
|
23
22
|
var args = ['--run-project', options.project];
|
24
23
|
|
25
24
|
if (options.browser) {
|
@@ -28,9 +27,8 @@ var processRunOptions = function processRunOptions() {
|
|
28
27
|
|
29
28
|
if (options.ci) {
|
30
29
|
// push to display the deprecation message
|
31
|
-
args.push('--ci');
|
30
|
+
args.push('--ci'); // also automatically record
|
32
31
|
|
33
|
-
// also automatically record
|
34
32
|
args.push('--record', true);
|
35
33
|
}
|
36
34
|
|
@@ -67,21 +65,20 @@ var processRunOptions = function processRunOptions() {
|
|
67
65
|
// throw this error synchronously, it will be caught later on and
|
68
66
|
// the details will be propagated to the promise chain
|
69
67
|
var err = new Error();
|
70
|
-
|
71
68
|
err.details = errors.incompatibleHeadlessFlags;
|
72
69
|
throw err;
|
73
70
|
}
|
74
71
|
|
75
72
|
args.push('--headed', !options.headless);
|
76
|
-
}
|
73
|
+
} // if key is set use that - else attempt to find it by environment variable
|
74
|
+
|
77
75
|
|
78
|
-
// if key is set use that - else attempt to find it by environment variable
|
79
76
|
if (options.key == null) {
|
80
77
|
debug('--key is not set, looking up environment variable CYPRESS_RECORD_KEY');
|
81
78
|
options.key = util.getEnv('CYPRESS_RECORD_KEY') || util.getEnv('CYPRESS_CI_KEY');
|
82
|
-
}
|
79
|
+
} // if we have a key assume we're in record mode
|
80
|
+
|
83
81
|
|
84
|
-
// if we have a key assume we're in record mode
|
85
82
|
if (options.key) {
|
86
83
|
args.push('--key', options.key);
|
87
84
|
}
|
@@ -96,25 +93,25 @@ var processRunOptions = function processRunOptions() {
|
|
96
93
|
|
97
94
|
if (options.port) {
|
98
95
|
args.push('--port', options.port);
|
99
|
-
}
|
100
|
-
|
101
|
-
// if record is defined and we're not
|
96
|
+
} // if record is defined and we're not
|
102
97
|
// already in ci mode, then send it up
|
98
|
+
|
99
|
+
|
103
100
|
if (options.record != null && !options.ci) {
|
104
101
|
args.push('--record', options.record);
|
105
|
-
}
|
102
|
+
} // if we have a specific reporter push that into the args
|
103
|
+
|
106
104
|
|
107
|
-
// if we have a specific reporter push that into the args
|
108
105
|
if (options.reporter) {
|
109
106
|
args.push('--reporter', options.reporter);
|
110
|
-
}
|
107
|
+
} // if we have a specific reporter push that into the args
|
108
|
+
|
111
109
|
|
112
|
-
// if we have a specific reporter push that into the args
|
113
110
|
if (options.reporterOptions) {
|
114
111
|
args.push('--reporter-options', options.reporterOptions);
|
115
|
-
}
|
112
|
+
} // if we have specific spec(s) push that into the args
|
113
|
+
|
116
114
|
|
117
|
-
// if we have specific spec(s) push that into the args
|
118
115
|
if (options.spec) {
|
119
116
|
args.push('--spec', options.spec);
|
120
117
|
}
|
@@ -141,7 +138,7 @@ module.exports = {
|
|
141
138
|
});
|
142
139
|
|
143
140
|
function run() {
|
144
|
-
var args
|
141
|
+
var args;
|
145
142
|
|
146
143
|
try {
|
147
144
|
args = processRunOptions(options);
|
@@ -154,7 +151,6 @@ module.exports = {
|
|
154
151
|
}
|
155
152
|
|
156
153
|
debug('run to spawn.start args %j', args);
|
157
|
-
|
158
154
|
return spawn.start(args, {
|
159
155
|
dev: options.dev
|
160
156
|
});
|