cypress 5.2.0 → 5.6.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/index.js +6 -6
- package/lib/cli.js +119 -107
- package/lib/cypress.js +21 -21
- package/lib/errors.js +233 -276
- package/lib/exec/info.js +29 -32
- package/lib/exec/open.js +7 -8
- package/lib/exec/run.js +20 -20
- package/lib/exec/spawn.js +53 -49
- package/lib/exec/versions.js +18 -17
- package/lib/exec/xvfb.js +43 -37
- package/lib/fs.js +1 -1
- package/lib/logger.js +24 -50
- package/lib/tasks/cache.js +96 -36
- package/lib/tasks/download.js +113 -133
- package/lib/tasks/get-folder-size.js +41 -0
- package/lib/tasks/install.js +165 -249
- package/lib/tasks/state.js +54 -56
- package/lib/tasks/unzip.js +72 -69
- package/lib/tasks/verify.js +112 -147
- package/lib/util.js +172 -176
- package/package.json +4 -4
- package/types/cypress-npm-api.d.ts +13 -5
- package/types/cypress.d.ts +15 -15
- package/types/mocha/index.d.ts +123 -308
- package/types/net-stubbing.ts +132 -21
package/lib/util.js
CHANGED
@@ -1,90 +1,57 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
|
4
|
-
var data = _taggedTemplateLiteral(["\n Platform: ", " (", ")\n Cypress Version: ", "\n "]);
|
3
|
+
const _ = require('lodash');
|
5
4
|
|
6
|
-
|
7
|
-
return data;
|
8
|
-
};
|
9
|
-
|
10
|
-
return data;
|
11
|
-
}
|
12
|
-
|
13
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
14
|
-
|
15
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
16
|
-
|
17
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
18
|
-
|
19
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
20
|
-
|
21
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
22
|
-
|
23
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
24
|
-
|
25
|
-
function _templateObject() {
|
26
|
-
var data = _taggedTemplateLiteral(["\n\n ", " Warning: Cypress failed to start.\n\n This is likely due to a misconfigured DISPLAY environment variable.\n\n DISPLAY was set to: \"", "\"\n\n Cypress will attempt to fix the problem and rerun.\n "]);
|
27
|
-
|
28
|
-
_templateObject = function _templateObject() {
|
29
|
-
return data;
|
30
|
-
};
|
31
|
-
|
32
|
-
return data;
|
33
|
-
}
|
5
|
+
const R = require('ramda');
|
34
6
|
|
35
|
-
|
7
|
+
const os = require('os');
|
36
8
|
|
37
|
-
|
9
|
+
const ospath = require('ospath');
|
38
10
|
|
39
|
-
|
11
|
+
const crypto = require('crypto');
|
40
12
|
|
41
|
-
|
13
|
+
const la = require('lazy-ass');
|
42
14
|
|
43
|
-
|
15
|
+
const is = require('check-more-types');
|
44
16
|
|
45
|
-
|
17
|
+
const tty = require('tty');
|
46
18
|
|
47
|
-
|
19
|
+
const path = require('path');
|
48
20
|
|
49
|
-
|
21
|
+
const isCi = require('is-ci');
|
50
22
|
|
51
|
-
|
23
|
+
const execa = require('execa');
|
52
24
|
|
53
|
-
|
25
|
+
const getos = require('getos');
|
54
26
|
|
55
|
-
|
27
|
+
const chalk = require('chalk');
|
56
28
|
|
57
|
-
|
29
|
+
const Promise = require('bluebird');
|
58
30
|
|
59
|
-
|
31
|
+
const cachedir = require('cachedir');
|
60
32
|
|
61
|
-
|
33
|
+
const logSymbols = require('log-symbols');
|
62
34
|
|
63
|
-
|
35
|
+
const executable = require('executable');
|
64
36
|
|
65
|
-
|
37
|
+
const {
|
38
|
+
stripIndent
|
39
|
+
} = require('common-tags');
|
66
40
|
|
67
|
-
|
41
|
+
const supportsColor = require('supports-color');
|
68
42
|
|
69
|
-
|
43
|
+
const isInstalledGlobally = require('is-installed-globally');
|
70
44
|
|
71
|
-
|
72
|
-
stripIndent = _require.stripIndent;
|
45
|
+
const pkg = require(path.join(__dirname, '..', 'package.json'));
|
73
46
|
|
74
|
-
|
47
|
+
const logger = require('./logger');
|
75
48
|
|
76
|
-
|
49
|
+
const debug = require('debug')('cypress:cli');
|
77
50
|
|
78
|
-
|
51
|
+
const fs = require('./fs');
|
79
52
|
|
80
|
-
|
81
|
-
|
82
|
-
var debug = require('debug')('cypress:cli');
|
83
|
-
|
84
|
-
var fs = require('./fs');
|
85
|
-
|
86
|
-
var issuesUrl = 'https://github.com/cypress-io/cypress/issues';
|
87
|
-
var getosAsync = Promise.promisify(getos);
|
53
|
+
const issuesUrl = 'https://github.com/cypress-io/cypress/issues';
|
54
|
+
const getosAsync = Promise.promisify(getos);
|
88
55
|
/**
|
89
56
|
* Returns SHA512 of a file
|
90
57
|
*
|
@@ -92,36 +59,35 @@ var getosAsync = Promise.promisify(getos);
|
|
92
59
|
* but without bringing that dependency (since hasha is Node v8+)
|
93
60
|
*/
|
94
61
|
|
95
|
-
|
62
|
+
const getFileChecksum = filename => {
|
96
63
|
la(is.unemptyString(filename), 'expected filename', filename);
|
97
64
|
|
98
|
-
|
99
|
-
|
65
|
+
const hashStream = () => {
|
66
|
+
const s = crypto.createHash('sha512');
|
100
67
|
s.setEncoding('hex');
|
101
68
|
return s;
|
102
69
|
};
|
103
70
|
|
104
|
-
return new Promise(
|
105
|
-
|
71
|
+
return new Promise((resolve, reject) => {
|
72
|
+
const stream = fs.createReadStream(filename);
|
106
73
|
stream.on('error', reject).pipe(hashStream()).on('error', reject).on('finish', function () {
|
107
74
|
resolve(this.read());
|
108
75
|
});
|
109
76
|
});
|
110
77
|
};
|
111
78
|
|
112
|
-
|
79
|
+
const getFileSize = filename => {
|
113
80
|
la(is.unemptyString(filename), 'expected filename', filename);
|
114
81
|
return fs.statAsync(filename).get('size');
|
115
82
|
};
|
116
83
|
|
117
|
-
|
84
|
+
const isBrokenGtkDisplayRe = /Gtk: cannot open display/;
|
118
85
|
|
119
|
-
|
86
|
+
const stringify = val => {
|
120
87
|
return _.isObject(val) ? JSON.stringify(val) : val;
|
121
88
|
};
|
122
89
|
|
123
|
-
function normalizeModuleOptions() {
|
124
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
90
|
+
function normalizeModuleOptions(options = {}) {
|
125
91
|
return _.mapValues(options, stringify);
|
126
92
|
}
|
127
93
|
/**
|
@@ -130,7 +96,7 @@ function normalizeModuleOptions() {
|
|
130
96
|
*/
|
131
97
|
|
132
98
|
|
133
|
-
|
99
|
+
const isLinux = () => {
|
134
100
|
return os.platform() === 'linux';
|
135
101
|
};
|
136
102
|
/**
|
@@ -142,24 +108,33 @@ var isLinux = function isLinux() {
|
|
142
108
|
*/
|
143
109
|
|
144
110
|
|
145
|
-
|
111
|
+
const isBrokenGtkDisplay = str => {
|
146
112
|
return isBrokenGtkDisplayRe.test(str);
|
147
113
|
};
|
148
114
|
|
149
|
-
|
115
|
+
const isPossibleLinuxWithIncorrectDisplay = () => {
|
150
116
|
return isLinux() && process.env.DISPLAY;
|
151
117
|
};
|
152
118
|
|
153
|
-
|
119
|
+
const logBrokenGtkDisplayWarning = () => {
|
154
120
|
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting Xvfb'); // if we get this error, we are on Linux and DISPLAY is set
|
155
121
|
|
156
|
-
logger.warn(stripIndent
|
122
|
+
logger.warn(stripIndent`
|
123
|
+
|
124
|
+
${logSymbols.warning} Warning: Cypress failed to start.
|
125
|
+
|
126
|
+
This is likely due to a misconfigured DISPLAY environment variable.
|
127
|
+
|
128
|
+
DISPLAY was set to: "${process.env.DISPLAY}"
|
129
|
+
|
130
|
+
Cypress will attempt to fix the problem and rerun.
|
131
|
+
`);
|
157
132
|
logger.warn();
|
158
133
|
};
|
159
134
|
|
160
135
|
function stdoutLineMatches(expectedLine, stdout) {
|
161
|
-
|
162
|
-
|
136
|
+
const lines = stdout.split('\n').map(R.trim);
|
137
|
+
const lineMatches = R.equals(expectedLine);
|
163
138
|
return lines.some(lineMatches);
|
164
139
|
}
|
165
140
|
/**
|
@@ -178,7 +153,7 @@ function isValidCypressInternalEnvValue(value) {
|
|
178
153
|
} // names of config environments, see "packages/server/config/app.yml"
|
179
154
|
|
180
155
|
|
181
|
-
|
156
|
+
const names = ['development', 'test', 'staging', 'production'];
|
182
157
|
return _.includes(names, value);
|
183
158
|
}
|
184
159
|
/**
|
@@ -199,9 +174,7 @@ function isNonProductionCypressInternalEnvValue(value) {
|
|
199
174
|
*/
|
200
175
|
|
201
176
|
|
202
|
-
function printNodeOptions() {
|
203
|
-
var log = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : debug;
|
204
|
-
|
177
|
+
function printNodeOptions(log = debug) {
|
205
178
|
if (!log.enabled) {
|
206
179
|
return;
|
207
180
|
}
|
@@ -228,7 +201,7 @@ function printNodeOptions() {
|
|
228
201
|
*/
|
229
202
|
|
230
203
|
|
231
|
-
|
204
|
+
const dequote = str => {
|
232
205
|
la(is.string(str), 'expected a string to remove double quotes', str);
|
233
206
|
|
234
207
|
if (str.length > 1 && str[0] === '"' && str[str.length - 1] === '"') {
|
@@ -238,8 +211,8 @@ var dequote = function dequote(str) {
|
|
238
211
|
return str;
|
239
212
|
};
|
240
213
|
|
241
|
-
|
242
|
-
opts = _.pick(opts, 'browser', 'cachePath', 'cacheList', 'cacheClear', 'ciBuildId', 'config', 'configFile', 'cypressVersion', 'destination', 'detached', 'dev', 'exit', 'env', 'force', 'global', 'group', 'headed', 'headless', 'key', 'path', 'parallel', 'port', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'spec', 'tag');
|
214
|
+
const parseOpts = opts => {
|
215
|
+
opts = _.pick(opts, 'browser', 'cachePath', 'cacheList', 'cacheClear', 'cachePrune', 'ciBuildId', 'config', 'configFile', 'cypressVersion', 'destination', 'detached', 'dev', 'exit', 'env', 'force', 'global', 'group', 'headed', 'headless', 'key', 'path', 'parallel', 'port', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'spec', 'tag');
|
243
216
|
|
244
217
|
if (opts.exit) {
|
245
218
|
opts = _.omit(opts, 'exit');
|
@@ -247,11 +220,11 @@ var parseOpts = function parseOpts(opts) {
|
|
247
220
|
// remove double quotes from certain options
|
248
221
|
|
249
222
|
|
250
|
-
|
223
|
+
const removeQuotes = {
|
251
224
|
group: dequote,
|
252
225
|
ciBuildId: dequote
|
253
226
|
};
|
254
|
-
|
227
|
+
const cleanOpts = R.evolve(removeQuotes, opts);
|
255
228
|
debug('parsed cli options %o', cleanOpts);
|
256
229
|
return cleanOpts;
|
257
230
|
};
|
@@ -261,41 +234,39 @@ var parseOpts = function parseOpts(opts) {
|
|
261
234
|
*/
|
262
235
|
|
263
236
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
var folder = env.CYPRESS_KONFIG_ENV || env.CYPRESS_INTERNAL_ENV || 'development';
|
269
|
-
var PRODUCT_NAME = pkg.productName || pkg.name;
|
270
|
-
var OS_DATA_PATH = ospath.data();
|
271
|
-
var ELECTRON_APP_DATA_PATH = path.join(OS_DATA_PATH, PRODUCT_NAME);
|
272
|
-
|
273
|
-
for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
|
274
|
-
paths[_key] = arguments[_key];
|
275
|
-
}
|
237
|
+
const getApplicationDataFolder = (...paths) => {
|
238
|
+
const {
|
239
|
+
env
|
240
|
+
} = process; // allow overriding the app_data folder
|
276
241
|
|
277
|
-
|
242
|
+
const folder = env.CYPRESS_KONFIG_ENV || env.CYPRESS_INTERNAL_ENV || 'development';
|
243
|
+
const PRODUCT_NAME = pkg.productName || pkg.name;
|
244
|
+
const OS_DATA_PATH = ospath.data();
|
245
|
+
const ELECTRON_APP_DATA_PATH = path.join(OS_DATA_PATH, PRODUCT_NAME);
|
246
|
+
const p = path.join(ELECTRON_APP_DATA_PATH, 'cy', folder, ...paths);
|
278
247
|
return p;
|
279
248
|
};
|
280
249
|
|
281
|
-
|
282
|
-
normalizeModuleOptions
|
283
|
-
parseOpts
|
284
|
-
isValidCypressInternalEnvValue
|
285
|
-
isNonProductionCypressInternalEnvValue
|
286
|
-
printNodeOptions
|
287
|
-
|
288
|
-
|
250
|
+
const util = {
|
251
|
+
normalizeModuleOptions,
|
252
|
+
parseOpts,
|
253
|
+
isValidCypressInternalEnvValue,
|
254
|
+
isNonProductionCypressInternalEnvValue,
|
255
|
+
printNodeOptions,
|
256
|
+
|
257
|
+
isCi() {
|
258
|
+
return isCi;
|
289
259
|
},
|
290
|
-
|
291
|
-
|
260
|
+
|
261
|
+
getEnvOverrides(options = {}) {
|
292
262
|
return _.chain({}).extend(util.getEnvColors()).extend(util.getForceTty()).omitBy(_.isUndefined) // remove undefined values
|
293
|
-
.mapValues(
|
263
|
+
.mapValues(value => {
|
294
264
|
// stringify to 1 or 0
|
295
265
|
return value ? '1' : '0';
|
296
266
|
}).extend(util.getNodeOptions(options)).value();
|
297
267
|
},
|
298
|
-
|
268
|
+
|
269
|
+
getNodeOptions(options, nodeVersion) {
|
299
270
|
if (!nodeVersion) {
|
300
271
|
nodeVersion = Number(process.versions.node.split('.')[0]);
|
301
272
|
}
|
@@ -307,38 +278,42 @@ var util = {
|
|
307
278
|
} // https://github.com/cypress-io/cypress/issues/5431
|
308
279
|
|
309
280
|
|
310
|
-
|
281
|
+
const NODE_OPTIONS = `--max-http-header-size=${1024 ** 2}`;
|
311
282
|
|
312
283
|
if (_.isString(process.env.NODE_OPTIONS)) {
|
313
284
|
return {
|
314
|
-
NODE_OPTIONS:
|
285
|
+
NODE_OPTIONS: `${NODE_OPTIONS} ${process.env.NODE_OPTIONS}`,
|
315
286
|
ORIGINAL_NODE_OPTIONS: process.env.NODE_OPTIONS || ''
|
316
287
|
};
|
317
288
|
}
|
318
289
|
|
319
290
|
return {
|
320
|
-
NODE_OPTIONS
|
291
|
+
NODE_OPTIONS
|
321
292
|
};
|
322
293
|
},
|
323
|
-
|
294
|
+
|
295
|
+
getForceTty() {
|
324
296
|
return {
|
325
297
|
FORCE_STDIN_TTY: util.isTty(process.stdin.fd),
|
326
298
|
FORCE_STDOUT_TTY: util.isTty(process.stdout.fd),
|
327
299
|
FORCE_STDERR_TTY: util.isTty(process.stderr.fd)
|
328
300
|
};
|
329
301
|
},
|
330
|
-
|
331
|
-
|
302
|
+
|
303
|
+
getEnvColors() {
|
304
|
+
const sc = util.supportsColor();
|
332
305
|
return {
|
333
306
|
FORCE_COLOR: sc,
|
334
307
|
DEBUG_COLORS: sc,
|
335
308
|
MOCHA_COLORS: sc ? true : undefined
|
336
309
|
};
|
337
310
|
},
|
338
|
-
|
311
|
+
|
312
|
+
isTty(fd) {
|
339
313
|
return tty.isatty(fd);
|
340
314
|
},
|
341
|
-
|
315
|
+
|
316
|
+
supportsColor() {
|
342
317
|
// if we've been explictly told not to support
|
343
318
|
// color then turn this off
|
344
319
|
if (process.env.NO_COLOR) {
|
@@ -352,35 +327,38 @@ var util = {
|
|
352
327
|
} // ensure that both stdout and stderr support color
|
353
328
|
|
354
329
|
|
355
|
-
return Boolean(
|
330
|
+
return Boolean(supportsColor.stdout) && Boolean(supportsColor.stderr);
|
356
331
|
},
|
357
|
-
|
332
|
+
|
333
|
+
cwd() {
|
358
334
|
return process.cwd();
|
359
335
|
},
|
360
|
-
|
336
|
+
|
337
|
+
pkgVersion() {
|
361
338
|
return pkg.version;
|
362
339
|
},
|
363
|
-
|
340
|
+
|
341
|
+
exit(code) {
|
364
342
|
process.exit(code);
|
365
343
|
},
|
366
|
-
|
344
|
+
|
345
|
+
logErrorExit1(err) {
|
367
346
|
logger.error(err.message);
|
368
347
|
process.exit(1);
|
369
348
|
},
|
370
|
-
dequote: dequote,
|
371
|
-
titleize: function titleize() {
|
372
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
373
|
-
args[_key2] = arguments[_key2];
|
374
|
-
}
|
375
349
|
|
350
|
+
dequote,
|
351
|
+
|
352
|
+
titleize(...args) {
|
376
353
|
// prepend first arg with space
|
377
354
|
// and pad so that all messages line up
|
378
|
-
args[0] = _.padEnd(
|
355
|
+
args[0] = _.padEnd(` ${args[0]}`, 24); // get rid of any falsy values
|
379
356
|
|
380
357
|
args = _.compact(args);
|
381
|
-
return chalk.blue
|
358
|
+
return chalk.blue(...args);
|
382
359
|
},
|
383
|
-
|
360
|
+
|
361
|
+
calculateEta(percent, elapsed) {
|
384
362
|
// returns the number of seconds remaining
|
385
363
|
// if we're at 100% already just return 0
|
386
364
|
if (percent === 100) {
|
@@ -392,38 +370,46 @@ var util = {
|
|
392
370
|
|
393
371
|
return elapsed * (1 / (percent / 100)) - elapsed;
|
394
372
|
},
|
395
|
-
|
373
|
+
|
374
|
+
convertPercentToPercentage(num) {
|
396
375
|
// convert a percent with values between 0 and 1
|
397
376
|
// with decimals, so that it is between 0 and 100
|
398
377
|
// and has no decimal places
|
399
378
|
return Math.round(_.isFinite(num) ? num * 100 : 0);
|
400
379
|
},
|
401
|
-
|
380
|
+
|
381
|
+
secsRemaining(eta) {
|
402
382
|
// calculate the seconds reminaing with no decimal places
|
403
383
|
return (_.isFinite(eta) ? eta / 1000 : 0).toFixed(0);
|
404
384
|
},
|
405
|
-
|
385
|
+
|
386
|
+
setTaskTitle(task, title, renderer) {
|
406
387
|
// only update the renderer title when not running in CI
|
407
388
|
if (renderer === 'default' && task.title !== title) {
|
408
389
|
task.title = title;
|
409
390
|
}
|
410
391
|
},
|
411
|
-
|
412
|
-
|
392
|
+
|
393
|
+
isInstalledGlobally() {
|
394
|
+
return isInstalledGlobally;
|
413
395
|
},
|
414
|
-
|
396
|
+
|
397
|
+
isSemver(str) {
|
415
398
|
return /^(\d+\.)?(\d+\.)?(\*|\d+)$/.test(str);
|
416
399
|
},
|
417
|
-
|
400
|
+
|
401
|
+
isExecutableAsync(filePath) {
|
418
402
|
return Promise.resolve(executable(filePath));
|
419
403
|
},
|
420
|
-
|
421
|
-
|
422
|
-
|
404
|
+
|
405
|
+
isLinux,
|
406
|
+
|
407
|
+
getOsVersionAsync() {
|
408
|
+
return Promise.try(() => {
|
423
409
|
if (isLinux()) {
|
424
|
-
return getosAsync().then(
|
410
|
+
return getosAsync().then(osInfo => {
|
425
411
|
return [osInfo.dist, osInfo.release].join(' - ');
|
426
|
-
})
|
412
|
+
}).catch(() => {
|
427
413
|
return os.release();
|
428
414
|
});
|
429
415
|
}
|
@@ -431,38 +417,43 @@ var util = {
|
|
431
417
|
return os.release();
|
432
418
|
});
|
433
419
|
},
|
434
|
-
|
435
|
-
|
436
|
-
|
420
|
+
|
421
|
+
getPlatformInfo() {
|
422
|
+
return util.getOsVersionAsync().then(version => {
|
423
|
+
return stripIndent`
|
424
|
+
Platform: ${os.platform()} (${version})
|
425
|
+
Cypress Version: ${util.pkgVersion()}
|
426
|
+
`;
|
437
427
|
});
|
438
428
|
},
|
429
|
+
|
439
430
|
// attention:
|
440
431
|
// when passing relative path to NPM post install hook, the current working
|
441
432
|
// directory is set to the `node_modules/cypress` folder
|
442
433
|
// the user is probably passing relative path with respect to root package folder
|
443
|
-
formAbsolutePath
|
434
|
+
formAbsolutePath(filename) {
|
444
435
|
if (path.isAbsolute(filename)) {
|
445
436
|
return filename;
|
446
437
|
}
|
447
438
|
|
448
439
|
return path.join(process.cwd(), '..', '..', filename);
|
449
440
|
},
|
450
|
-
|
441
|
+
|
442
|
+
getEnv(varName, trim) {
|
451
443
|
la(is.unemptyString(varName), 'expected environment variable name, not', varName);
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
result = packageConfigVar;
|
444
|
+
const configVarName = `npm_config_${varName}`;
|
445
|
+
const packageConfigVarName = `npm_package_config_${varName}`;
|
446
|
+
let result;
|
447
|
+
|
448
|
+
if (process.env.hasOwnProperty(varName)) {
|
449
|
+
debug(`Using ${varName} from environment variable`);
|
450
|
+
result = process.env[varName];
|
451
|
+
} else if (process.env.hasOwnProperty(configVarName)) {
|
452
|
+
debug(`Using ${varName} from npm config`);
|
453
|
+
result = process.env[configVarName];
|
454
|
+
} else if (process.env.hasOwnProperty(packageConfigVarName)) {
|
455
|
+
debug(`Using ${varName} from package.json config`);
|
456
|
+
result = process.env[packageConfigVarName];
|
466
457
|
} // environment variables are often set double quotes to escape characters
|
467
458
|
// and on Windows it can lead to weird things: for example
|
468
459
|
// set FOO="C:\foo.txt" && node -e "console.log('>>>%s<<<', process.env.FOO)"
|
@@ -476,25 +467,30 @@ var util = {
|
|
476
467
|
|
477
468
|
return trim ? dequote(_.trim(result)) : result;
|
478
469
|
},
|
479
|
-
|
470
|
+
|
471
|
+
getCacheDir() {
|
480
472
|
return cachedir('Cypress');
|
481
473
|
},
|
482
|
-
|
474
|
+
|
475
|
+
isPostInstall() {
|
483
476
|
return process.env.npm_lifecycle_event === 'postinstall';
|
484
477
|
},
|
478
|
+
|
485
479
|
exec: execa,
|
486
|
-
stdoutLineMatches
|
487
|
-
issuesUrl
|
488
|
-
isBrokenGtkDisplay
|
489
|
-
logBrokenGtkDisplayWarning
|
490
|
-
isPossibleLinuxWithIncorrectDisplay
|
491
|
-
|
480
|
+
stdoutLineMatches,
|
481
|
+
issuesUrl,
|
482
|
+
isBrokenGtkDisplay,
|
483
|
+
logBrokenGtkDisplayWarning,
|
484
|
+
isPossibleLinuxWithIncorrectDisplay,
|
485
|
+
|
486
|
+
getGitHubIssueUrl(number) {
|
492
487
|
la(is.positive(number), 'github issue should be a positive number', number);
|
493
488
|
la(_.isInteger(number), 'github issue should be an integer', number);
|
494
|
-
return
|
489
|
+
return `${issuesUrl}/${number}`;
|
495
490
|
},
|
496
|
-
|
497
|
-
|
498
|
-
|
491
|
+
|
492
|
+
getFileChecksum,
|
493
|
+
getFileSize,
|
494
|
+
getApplicationDataFolder
|
499
495
|
};
|
500
496
|
module.exports = util;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.6.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"scripts": {
|
6
6
|
"postinstall": "node index.js --exec install",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"chalk": "^4.1.0",
|
20
20
|
"check-more-types": "^2.24.0",
|
21
21
|
"cli-table3": "~0.6.0",
|
22
|
-
"commander": "^
|
22
|
+
"commander": "^5.1.0",
|
23
23
|
"common-tags": "^1.8.0",
|
24
24
|
"debug": "^4.1.1",
|
25
25
|
"eventemitter2": "^6.4.2",
|
@@ -37,10 +37,10 @@
|
|
37
37
|
"minimist": "^1.2.5",
|
38
38
|
"moment": "^2.27.0",
|
39
39
|
"ospath": "^1.2.2",
|
40
|
-
"pretty-bytes": "^5.
|
40
|
+
"pretty-bytes": "^5.4.1",
|
41
41
|
"ramda": "~0.26.1",
|
42
42
|
"request-progress": "^3.0.0",
|
43
|
-
"supports-color": "^7.
|
43
|
+
"supports-color": "^7.2.0",
|
44
44
|
"tmp": "~0.2.1",
|
45
45
|
"untildify": "^4.0.0",
|
46
46
|
"url": "^0.11.0",
|