cypress 12.1.0 → 12.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/angular/dist/index.js +1 -1
- package/index.js +2 -11
- package/lib/VerboseRenderer.js +2 -16
- package/lib/cli.js +25 -83
- package/lib/cypress.js +1 -14
- package/lib/errors.js +13 -38
- package/lib/exec/info.js +10 -31
- package/lib/exec/open.js +1 -24
- package/lib/exec/run.js +15 -52
- package/lib/exec/shared.js +6 -15
- package/lib/exec/spawn.js +45 -88
- package/lib/exec/versions.js +0 -9
- package/lib/exec/xvfb.js +5 -18
- package/lib/fs.js +0 -1
- package/lib/logger.js +3 -10
- package/lib/tasks/cache.js +5 -29
- package/lib/tasks/download.js +21 -57
- package/lib/tasks/get-folder-size.js +1 -9
- package/lib/tasks/install.js +20 -66
- package/lib/tasks/state.js +5 -51
- package/lib/tasks/unzip.js +7 -41
- package/lib/tasks/verify.js +11 -65
- package/lib/util.js +41 -128
- package/mount-utils/package.json +2 -2
- package/package.json +3 -3
- package/react/dist/cypress-react.cjs.js +8 -15
- package/react/dist/cypress-react.esm-bundler.js +1 -1
- package/react/package.json +1 -1
- package/react18/dist/cypress-react.cjs.js +7 -13
- package/react18/dist/cypress-react.esm-bundler.js +1 -1
- package/react18/package.json +1 -1
- package/svelte/dist/cypress-svelte.cjs.js +2 -4
- package/svelte/dist/cypress-svelte.esm-bundler.js +2 -2
- package/types/cypress.d.ts +11 -6
- package/types/net-stubbing.d.ts +11 -0
- package/vue/dist/cypress-vue.cjs.js +4 -7
- package/vue/dist/cypress-vue.esm-bundler.js +1 -1
- package/vue/package.json +1 -1
- package/vue2/dist/cypress-vue2.cjs.js +19 -28
- package/vue2/dist/cypress-vue2.esm-bundler.js +1 -4
package/lib/util.js
CHANGED
@@ -1,75 +1,48 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const _ = require('lodash');
|
4
|
-
|
5
4
|
const arch = require('arch');
|
6
|
-
|
7
5
|
const os = require('os');
|
8
|
-
|
9
6
|
const ospath = require('ospath');
|
10
|
-
|
11
7
|
const crypto = require('crypto');
|
12
|
-
|
13
8
|
const la = require('lazy-ass');
|
14
|
-
|
15
9
|
const is = require('check-more-types');
|
16
|
-
|
17
10
|
const tty = require('tty');
|
18
|
-
|
19
11
|
const path = require('path');
|
20
|
-
|
21
12
|
const isCi = require('is-ci');
|
22
|
-
|
23
13
|
const execa = require('execa');
|
24
|
-
|
25
14
|
const getos = require('getos');
|
26
|
-
|
27
15
|
const chalk = require('chalk');
|
28
|
-
|
29
16
|
const Promise = require('bluebird');
|
30
|
-
|
31
17
|
const cachedir = require('cachedir');
|
32
|
-
|
33
18
|
const logSymbols = require('log-symbols');
|
34
|
-
|
35
19
|
const executable = require('executable');
|
36
|
-
|
37
20
|
const {
|
38
21
|
stripIndent
|
39
22
|
} = require('common-tags');
|
40
|
-
|
41
23
|
const supportsColor = require('supports-color');
|
42
|
-
|
43
24
|
const isInstalledGlobally = require('is-installed-globally');
|
44
|
-
|
45
25
|
const logger = require('./logger');
|
46
|
-
|
47
26
|
const debug = require('debug')('cypress:cli');
|
48
|
-
|
49
27
|
const fs = require('./fs');
|
50
|
-
|
51
28
|
const semver = require('semver');
|
52
|
-
|
53
29
|
const pkg = require(path.join(__dirname, '..', 'package.json'));
|
54
|
-
|
55
30
|
const issuesUrl = 'https://github.com/cypress-io/cypress/issues';
|
56
31
|
const getosAsync = Promise.promisify(getos);
|
32
|
+
|
57
33
|
/**
|
58
34
|
* Returns SHA512 of a file
|
59
35
|
*
|
60
36
|
* Implementation lifted from https://github.com/sindresorhus/hasha
|
61
37
|
* but without bringing that dependency (since hasha is Node v8+)
|
62
38
|
*/
|
63
|
-
|
64
39
|
const getFileChecksum = filename => {
|
65
40
|
la(is.unemptyString(filename), 'expected filename', filename);
|
66
|
-
|
67
41
|
const hashStream = () => {
|
68
42
|
const s = crypto.createHash('sha512');
|
69
43
|
s.setEncoding('hex');
|
70
44
|
return s;
|
71
45
|
};
|
72
|
-
|
73
46
|
return new Promise((resolve, reject) => {
|
74
47
|
const stream = fs.createReadStream(filename);
|
75
48
|
stream.on('error', reject).pipe(hashStream()).on('error', reject).on('finish', function () {
|
@@ -77,30 +50,26 @@ const getFileChecksum = filename => {
|
|
77
50
|
});
|
78
51
|
});
|
79
52
|
};
|
80
|
-
|
81
53
|
const getFileSize = filename => {
|
82
54
|
la(is.unemptyString(filename), 'expected filename', filename);
|
83
55
|
return fs.statAsync(filename).get('size');
|
84
56
|
};
|
85
|
-
|
86
57
|
const isBrokenGtkDisplayRe = /Gtk: cannot open display/;
|
87
|
-
|
88
58
|
const stringify = val => {
|
89
59
|
return _.isObject(val) ? JSON.stringify(val) : val;
|
90
60
|
};
|
91
|
-
|
92
61
|
function normalizeModuleOptions(options = {}) {
|
93
62
|
return _.mapValues(options, stringify);
|
94
63
|
}
|
64
|
+
|
95
65
|
/**
|
96
66
|
* Returns true if the platform is Linux. We do a lot of different
|
97
67
|
* stuff on Linux (like Xvfb) and it helps to has readable code
|
98
68
|
*/
|
99
|
-
|
100
|
-
|
101
69
|
const isLinux = () => {
|
102
70
|
return os.platform() === 'linux';
|
103
71
|
};
|
72
|
+
|
104
73
|
/**
|
105
74
|
* If the DISPLAY variable is set incorrectly, when trying to spawn
|
106
75
|
* Cypress executable we get an error like this:
|
@@ -108,19 +77,16 @@ const isLinux = () => {
|
|
108
77
|
[1005:0509/184205.663837:WARNING:browser_main_loop.cc(258)] Gtk: cannot open display: 99
|
109
78
|
```
|
110
79
|
*/
|
111
|
-
|
112
|
-
|
113
80
|
const isBrokenGtkDisplay = str => {
|
114
81
|
return isBrokenGtkDisplayRe.test(str);
|
115
82
|
};
|
116
|
-
|
117
83
|
const isPossibleLinuxWithIncorrectDisplay = () => {
|
118
84
|
return isLinux() && process.env.DISPLAY;
|
119
85
|
};
|
120
|
-
|
121
86
|
const logBrokenGtkDisplayWarning = () => {
|
122
|
-
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting Xvfb');
|
87
|
+
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting Xvfb');
|
123
88
|
|
89
|
+
// if we get this error, we are on Linux and DISPLAY is set
|
124
90
|
logger.warn(stripIndent`
|
125
91
|
|
126
92
|
${logSymbols.warning} Warning: Cypress failed to start.
|
@@ -133,11 +99,11 @@ const logBrokenGtkDisplayWarning = () => {
|
|
133
99
|
`);
|
134
100
|
logger.warn();
|
135
101
|
};
|
136
|
-
|
137
102
|
function stdoutLineMatches(expectedLine, stdout) {
|
138
103
|
const lines = stdout.split('\n').map(val => val.trim());
|
139
104
|
return lines.some(line => line === expectedLine);
|
140
105
|
}
|
106
|
+
|
141
107
|
/**
|
142
108
|
* Confirms if given value is a valid CYPRESS_INTERNAL_ENV value. Undefined values
|
143
109
|
* are valid, because the system can set the default one.
|
@@ -145,18 +111,17 @@ function stdoutLineMatches(expectedLine, stdout) {
|
|
145
111
|
* @param {string} value
|
146
112
|
* @example util.isValidCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
147
113
|
*/
|
148
|
-
|
149
|
-
|
150
114
|
function isValidCypressInternalEnvValue(value) {
|
151
115
|
if (_.isUndefined(value)) {
|
152
116
|
// will get default value
|
153
117
|
return true;
|
154
|
-
}
|
155
|
-
|
118
|
+
}
|
156
119
|
|
120
|
+
// names of config environments, see "packages/server/config/app.json"
|
157
121
|
const names = ['development', 'test', 'staging', 'production'];
|
158
122
|
return _.includes(names, value);
|
159
123
|
}
|
124
|
+
|
160
125
|
/**
|
161
126
|
* Confirms if given value is a non-production CYPRESS_INTERNAL_ENV value.
|
162
127
|
* Undefined values are valid, because the system can set the default one.
|
@@ -164,28 +129,25 @@ function isValidCypressInternalEnvValue(value) {
|
|
164
129
|
* @param {string} value
|
165
130
|
* @example util.isNonProductionCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
166
131
|
*/
|
167
|
-
|
168
|
-
|
169
132
|
function isNonProductionCypressInternalEnvValue(value) {
|
170
133
|
return !_.isUndefined(value) && value !== 'production';
|
171
134
|
}
|
135
|
+
|
172
136
|
/**
|
173
137
|
* Prints NODE_OPTIONS using debug() module, but only
|
174
138
|
* if DEBUG=cypress... is set
|
175
139
|
*/
|
176
|
-
|
177
|
-
|
178
140
|
function printNodeOptions(log = debug) {
|
179
141
|
if (!log.enabled) {
|
180
142
|
return;
|
181
143
|
}
|
182
|
-
|
183
144
|
if (process.env.NODE_OPTIONS) {
|
184
145
|
log('NODE_OPTIONS=%s', process.env.NODE_OPTIONS);
|
185
146
|
} else {
|
186
147
|
log('NODE_OPTIONS is not set');
|
187
148
|
}
|
188
149
|
}
|
150
|
+
|
189
151
|
/**
|
190
152
|
* Removes double quote characters
|
191
153
|
* from the start and end of the given string IF they are both present
|
@@ -200,75 +162,63 @@ function printNodeOptions(log = debug) {
|
|
200
162
|
// returns string 'foo'
|
201
163
|
```
|
202
164
|
*/
|
203
|
-
|
204
|
-
|
205
165
|
const dequote = str => {
|
206
166
|
la(is.string(str), 'expected a string to remove double quotes', str);
|
207
|
-
|
208
167
|
if (str.length > 1 && str[0] === '"' && str[str.length - 1] === '"') {
|
209
168
|
return str.substr(1, str.length - 2);
|
210
169
|
}
|
211
|
-
|
212
170
|
return str;
|
213
171
|
};
|
214
|
-
|
215
172
|
const parseOpts = opts => {
|
216
173
|
opts = _.pick(opts, 'browser', 'cachePath', 'cacheList', 'cacheClear', 'cachePrune', 'ciBuildId', 'ct', 'component', 'config', 'configFile', 'cypressVersion', 'destination', 'detached', 'dev', 'e2e', 'exit', 'env', 'force', 'global', 'group', 'headed', 'headless', 'inspect', 'inspectBrk', 'key', 'path', 'parallel', 'port', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'runProject', 'spec', 'tag');
|
217
|
-
|
218
174
|
if (opts.exit) {
|
219
175
|
opts = _.omit(opts, 'exit');
|
220
|
-
}
|
221
|
-
// remove double quotes from certain options
|
222
|
-
|
176
|
+
}
|
223
177
|
|
224
|
-
|
178
|
+
// some options might be quoted - which leads to unexpected results
|
179
|
+
// remove double quotes from certain options
|
180
|
+
const cleanOpts = {
|
181
|
+
...opts
|
225
182
|
};
|
226
183
|
const toDequote = ['group', 'ciBuildId'];
|
227
|
-
|
228
184
|
for (const prop of toDequote) {
|
229
185
|
if (_.has(opts, prop)) {
|
230
186
|
cleanOpts[prop] = dequote(opts[prop]);
|
231
187
|
}
|
232
188
|
}
|
233
|
-
|
234
189
|
debug('parsed cli options %o', cleanOpts);
|
235
190
|
return cleanOpts;
|
236
191
|
};
|
192
|
+
|
237
193
|
/**
|
238
194
|
* Copy of packages/server/lib/browsers/utils.ts
|
239
195
|
* because we need same functionality in CLI to show the path :(
|
240
196
|
*/
|
241
|
-
|
242
|
-
|
243
197
|
const getApplicationDataFolder = (...paths) => {
|
244
198
|
const {
|
245
199
|
env
|
246
|
-
} = process;
|
200
|
+
} = process;
|
247
201
|
|
202
|
+
// allow overriding the app_data folder
|
248
203
|
let folder = env.CYPRESS_CONFIG_ENV || env.CYPRESS_INTERNAL_ENV || 'development';
|
249
204
|
const PRODUCT_NAME = pkg.productName || pkg.name;
|
250
205
|
const OS_DATA_PATH = ospath.data();
|
251
206
|
const ELECTRON_APP_DATA_PATH = path.join(OS_DATA_PATH, PRODUCT_NAME);
|
252
|
-
|
253
207
|
if (process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF) {
|
254
208
|
folder = `${folder}-e2e-test`;
|
255
209
|
}
|
256
|
-
|
257
210
|
const p = path.join(ELECTRON_APP_DATA_PATH, 'cy', folder, ...paths);
|
258
211
|
return p;
|
259
212
|
};
|
260
|
-
|
261
213
|
const util = {
|
262
214
|
normalizeModuleOptions,
|
263
215
|
parseOpts,
|
264
216
|
isValidCypressInternalEnvValue,
|
265
217
|
isNonProductionCypressInternalEnvValue,
|
266
218
|
printNodeOptions,
|
267
|
-
|
268
219
|
isCi() {
|
269
220
|
return isCi;
|
270
221
|
},
|
271
|
-
|
272
222
|
getEnvOverrides(options = {}) {
|
273
223
|
return _.chain({}).extend(util.getEnvColors()).extend(util.getForceTty()).omitBy(_.isUndefined) // remove undefined values
|
274
224
|
.mapValues(value => {
|
@@ -276,33 +226,30 @@ const util = {
|
|
276
226
|
return value ? '1' : '0';
|
277
227
|
}).extend(util.getOriginalNodeOptions()).value();
|
278
228
|
},
|
279
|
-
|
280
229
|
getOriginalNodeOptions() {
|
281
230
|
const opts = {};
|
282
|
-
|
283
231
|
if (process.env.NODE_OPTIONS) {
|
284
232
|
opts.ORIGINAL_NODE_OPTIONS = process.env.NODE_OPTIONS;
|
285
|
-
}
|
233
|
+
}
|
234
|
+
|
235
|
+
// https://github.com/cypress-io/cypress/issues/18914
|
286
236
|
// Node 17+ ships with OpenSSL 3 by default, so we may need the option
|
287
237
|
// --openssl-legacy-provider so that webpack@4 can use the legacy MD4 hash
|
288
238
|
// function. This option doesn't exist on Node <17 or when it is built
|
289
239
|
// against OpenSSL 1, so we have to detect Node's major version and check
|
290
240
|
// which version of OpenSSL it was built against before spawning the plugins
|
291
241
|
// process.
|
242
|
+
|
292
243
|
// To be removed when the Cypress binary pulls in the @cypress/webpack-batteries-included-preprocessor
|
293
244
|
// version that has been updated to webpack >= 5.61, which no longer relies on
|
294
245
|
// Node's builtin crypto.hash function.
|
295
|
-
|
296
|
-
|
297
246
|
if (process.versions && semver.satisfies(process.versions.node, '>=17.0.0') && semver.satisfies(process.versions.openssl, '>=3', {
|
298
247
|
includePrerelease: true
|
299
248
|
})) {
|
300
249
|
opts.ORIGINAL_NODE_OPTIONS = `${opts.ORIGINAL_NODE_OPTIONS || ''} --openssl-legacy-provider`;
|
301
250
|
}
|
302
|
-
|
303
251
|
return opts;
|
304
252
|
},
|
305
|
-
|
306
253
|
getForceTty() {
|
307
254
|
return {
|
308
255
|
FORCE_STDIN_TTY: util.isTty(process.stdin.fd),
|
@@ -310,7 +257,6 @@ const util = {
|
|
310
257
|
FORCE_STDERR_TTY: util.isTty(process.stderr.fd)
|
311
258
|
};
|
312
259
|
},
|
313
|
-
|
314
260
|
getEnvColors() {
|
315
261
|
const sc = util.supportsColor();
|
316
262
|
return {
|
@@ -319,106 +265,90 @@ const util = {
|
|
319
265
|
MOCHA_COLORS: sc ? true : undefined
|
320
266
|
};
|
321
267
|
},
|
322
|
-
|
323
268
|
isTty(fd) {
|
324
269
|
return tty.isatty(fd);
|
325
270
|
},
|
326
|
-
|
327
271
|
supportsColor() {
|
328
272
|
// if we've been explictly told not to support
|
329
273
|
// color then turn this off
|
330
274
|
if (process.env.NO_COLOR) {
|
331
275
|
return false;
|
332
|
-
}
|
333
|
-
// always return true in CI providers
|
334
|
-
|
276
|
+
}
|
335
277
|
|
278
|
+
// https://github.com/cypress-io/cypress/issues/1747
|
279
|
+
// always return true in CI providers
|
336
280
|
if (process.env.CI) {
|
337
281
|
return true;
|
338
|
-
}
|
339
|
-
|
282
|
+
}
|
340
283
|
|
284
|
+
// ensure that both stdout and stderr support color
|
341
285
|
return Boolean(supportsColor.stdout) && Boolean(supportsColor.stderr);
|
342
286
|
},
|
343
|
-
|
344
287
|
cwd() {
|
345
288
|
return process.cwd();
|
346
289
|
},
|
347
|
-
|
348
290
|
pkgBuildInfo() {
|
349
291
|
return pkg.buildInfo;
|
350
292
|
},
|
351
|
-
|
352
293
|
pkgVersion() {
|
353
294
|
return pkg.version;
|
354
295
|
},
|
355
|
-
|
356
296
|
exit(code) {
|
357
297
|
process.exit(code);
|
358
298
|
},
|
359
|
-
|
360
299
|
logErrorExit1(err) {
|
361
300
|
logger.error(err.message);
|
362
301
|
process.exit(1);
|
363
302
|
},
|
364
|
-
|
365
303
|
dequote,
|
366
|
-
|
367
304
|
titleize(...args) {
|
368
305
|
// prepend first arg with space
|
369
306
|
// and pad so that all messages line up
|
370
|
-
args[0] = _.padEnd(` ${args[0]}`, 24);
|
307
|
+
args[0] = _.padEnd(` ${args[0]}`, 24);
|
371
308
|
|
309
|
+
// get rid of any falsy values
|
372
310
|
args = _.compact(args);
|
373
311
|
return chalk.blue(...args);
|
374
312
|
},
|
375
|
-
|
376
313
|
calculateEta(percent, elapsed) {
|
377
314
|
// returns the number of seconds remaining
|
315
|
+
|
378
316
|
// if we're at 100% already just return 0
|
379
317
|
if (percent === 100) {
|
380
318
|
return 0;
|
381
|
-
}
|
319
|
+
}
|
320
|
+
|
321
|
+
// take the percentage and divide by one
|
382
322
|
// and multiple that against elapsed
|
383
323
|
// subtracting what's already elapsed
|
384
|
-
|
385
|
-
|
386
324
|
return elapsed * (1 / (percent / 100)) - elapsed;
|
387
325
|
},
|
388
|
-
|
389
326
|
convertPercentToPercentage(num) {
|
390
327
|
// convert a percent with values between 0 and 1
|
391
328
|
// with decimals, so that it is between 0 and 100
|
392
329
|
// and has no decimal places
|
393
330
|
return Math.round(_.isFinite(num) ? num * 100 : 0);
|
394
331
|
},
|
395
|
-
|
396
332
|
secsRemaining(eta) {
|
397
333
|
// calculate the seconds reminaing with no decimal places
|
398
334
|
return (_.isFinite(eta) ? eta / 1000 : 0).toFixed(0);
|
399
335
|
},
|
400
|
-
|
401
336
|
setTaskTitle(task, title, renderer) {
|
402
337
|
// only update the renderer title when not running in CI
|
403
338
|
if (renderer === 'default' && task.title !== title) {
|
404
339
|
task.title = title;
|
405
340
|
}
|
406
341
|
},
|
407
|
-
|
408
342
|
isInstalledGlobally() {
|
409
343
|
return isInstalledGlobally;
|
410
344
|
},
|
411
|
-
|
412
345
|
isSemver(str) {
|
413
346
|
return /^(\d+\.)?(\d+\.)?(\*|\d+)$/.test(str);
|
414
347
|
},
|
415
|
-
|
416
348
|
isExecutableAsync(filePath) {
|
417
349
|
return Promise.resolve(executable(filePath));
|
418
350
|
},
|
419
|
-
|
420
351
|
isLinux,
|
421
|
-
|
422
352
|
getOsVersionAsync() {
|
423
353
|
return Promise.try(() => {
|
424
354
|
if (isLinux()) {
|
@@ -428,11 +358,9 @@ const util = {
|
|
428
358
|
return os.release();
|
429
359
|
});
|
430
360
|
}
|
431
|
-
|
432
361
|
return os.release();
|
433
362
|
});
|
434
363
|
},
|
435
|
-
|
436
364
|
async getPlatformInfo() {
|
437
365
|
const [version, osArch] = await Promise.all([util.getOsVersionAsync(), this.getRealArch()]);
|
438
366
|
return stripIndent`
|
@@ -440,25 +368,21 @@ const util = {
|
|
440
368
|
Cypress Version: ${util.pkgVersion()}
|
441
369
|
`;
|
442
370
|
},
|
443
|
-
|
444
371
|
_cachedArch: undefined,
|
445
|
-
|
446
372
|
/**
|
447
373
|
* Attempt to return the real system arch (not process.arch, which is only the Node binary's arch)
|
448
374
|
*/
|
449
375
|
async getRealArch() {
|
450
376
|
if (this._cachedArch) return this._cachedArch;
|
451
|
-
|
452
377
|
async function _getRealArch() {
|
453
|
-
const osPlatform = os.platform();
|
454
|
-
|
378
|
+
const osPlatform = os.platform();
|
379
|
+
// eslint-disable-next-line no-restricted-syntax
|
455
380
|
const osArch = os.arch();
|
456
381
|
debug('detecting arch %o', {
|
457
382
|
osPlatform,
|
458
383
|
osArch
|
459
384
|
});
|
460
385
|
if (osArch === 'arm64') return 'arm64';
|
461
|
-
|
462
386
|
if (osPlatform === 'darwin') {
|
463
387
|
// could possibly be x64 node on arm64 darwin, check if we are being translated by Rosetta
|
464
388
|
// https://stackoverflow.com/a/65347893/3474615
|
@@ -470,7 +394,6 @@ const util = {
|
|
470
394
|
});
|
471
395
|
if (stdout === '1') return 'arm64';
|
472
396
|
}
|
473
|
-
|
474
397
|
if (osPlatform === 'linux') {
|
475
398
|
// could possibly be x64 node on arm64 linux, check the "machine hardware name"
|
476
399
|
// list of names for reference: https://stackoverflow.com/a/45125525/3474615
|
@@ -481,17 +404,15 @@ const util = {
|
|
481
404
|
stdout
|
482
405
|
});
|
483
406
|
if (['aarch64_be', 'aarch64', 'armv8b', 'armv8l'].includes(stdout)) return 'arm64';
|
484
|
-
}
|
485
|
-
|
407
|
+
}
|
486
408
|
|
409
|
+
// eslint-disable-next-line no-restricted-syntax
|
487
410
|
const pkgArch = arch();
|
488
411
|
if (pkgArch === 'x86') return 'ia32';
|
489
412
|
return pkgArch;
|
490
413
|
}
|
491
|
-
|
492
414
|
return this._cachedArch = await _getRealArch();
|
493
415
|
},
|
494
|
-
|
495
416
|
// attention:
|
496
417
|
// when passing relative path to NPM post install hook, the current working
|
497
418
|
// directory is set to the `node_modules/cypress` folder
|
@@ -500,17 +421,14 @@ const util = {
|
|
500
421
|
if (path.isAbsolute(filename)) {
|
501
422
|
return filename;
|
502
423
|
}
|
503
|
-
|
504
424
|
return path.join(process.cwd(), '..', '..', filename);
|
505
425
|
},
|
506
|
-
|
507
426
|
getEnv(varName, trim) {
|
508
427
|
la(is.unemptyString(varName), 'expected environment variable name, not', varName);
|
509
428
|
const configVarName = `npm_config_${varName}`;
|
510
429
|
const configVarNameLower = configVarName.toLowerCase();
|
511
430
|
const packageConfigVarName = `npm_package_config_${varName}`;
|
512
431
|
let result;
|
513
|
-
|
514
432
|
if (process.env.hasOwnProperty(varName)) {
|
515
433
|
debug(`Using ${varName} from environment variable`);
|
516
434
|
result = process.env[varName];
|
@@ -523,7 +441,9 @@ const util = {
|
|
523
441
|
} else if (process.env.hasOwnProperty(packageConfigVarName)) {
|
524
442
|
debug(`Using ${varName} from package.json config`);
|
525
443
|
result = process.env[packageConfigVarName];
|
526
|
-
}
|
444
|
+
}
|
445
|
+
|
446
|
+
// environment variables are often set double quotes to escape characters
|
527
447
|
// and on Windows it can lead to weird things: for example
|
528
448
|
// set FOO="C:\foo.txt" && node -e "console.log('>>>%s<<<', process.env.FOO)"
|
529
449
|
// will print
|
@@ -532,32 +452,25 @@ const util = {
|
|
532
452
|
// so for sanity sake we should first trim whitespace characters and remove
|
533
453
|
// double quotes around environment strings if the caller is expected to
|
534
454
|
// use this environment string as a file path
|
535
|
-
|
536
|
-
|
537
455
|
return trim ? dequote(_.trim(result)) : result;
|
538
456
|
},
|
539
|
-
|
540
457
|
getCacheDir() {
|
541
458
|
return cachedir('Cypress');
|
542
459
|
},
|
543
|
-
|
544
460
|
isPostInstall() {
|
545
461
|
return process.env.npm_lifecycle_event === 'postinstall';
|
546
462
|
},
|
547
|
-
|
548
463
|
exec: execa,
|
549
464
|
stdoutLineMatches,
|
550
465
|
issuesUrl,
|
551
466
|
isBrokenGtkDisplay,
|
552
467
|
logBrokenGtkDisplayWarning,
|
553
468
|
isPossibleLinuxWithIncorrectDisplay,
|
554
|
-
|
555
469
|
getGitHubIssueUrl(number) {
|
556
470
|
la(is.positive(number), 'github issue should be a positive number', number);
|
557
471
|
la(_.isInteger(number), 'github issue should be an integer', number);
|
558
472
|
return `${issuesUrl}/${number}`;
|
559
473
|
},
|
560
|
-
|
561
474
|
getFileChecksum,
|
562
475
|
getFileSize,
|
563
476
|
getApplicationDataFolder
|
package/mount-utils/package.json
CHANGED
@@ -15,8 +15,8 @@
|
|
15
15
|
"devDependencies": {
|
16
16
|
"@rollup/plugin-commonjs": "^17.1.0",
|
17
17
|
"@rollup/plugin-node-resolve": "^11.1.1",
|
18
|
-
"rollup": "
|
19
|
-
"rollup-plugin-dts": "
|
18
|
+
"rollup": "3.7.3",
|
19
|
+
"rollup-plugin-dts": "5.0.0",
|
20
20
|
"rollup-plugin-typescript2": "^0.29.0",
|
21
21
|
"typescript": "^4.7.4"
|
22
22
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress",
|
3
|
-
"version": "12.
|
3
|
+
"version": "12.3.0",
|
4
4
|
"main": "index.js",
|
5
5
|
"scripts": {
|
6
6
|
"postinstall": "node index.js --exec install",
|
@@ -118,8 +118,8 @@
|
|
118
118
|
},
|
119
119
|
"buildInfo": {
|
120
120
|
"commitBranch": "develop",
|
121
|
-
"commitSha": "
|
122
|
-
"commitDate": "
|
121
|
+
"commitSha": "5f536fef9b0962fef2373d07becba8313d5ef126",
|
122
|
+
"commitDate": "2023-01-03T19:45:51.000Z",
|
123
123
|
"stable": true
|
124
124
|
},
|
125
125
|
"description": "Cypress is a next generation front end testing tool built for the modern web",
|
@@ -1,21 +1,16 @@
|
|
1
1
|
|
2
2
|
/**
|
3
3
|
* @cypress/react v0.0.0-development
|
4
|
-
* (c)
|
4
|
+
* (c) 2023 Cypress.io
|
5
5
|
* Released under the MIT License
|
6
6
|
*/
|
7
7
|
|
8
8
|
'use strict';
|
9
9
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
-
|
12
10
|
var React = require('react');
|
13
11
|
var ReactDOM = require('react-dom');
|
14
12
|
|
15
|
-
function
|
16
|
-
|
17
|
-
function _interopNamespace(e) {
|
18
|
-
if (e && e.__esModule) return e;
|
13
|
+
function _interopNamespaceDefault(e) {
|
19
14
|
var n = Object.create(null);
|
20
15
|
if (e) {
|
21
16
|
Object.keys(e).forEach(function (k) {
|
@@ -28,13 +23,11 @@ function _interopNamespace(e) {
|
|
28
23
|
}
|
29
24
|
});
|
30
25
|
}
|
31
|
-
n
|
26
|
+
n.default = e;
|
32
27
|
return Object.freeze(n);
|
33
28
|
}
|
34
29
|
|
35
|
-
var React__namespace = /*#__PURE__*/
|
36
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
37
|
-
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
30
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
38
31
|
|
39
32
|
/**
|
40
33
|
* Gets the display name of the component when possible.
|
@@ -829,7 +822,7 @@ const cleanup = () => {
|
|
829
822
|
* }
|
830
823
|
*/
|
831
824
|
function mount(jsx, options = {}, rerenderKey) {
|
832
|
-
if (major_1(
|
825
|
+
if (major_1(React.version) === 18) {
|
833
826
|
const message = '[cypress/react]: You are using `cypress/react`, which is designed for React <= 17. Consider changing to `cypress/react18`, which is designed for React 18.';
|
834
827
|
console.error(message);
|
835
828
|
Cypress.log({ name: 'warning', message });
|
@@ -837,15 +830,15 @@ function mount(jsx, options = {}, rerenderKey) {
|
|
837
830
|
// Remove last mounted component if cy.mount is called more than once in a test
|
838
831
|
cleanup();
|
839
832
|
const internalOptions = {
|
840
|
-
reactDom:
|
833
|
+
reactDom: ReactDOM,
|
841
834
|
render: (reactComponent, el, reactDomToUse) => {
|
842
|
-
lastReactDom = (reactDomToUse ||
|
835
|
+
lastReactDom = (reactDomToUse || ReactDOM);
|
843
836
|
return lastReactDom.render(reactComponent, el);
|
844
837
|
},
|
845
838
|
unmount: internalUnmount,
|
846
839
|
cleanup,
|
847
840
|
};
|
848
|
-
return makeMountFn('mount', jsx, Object.assign({ ReactDom:
|
841
|
+
return makeMountFn('mount', jsx, Object.assign({ ReactDom: ReactDOM }, options), rerenderKey, internalOptions);
|
849
842
|
}
|
850
843
|
/**
|
851
844
|
* Unmounts the component from the DOM.
|