cypress 15.1.0 → 15.3.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/bin/cypress +3 -1
- package/dist/VerboseRenderer.js +61 -0
- package/dist/cli.js +544 -0
- package/dist/cypress.js +104 -0
- package/dist/errors.js +391 -0
- package/dist/exec/info.js +103 -0
- package/dist/exec/open.js +103 -0
- package/dist/exec/run.js +177 -0
- package/dist/exec/shared.js +55 -0
- package/dist/exec/spawn.js +301 -0
- package/dist/exec/versions.js +67 -0
- package/dist/exec/xvfb.js +118 -0
- package/dist/index.js +52 -0
- package/dist/index.mjs +9 -0
- package/dist/logger.js +55 -0
- package/dist/tasks/cache.js +144 -0
- package/dist/tasks/download.js +304 -0
- package/dist/tasks/get-folder-size.js +44 -0
- package/dist/tasks/install.js +326 -0
- package/dist/tasks/state.js +184 -0
- package/dist/tasks/unzip.js +192 -0
- package/dist/tasks/verify.js +303 -0
- package/dist/util.js +452 -0
- package/package.json +10 -13
- package/types/cypress-automation.d.ts +2 -1
- package/types/cypress.d.ts +1 -0
- package/index.js +0 -27
- package/index.mjs +0 -17
- package/lib/VerboseRenderer.js +0 -58
- package/lib/cli.js +0 -411
- package/lib/cypress.js +0 -98
- package/lib/errors.js +0 -392
- package/lib/exec/info.js +0 -92
- package/lib/exec/open.js +0 -90
- package/lib/exec/run.js +0 -176
- package/lib/exec/shared.js +0 -62
- package/lib/exec/spawn.js +0 -247
- package/lib/exec/versions.js +0 -53
- package/lib/exec/xvfb.js +0 -93
- package/lib/fs.js +0 -4
- package/lib/logger.js +0 -50
- package/lib/tasks/cache.js +0 -132
- package/lib/tasks/download.js +0 -324
- package/lib/tasks/get-folder-size.js +0 -33
- package/lib/tasks/install.js +0 -368
- package/lib/tasks/state.js +0 -185
- package/lib/tasks/unzip.js +0 -200
- package/lib/tasks/verify.js +0 -300
- package/lib/util.js +0 -448
package/dist/util.js
ADDED
@@ -0,0 +1,452 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const lodash_1 = __importDefault(require("lodash"));
|
16
|
+
const assert_1 = __importDefault(require("assert"));
|
17
|
+
const arch_1 = __importDefault(require("arch"));
|
18
|
+
const os_1 = __importDefault(require("os"));
|
19
|
+
const ospath_1 = __importDefault(require("ospath"));
|
20
|
+
const hasha_1 = __importDefault(require("hasha"));
|
21
|
+
const tty_1 = __importDefault(require("tty"));
|
22
|
+
const path_1 = __importDefault(require("path"));
|
23
|
+
const ci_info_1 = require("ci-info");
|
24
|
+
const execa_1 = __importDefault(require("execa"));
|
25
|
+
const systeminformation_1 = __importDefault(require("systeminformation"));
|
26
|
+
const chalk_1 = __importDefault(require("chalk"));
|
27
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
28
|
+
const cachedir_1 = __importDefault(require("cachedir"));
|
29
|
+
const log_symbols_1 = __importDefault(require("log-symbols"));
|
30
|
+
const executable_1 = __importDefault(require("executable"));
|
31
|
+
const process_1 = require("process");
|
32
|
+
const common_tags_1 = require("common-tags");
|
33
|
+
const supports_color_1 = __importDefault(require("supports-color"));
|
34
|
+
const is_installed_globally_1 = __importDefault(require("is-installed-globally"));
|
35
|
+
const logger_1 = __importDefault(require("./logger"));
|
36
|
+
const debug_1 = __importDefault(require("debug"));
|
37
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
38
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
39
|
+
const debug = (0, debug_1.default)('cypress:cli');
|
40
|
+
const issuesUrl = 'https://github.com/cypress-io/cypress/issues';
|
41
|
+
/**
|
42
|
+
* Returns SHA512 of a file
|
43
|
+
*/
|
44
|
+
const getFileChecksum = (filename) => {
|
45
|
+
assert_1.default.ok(lodash_1.default.isString(filename) && !lodash_1.default.isEmpty(filename), 'expected filename');
|
46
|
+
return hasha_1.default.fromFile(filename, { algorithm: 'sha512' });
|
47
|
+
};
|
48
|
+
const getFileSize = (filename) => __awaiter(void 0, void 0, void 0, function* () {
|
49
|
+
assert_1.default.ok(lodash_1.default.isString(filename) && !lodash_1.default.isEmpty(filename), 'expected filename');
|
50
|
+
const { size } = yield fs_extra_1.default.stat(filename);
|
51
|
+
return size;
|
52
|
+
});
|
53
|
+
const isBrokenGtkDisplayRe = /Gtk: cannot open display/;
|
54
|
+
const stringify = (val) => {
|
55
|
+
return lodash_1.default.isObject(val) ? JSON.stringify(val) : val;
|
56
|
+
};
|
57
|
+
function normalizeModuleOptions(options = {}) {
|
58
|
+
return lodash_1.default.mapValues(options, stringify);
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* Returns true if the platform is Linux. We do a lot of different
|
62
|
+
* stuff on Linux (like Xvfb) and it helps to has readable code
|
63
|
+
*/
|
64
|
+
const isLinux = () => {
|
65
|
+
return os_1.default.platform() === 'linux';
|
66
|
+
};
|
67
|
+
/**
|
68
|
+
* If the DISPLAY variable is set incorrectly, when trying to spawn
|
69
|
+
* Cypress executable we get an error like this:
|
70
|
+
```
|
71
|
+
[1005:0509/184205.663837:WARNING:browser_main_loop.cc(258)] Gtk: cannot open display: 99
|
72
|
+
```
|
73
|
+
*/
|
74
|
+
const isBrokenGtkDisplay = (str) => {
|
75
|
+
return isBrokenGtkDisplayRe.test(str);
|
76
|
+
};
|
77
|
+
const isPossibleLinuxWithIncorrectDisplay = () => {
|
78
|
+
return isLinux() && !!process.env.DISPLAY;
|
79
|
+
};
|
80
|
+
const logBrokenGtkDisplayWarning = () => {
|
81
|
+
debug('Cypress exited due to a broken gtk display because of a potential invalid DISPLAY env... retrying after starting Xvfb');
|
82
|
+
// if we get this error, we are on Linux and DISPLAY is set
|
83
|
+
logger_1.default.warn((0, common_tags_1.stripIndent) `
|
84
|
+
|
85
|
+
${log_symbols_1.default.warning} Warning: Cypress failed to start.
|
86
|
+
|
87
|
+
This is likely due to a misconfigured DISPLAY environment variable.
|
88
|
+
|
89
|
+
DISPLAY was set to: "${process.env.DISPLAY}"
|
90
|
+
|
91
|
+
Cypress will attempt to fix the problem and rerun.
|
92
|
+
`);
|
93
|
+
logger_1.default.warn();
|
94
|
+
};
|
95
|
+
function stdoutLineMatches(expectedLine, stdout) {
|
96
|
+
const lines = stdout.split('\n').map((val) => val.trim());
|
97
|
+
return lines.some((line) => line === expectedLine);
|
98
|
+
}
|
99
|
+
/**
|
100
|
+
* Confirms if given value is a valid CYPRESS_INTERNAL_ENV value. Undefined values
|
101
|
+
* are valid, because the system can set the default one.
|
102
|
+
*
|
103
|
+
* @param {string} value
|
104
|
+
* @example util.isValidCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
105
|
+
*/
|
106
|
+
function isValidCypressInternalEnvValue(value) {
|
107
|
+
if (lodash_1.default.isUndefined(value)) {
|
108
|
+
// will get default value
|
109
|
+
return true;
|
110
|
+
}
|
111
|
+
// names of config environments, see "packages/server/config/app.json"
|
112
|
+
const names = ['development', 'test', 'staging', 'production'];
|
113
|
+
return lodash_1.default.includes(names, value);
|
114
|
+
}
|
115
|
+
/**
|
116
|
+
* Confirms if given value is a non-production CYPRESS_INTERNAL_ENV value.
|
117
|
+
* Undefined values are valid, because the system can set the default one.
|
118
|
+
*
|
119
|
+
* @param {string} value
|
120
|
+
* @example util.isNonProductionCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
121
|
+
*/
|
122
|
+
function isNonProductionCypressInternalEnvValue(value) {
|
123
|
+
return !lodash_1.default.isUndefined(value) && value !== 'production';
|
124
|
+
}
|
125
|
+
/**
|
126
|
+
* Prints NODE_OPTIONS using debug() module, but only
|
127
|
+
* if DEBUG=cypress... is set
|
128
|
+
*/
|
129
|
+
function printNodeOptions(log = debug) {
|
130
|
+
if (!log.enabled) {
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
if (process.env.NODE_OPTIONS) {
|
134
|
+
log('NODE_OPTIONS=%s', process.env.NODE_OPTIONS);
|
135
|
+
}
|
136
|
+
else {
|
137
|
+
log('NODE_OPTIONS is not set');
|
138
|
+
}
|
139
|
+
}
|
140
|
+
/**
|
141
|
+
* Removes double quote characters
|
142
|
+
* from the start and end of the given string IF they are both present
|
143
|
+
*
|
144
|
+
* @param {string} str Input string
|
145
|
+
* @returns {string} Trimmed string or the original string if there are no double quotes around it.
|
146
|
+
* @example
|
147
|
+
```
|
148
|
+
dequote('"foo"')
|
149
|
+
// returns string 'foo'
|
150
|
+
dequote('foo')
|
151
|
+
// returns string 'foo'
|
152
|
+
```
|
153
|
+
*/
|
154
|
+
const dequote = (str) => {
|
155
|
+
assert_1.default.ok(lodash_1.default.isString(str), 'expected a string to remove double quotes');
|
156
|
+
if (str.length > 1 && str[0] === '"' && str[str.length - 1] === '"') {
|
157
|
+
return str.substr(1, str.length - 2);
|
158
|
+
}
|
159
|
+
return str;
|
160
|
+
};
|
161
|
+
const parseOpts = (opts) => {
|
162
|
+
opts = lodash_1.default.pick(opts, 'autoCancelAfterFailures', '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', 'runnerUi', 'runProject', 'spec', 'tag');
|
163
|
+
if (opts.exit) {
|
164
|
+
opts = lodash_1.default.omit(opts, 'exit');
|
165
|
+
}
|
166
|
+
// some options might be quoted - which leads to unexpected results
|
167
|
+
// remove double quotes from certain options
|
168
|
+
const cleanOpts = Object.assign({}, opts);
|
169
|
+
const toDequote = ['group', 'ciBuildId'];
|
170
|
+
for (const prop of toDequote) {
|
171
|
+
if (lodash_1.default.has(opts, prop)) {
|
172
|
+
cleanOpts[prop] = dequote(opts[prop]);
|
173
|
+
}
|
174
|
+
}
|
175
|
+
debug('parsed cli options %o', cleanOpts);
|
176
|
+
return cleanOpts;
|
177
|
+
};
|
178
|
+
/**
|
179
|
+
* Copy of packages/server/lib/browsers/utils.ts
|
180
|
+
* because we need same functionality in CLI to show the path :(
|
181
|
+
*/
|
182
|
+
const getApplicationDataFolder = (...paths) => {
|
183
|
+
const { env } = process;
|
184
|
+
// allow overriding the app_data folder
|
185
|
+
let folder = env.CYPRESS_CONFIG_ENV || env.CYPRESS_INTERNAL_ENV || 'development';
|
186
|
+
// @ts-expect-error value exists but is not typed
|
187
|
+
const PRODUCT_NAME = package_json_1.default.productName || package_json_1.default.name;
|
188
|
+
const OS_DATA_PATH = ospath_1.default.data();
|
189
|
+
const ELECTRON_APP_DATA_PATH = path_1.default.join(OS_DATA_PATH, PRODUCT_NAME);
|
190
|
+
if (process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF) {
|
191
|
+
folder = `${folder}-e2e-test`;
|
192
|
+
}
|
193
|
+
const p = path_1.default.join(ELECTRON_APP_DATA_PATH, 'cy', folder, ...paths);
|
194
|
+
return p;
|
195
|
+
};
|
196
|
+
const util = {
|
197
|
+
normalizeModuleOptions,
|
198
|
+
parseOpts,
|
199
|
+
isValidCypressInternalEnvValue,
|
200
|
+
isNonProductionCypressInternalEnvValue,
|
201
|
+
printNodeOptions,
|
202
|
+
isCi() {
|
203
|
+
return ci_info_1.isCI;
|
204
|
+
},
|
205
|
+
getEnvOverrides(options = {}) {
|
206
|
+
return lodash_1.default
|
207
|
+
.chain({})
|
208
|
+
.extend(this.getEnvColors())
|
209
|
+
.extend(this.getForceTty())
|
210
|
+
.omitBy(lodash_1.default.isUndefined) // remove undefined values
|
211
|
+
.mapValues((value) => {
|
212
|
+
return value ? '1' : '0';
|
213
|
+
})
|
214
|
+
.extend(this.getOriginalNodeOptions())
|
215
|
+
.value();
|
216
|
+
},
|
217
|
+
getOriginalNodeOptions() {
|
218
|
+
const opts = {};
|
219
|
+
if (process.env.NODE_OPTIONS) {
|
220
|
+
opts.ORIGINAL_NODE_OPTIONS = process.env.NODE_OPTIONS;
|
221
|
+
}
|
222
|
+
return opts;
|
223
|
+
},
|
224
|
+
getForceTty() {
|
225
|
+
return {
|
226
|
+
FORCE_STDIN_TTY: this.isTty(process.stdin.fd),
|
227
|
+
FORCE_STDOUT_TTY: this.isTty(process.stdout.fd),
|
228
|
+
FORCE_STDERR_TTY: this.isTty(process.stderr.fd),
|
229
|
+
};
|
230
|
+
},
|
231
|
+
getEnvColors() {
|
232
|
+
const sc = this.supportsColor();
|
233
|
+
return {
|
234
|
+
FORCE_COLOR: sc,
|
235
|
+
DEBUG_COLORS: sc,
|
236
|
+
MOCHA_COLORS: sc ? true : undefined,
|
237
|
+
};
|
238
|
+
},
|
239
|
+
isTty(fd) {
|
240
|
+
return tty_1.default.isatty(fd);
|
241
|
+
},
|
242
|
+
supportsColor() {
|
243
|
+
// if we've been explicitly told not to support
|
244
|
+
// color then turn this off
|
245
|
+
if (process.env.NO_COLOR) {
|
246
|
+
return false;
|
247
|
+
}
|
248
|
+
// https://github.com/cypress-io/cypress/issues/1747
|
249
|
+
// always return true in CI providers
|
250
|
+
if (process.env.CI) {
|
251
|
+
return true;
|
252
|
+
}
|
253
|
+
// ensure that both stdout and stderr support color
|
254
|
+
return Boolean(supports_color_1.default.stdout) && Boolean(supports_color_1.default.stderr);
|
255
|
+
},
|
256
|
+
cwd() {
|
257
|
+
return (0, process_1.cwd)();
|
258
|
+
},
|
259
|
+
pkgBuildInfo() {
|
260
|
+
// @ts-expect-error value exists but is not typed
|
261
|
+
return package_json_1.default.buildInfo;
|
262
|
+
},
|
263
|
+
pkgVersion() {
|
264
|
+
return package_json_1.default.version;
|
265
|
+
},
|
266
|
+
// TODO: remove this method
|
267
|
+
exit(code) {
|
268
|
+
process.exit(code);
|
269
|
+
},
|
270
|
+
logErrorExit1(err) {
|
271
|
+
logger_1.default.error(err.message);
|
272
|
+
process.exit(1);
|
273
|
+
},
|
274
|
+
dequote,
|
275
|
+
titleize(...args) {
|
276
|
+
// prepend first arg with space
|
277
|
+
// and pad so that all messages line up
|
278
|
+
args[0] = lodash_1.default.padEnd(` ${args[0]}`, 24);
|
279
|
+
// get rid of any falsy values
|
280
|
+
args = lodash_1.default.compact(args);
|
281
|
+
return chalk_1.default.blue(...args);
|
282
|
+
},
|
283
|
+
calculateEta(percent, elapsed) {
|
284
|
+
// returns the number of seconds remaining
|
285
|
+
// if we're at 100% already just return 0
|
286
|
+
if (percent === 100) {
|
287
|
+
return 0;
|
288
|
+
}
|
289
|
+
// take the percentage and divide by one
|
290
|
+
// and multiple that against elapsed
|
291
|
+
// subtracting what's already elapsed
|
292
|
+
return elapsed * (1 / (percent / 100)) - elapsed;
|
293
|
+
},
|
294
|
+
convertPercentToPercentage(num) {
|
295
|
+
// convert a percent with values between 0 and 1
|
296
|
+
// with decimals, so that it is between 0 and 100
|
297
|
+
// and has no decimal places
|
298
|
+
return Math.round(lodash_1.default.isFinite(num) ? (num * 100) : 0);
|
299
|
+
},
|
300
|
+
secsRemaining(eta) {
|
301
|
+
// calculate the seconds reminaing with no decimal places
|
302
|
+
return (lodash_1.default.isFinite(eta) ? (eta / 1000) : 0).toFixed(0);
|
303
|
+
},
|
304
|
+
setTaskTitle(task, title, renderer) {
|
305
|
+
// only update the renderer title when not running in CI
|
306
|
+
if (renderer === 'default' && task.title !== title) {
|
307
|
+
task.title = title;
|
308
|
+
}
|
309
|
+
},
|
310
|
+
isInstalledGlobally() {
|
311
|
+
return is_installed_globally_1.default;
|
312
|
+
},
|
313
|
+
isSemver(str) {
|
314
|
+
return /^(\d+\.)?(\d+\.)?(\*|\d+)$/.test(str);
|
315
|
+
},
|
316
|
+
isExecutableAsync(filePath) {
|
317
|
+
return bluebird_1.default.resolve((0, executable_1.default)(filePath));
|
318
|
+
},
|
319
|
+
isLinux,
|
320
|
+
getOsVersionAsync() {
|
321
|
+
return __awaiter(this, void 0, void 0, function* () {
|
322
|
+
try {
|
323
|
+
const osInfo = yield systeminformation_1.default.osInfo();
|
324
|
+
if (osInfo.distro && osInfo.release) {
|
325
|
+
return `${osInfo.distro} - ${osInfo.release}`;
|
326
|
+
}
|
327
|
+
}
|
328
|
+
catch (err) {
|
329
|
+
return os_1.default.release();
|
330
|
+
}
|
331
|
+
return os_1.default.release();
|
332
|
+
});
|
333
|
+
},
|
334
|
+
getPlatformInfo() {
|
335
|
+
return __awaiter(this, void 0, void 0, function* () {
|
336
|
+
const [version, osArch] = yield bluebird_1.default.all([
|
337
|
+
this.getOsVersionAsync(),
|
338
|
+
this.getRealArch(),
|
339
|
+
]);
|
340
|
+
return (0, common_tags_1.stripIndent) `
|
341
|
+
Platform: ${os_1.default.platform()}-${osArch} (${version})
|
342
|
+
Cypress Version: ${this.pkgVersion()}
|
343
|
+
`;
|
344
|
+
});
|
345
|
+
},
|
346
|
+
_cachedArch: undefined,
|
347
|
+
/**
|
348
|
+
* Attempt to return the real system arch (not process.arch, which is only the Node binary's arch)
|
349
|
+
*/
|
350
|
+
getRealArch() {
|
351
|
+
return __awaiter(this, void 0, void 0, function* () {
|
352
|
+
if (this._cachedArch)
|
353
|
+
return this._cachedArch;
|
354
|
+
function _getRealArch() {
|
355
|
+
return __awaiter(this, void 0, void 0, function* () {
|
356
|
+
const osPlatform = os_1.default.platform();
|
357
|
+
// eslint-disable-next-line no-restricted-syntax
|
358
|
+
const osArch = os_1.default.arch();
|
359
|
+
debug('detecting arch %o', { osPlatform, osArch });
|
360
|
+
if (osArch === 'arm64')
|
361
|
+
return 'arm64';
|
362
|
+
if (osPlatform === 'darwin') {
|
363
|
+
// could possibly be x64 node on arm64 darwin, check if we are being translated by Rosetta
|
364
|
+
// https://stackoverflow.com/a/65347893/3474615
|
365
|
+
const { stdout } = yield (0, execa_1.default)('sysctl', ['-n', 'sysctl.proc_translated']).catch(() => ({ stdout: '' }));
|
366
|
+
debug('rosetta check result: %o', { stdout });
|
367
|
+
if (stdout === '1')
|
368
|
+
return 'arm64';
|
369
|
+
}
|
370
|
+
if (osPlatform === 'linux') {
|
371
|
+
// could possibly be x64 node on arm64 linux, check the "machine hardware name"
|
372
|
+
// list of names for reference: https://stackoverflow.com/a/45125525/3474615
|
373
|
+
const { stdout } = yield (0, execa_1.default)('uname', ['-m']).catch(() => ({ stdout: '' }));
|
374
|
+
debug('arm uname -m result: %o ', { stdout });
|
375
|
+
if (['aarch64_be', 'aarch64', 'armv8b', 'armv8l'].includes(stdout))
|
376
|
+
return 'arm64';
|
377
|
+
}
|
378
|
+
// eslint-disable-next-line no-restricted-syntax
|
379
|
+
const pkgArch = (0, arch_1.default)();
|
380
|
+
if (pkgArch === 'x86')
|
381
|
+
return 'ia32';
|
382
|
+
return pkgArch;
|
383
|
+
});
|
384
|
+
}
|
385
|
+
return (this._cachedArch = yield _getRealArch());
|
386
|
+
});
|
387
|
+
},
|
388
|
+
// attention:
|
389
|
+
// when passing relative path to NPM post install hook, the current working
|
390
|
+
// directory is set to the `node_modules/cypress` folder
|
391
|
+
// the user is probably passing relative path with respect to root package folder
|
392
|
+
formAbsolutePath(filename) {
|
393
|
+
if (path_1.default.isAbsolute(filename)) {
|
394
|
+
return filename;
|
395
|
+
}
|
396
|
+
return path_1.default.join((0, process_1.cwd)(), '..', '..', filename);
|
397
|
+
},
|
398
|
+
getEnv(varName, trim) {
|
399
|
+
assert_1.default.ok(lodash_1.default.isString(varName) && !lodash_1.default.isEmpty(varName), 'expected environment variable name, not');
|
400
|
+
const configVarName = `npm_config_${varName}`;
|
401
|
+
const configVarNameLower = configVarName.toLowerCase();
|
402
|
+
const packageConfigVarName = `npm_package_config_${varName}`;
|
403
|
+
let result;
|
404
|
+
if (process.env.hasOwnProperty(varName)) {
|
405
|
+
debug(`Using ${varName} from environment variable`);
|
406
|
+
result = process.env[varName];
|
407
|
+
}
|
408
|
+
else if (process.env.hasOwnProperty(configVarName)) {
|
409
|
+
debug(`Using ${varName} from npm config`);
|
410
|
+
result = process.env[configVarName];
|
411
|
+
}
|
412
|
+
else if (process.env.hasOwnProperty(configVarNameLower)) {
|
413
|
+
debug(`Using ${varName.toLowerCase()} from npm config`);
|
414
|
+
result = process.env[configVarNameLower];
|
415
|
+
}
|
416
|
+
else if (process.env.hasOwnProperty(packageConfigVarName)) {
|
417
|
+
debug(`Using ${varName} from package.json config`);
|
418
|
+
result = process.env[packageConfigVarName];
|
419
|
+
}
|
420
|
+
// environment variables are often set double quotes to escape characters
|
421
|
+
// and on Windows it can lead to weird things: for example
|
422
|
+
// set FOO="C:\foo.txt" && node -e "console.log('>>>%s<<<', process.env.FOO)"
|
423
|
+
// will print
|
424
|
+
// >>>"C:\foo.txt" <<<
|
425
|
+
// see https://github.com/cypress-io/cypress/issues/4506#issuecomment-506029942
|
426
|
+
// so for sanity sake we should first trim whitespace characters and remove
|
427
|
+
// double quotes around environment strings if the caller is expected to
|
428
|
+
// use this environment string as a file path
|
429
|
+
return trim && (result !== null && result !== undefined) ? dequote(lodash_1.default.trim(result)) : result;
|
430
|
+
},
|
431
|
+
getCacheDir() {
|
432
|
+
return (0, cachedir_1.default)('Cypress');
|
433
|
+
},
|
434
|
+
isPostInstall() {
|
435
|
+
return process.env.npm_lifecycle_event === 'postinstall';
|
436
|
+
},
|
437
|
+
exec: execa_1.default,
|
438
|
+
stdoutLineMatches,
|
439
|
+
issuesUrl,
|
440
|
+
isBrokenGtkDisplay,
|
441
|
+
logBrokenGtkDisplayWarning,
|
442
|
+
isPossibleLinuxWithIncorrectDisplay,
|
443
|
+
getGitHubIssueUrl(number) {
|
444
|
+
assert_1.default.ok(lodash_1.default.isInteger(number), 'github issue should be an integer');
|
445
|
+
assert_1.default.ok(number > 0, 'github issue should be a positive number');
|
446
|
+
return `${issuesUrl}/${number}`;
|
447
|
+
},
|
448
|
+
getFileChecksum,
|
449
|
+
getFileSize,
|
450
|
+
getApplicationDataFolder,
|
451
|
+
};
|
452
|
+
exports.default = util;
|
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress",
|
3
|
-
"version": "15.
|
4
|
-
"main": "index.js",
|
3
|
+
"version": "15.3.0",
|
4
|
+
"main": "dist/index.js",
|
5
5
|
"scripts": {
|
6
|
-
"postinstall": "node index.js --exec install",
|
6
|
+
"postinstall": "node dist/index.js --exec install",
|
7
7
|
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
|
8
8
|
},
|
9
9
|
"dependencies": {
|
@@ -11,13 +11,13 @@
|
|
11
11
|
"@cypress/xvfb": "^1.2.4",
|
12
12
|
"@types/sinonjs__fake-timers": "8.1.1",
|
13
13
|
"@types/sizzle": "^2.3.2",
|
14
|
+
"@types/tmp": "^0.2.3",
|
14
15
|
"arch": "^2.2.0",
|
15
16
|
"blob-util": "^2.0.2",
|
16
17
|
"bluebird": "^3.7.2",
|
17
18
|
"buffer": "^5.7.1",
|
18
19
|
"cachedir": "^2.3.0",
|
19
20
|
"chalk": "^4.1.0",
|
20
|
-
"check-more-types": "^2.24.0",
|
21
21
|
"ci-info": "^4.1.0",
|
22
22
|
"cli-cursor": "^3.1.0",
|
23
23
|
"cli-table3": "0.6.1",
|
@@ -34,7 +34,6 @@
|
|
34
34
|
"fs-extra": "^9.1.0",
|
35
35
|
"hasha": "5.2.2",
|
36
36
|
"is-installed-globally": "~0.4.0",
|
37
|
-
"lazy-ass": "^1.6.0",
|
38
37
|
"listr2": "^3.8.3",
|
39
38
|
"lodash": "^4.17.21",
|
40
39
|
"log-symbols": "^4.0.0",
|
@@ -54,9 +53,7 @@
|
|
54
53
|
},
|
55
54
|
"files": [
|
56
55
|
"bin",
|
57
|
-
"
|
58
|
-
"index.js",
|
59
|
-
"index.mjs",
|
56
|
+
"dist",
|
60
57
|
"types/**/*.d.ts",
|
61
58
|
"mount-utils",
|
62
59
|
"vue",
|
@@ -68,14 +65,14 @@
|
|
68
65
|
"cypress": "bin/cypress"
|
69
66
|
},
|
70
67
|
"engines": {
|
71
|
-
"node": "^20.
|
68
|
+
"node": "^20.1.0 || ^22.0.0 || >=24.0.0"
|
72
69
|
},
|
73
70
|
"types": "types",
|
74
71
|
"exports": {
|
75
72
|
".": {
|
76
73
|
"types": "./types/index.d.ts",
|
77
|
-
"import": "./index.mjs",
|
78
|
-
"require": "./index.js"
|
74
|
+
"import": "./dist/index.mjs",
|
75
|
+
"require": "./dist/index.js"
|
79
76
|
},
|
80
77
|
"./types/net-stubbing": {
|
81
78
|
"types": "./types/net-stubbing.d.ts"
|
@@ -127,8 +124,8 @@
|
|
127
124
|
},
|
128
125
|
"buildInfo": {
|
129
126
|
"commitBranch": "develop",
|
130
|
-
"commitSha": "
|
131
|
-
"commitDate": "2025-09-
|
127
|
+
"commitSha": "556243acd780b95ad2ff7a1635fdd5cec56a97b6",
|
128
|
+
"commitDate": "2025-09-23T16:51:17.000Z",
|
132
129
|
"stable": true
|
133
130
|
},
|
134
131
|
"description": "Cypress is a next generation front end testing tool built for the modern web",
|
package/types/cypress.d.ts
CHANGED
package/index.js
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const minimist = require('minimist');
|
4
|
-
const debug = require('debug')('cypress:cli');
|
5
|
-
const args = minimist(process.argv.slice(2));
|
6
|
-
const util = require('./lib/util');
|
7
|
-
|
8
|
-
// we're being used from the command line
|
9
|
-
switch (args.exec) {
|
10
|
-
case 'install':
|
11
|
-
debug('installing Cypress from NPM');
|
12
|
-
require('./lib/tasks/install').start({
|
13
|
-
force: args.force
|
14
|
-
}).catch(util.logErrorExit1);
|
15
|
-
break;
|
16
|
-
case 'verify':
|
17
|
-
// for simple testing in the monorepo
|
18
|
-
debug('verifying Cypress');
|
19
|
-
require('./lib/tasks/verify').start({
|
20
|
-
force: true
|
21
|
-
}) // always force verification
|
22
|
-
.catch(util.logErrorExit1);
|
23
|
-
break;
|
24
|
-
default:
|
25
|
-
debug('exporting Cypress module interface');
|
26
|
-
module.exports = require('./lib/cypress');
|
27
|
-
}
|
package/index.mjs
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import module from 'module'
|
2
|
-
|
3
|
-
const require = module.createRequire(import.meta.url)
|
4
|
-
|
5
|
-
const cypress = require('./lib/cypress')
|
6
|
-
|
7
|
-
export default cypress
|
8
|
-
|
9
|
-
export const defineConfig = cypress.defineConfig
|
10
|
-
|
11
|
-
export const defineComponentFramework = cypress.defineComponentFramework
|
12
|
-
|
13
|
-
export const run = cypress.run
|
14
|
-
|
15
|
-
export const open = cypress.open
|
16
|
-
|
17
|
-
export const cli = cypress.cli
|
package/lib/VerboseRenderer.js
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
// Vendored from @cypress/listr-verbose-renderer
|
4
|
-
const figures = require('figures');
|
5
|
-
const cliCursor = require('cli-cursor');
|
6
|
-
const chalk = require('chalk');
|
7
|
-
const dayjs = require('dayjs');
|
8
|
-
const formattedLog = (options, output) => {
|
9
|
-
const timestamp = dayjs().format(options.dateFormat);
|
10
|
-
|
11
|
-
// eslint-disable-next-line no-console
|
12
|
-
console.log(`${chalk.dim(`[${timestamp}]`)} ${output}`);
|
13
|
-
};
|
14
|
-
const renderHelper = (task, event, options) => {
|
15
|
-
const log = formattedLog.bind(undefined, options);
|
16
|
-
if (event.type === 'STATE') {
|
17
|
-
const message = task.isPending() ? 'started' : task.state;
|
18
|
-
log(`${task.title} [${message}]`);
|
19
|
-
if (task.isSkipped() && task.output) {
|
20
|
-
log(`${figures.arrowRight} ${task.output}`);
|
21
|
-
}
|
22
|
-
} else if (event.type === 'TITLE') {
|
23
|
-
log(`${task.title} [title changed]`);
|
24
|
-
}
|
25
|
-
};
|
26
|
-
const render = (tasks, options) => {
|
27
|
-
for (const task of tasks) {
|
28
|
-
task.subscribe(event => {
|
29
|
-
if (event.type === 'SUBTASKS') {
|
30
|
-
render(task.subtasks, options);
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
renderHelper(task, event, options);
|
34
|
-
}, err => {
|
35
|
-
// eslint-disable-next-line no-console
|
36
|
-
console.log(err);
|
37
|
-
});
|
38
|
-
}
|
39
|
-
};
|
40
|
-
class VerboseRenderer {
|
41
|
-
constructor(tasks, options) {
|
42
|
-
this._tasks = tasks;
|
43
|
-
this._options = Object.assign({
|
44
|
-
dateFormat: 'HH:mm:ss'
|
45
|
-
}, options);
|
46
|
-
}
|
47
|
-
static get nonTTY() {
|
48
|
-
return true;
|
49
|
-
}
|
50
|
-
render() {
|
51
|
-
cliCursor.hide();
|
52
|
-
render(this._tasks, this._options);
|
53
|
-
}
|
54
|
-
end() {
|
55
|
-
cliCursor.show();
|
56
|
-
}
|
57
|
-
}
|
58
|
-
module.exports = VerboseRenderer;
|