cypress 15.2.0 → 15.4.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.
@@ -1,8 +1,18 @@
1
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
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
5
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.needsSandbox = exports.start = exports.verifyTestRunnerTimeoutMs = void 0;
6
16
  const lodash_1 = __importDefault(require("lodash"));
7
17
  const chalk_1 = __importDefault(require("chalk"));
8
18
  const listr2_1 = require("listr2");
@@ -19,60 +29,48 @@ const logger_1 = __importDefault(require("../logger"));
19
29
  const xvfb_1 = __importDefault(require("../exec/xvfb"));
20
30
  const state_1 = __importDefault(require("./state"));
21
31
  const debug = (0, debug_1.default)('cypress:cli');
22
- const VERIFY_TEST_RUNNER_TIMEOUT_MS = (() => {
32
+ const verifyTestRunnerTimeoutMs = () => {
23
33
  const verifyTimeout = +((util_1.default === null || util_1.default === void 0 ? void 0 : util_1.default.getEnv('CYPRESS_VERIFY_TIMEOUT')) || 'NaN');
24
34
  if (lodash_1.default.isNumber(verifyTimeout) && !lodash_1.default.isNaN(verifyTimeout)) {
25
35
  return verifyTimeout;
26
36
  }
27
37
  return 30000;
28
- })();
29
- const checkExecutable = (binaryDir) => {
38
+ };
39
+ exports.verifyTestRunnerTimeoutMs = verifyTestRunnerTimeoutMs;
40
+ const checkExecutable = (binaryDir) => __awaiter(void 0, void 0, void 0, function* () {
30
41
  const executable = state_1.default.getPathToExecutable(binaryDir);
31
42
  debug('checking if executable exists', executable);
32
- return util_1.default.isExecutableAsync(executable)
33
- .then((isExecutable) => {
43
+ try {
44
+ const isExecutable = yield util_1.default.isExecutableAsync(executable);
34
45
  debug('Binary is executable? :', isExecutable);
35
46
  if (!isExecutable) {
36
47
  return (0, errors_1.throwFormErrorText)(errors_1.errors.binaryNotExecutable(executable))();
37
48
  }
38
- })
39
- .catch({ code: 'ENOENT' }, () => {
40
- if (util_1.default.isCi()) {
41
- return (0, errors_1.throwFormErrorText)(errors_1.errors.notInstalledCI(executable))();
49
+ }
50
+ catch (err) {
51
+ if (err.code === 'ENOENT') {
52
+ if (util_1.default.isCi()) {
53
+ return (0, errors_1.throwFormErrorText)(errors_1.errors.notInstalledCI(executable))();
54
+ }
55
+ return (0, errors_1.throwFormErrorText)(errors_1.errors.missingApp(binaryDir))((0, common_tags_1.stripIndent) `
56
+ Cypress executable not found at: ${chalk_1.default.cyan(executable)}
57
+ `);
42
58
  }
43
- return (0, errors_1.throwFormErrorText)(errors_1.errors.missingApp(binaryDir))((0, common_tags_1.stripIndent) `
44
- Cypress executable not found at: ${chalk_1.default.cyan(executable)}
45
- `);
46
- });
47
- };
59
+ throw err;
60
+ }
61
+ });
48
62
  const runSmokeTest = (binaryDir, options) => {
49
63
  let executable = state_1.default.getPathToExecutable(binaryDir);
50
- const onSmokeTestError = (smokeTestCommand, linuxWithDisplayEnv) => {
51
- return (err) => {
52
- debug('Smoke test failed:', err);
53
- let errMessage = err.stderr || err.message;
54
- debug('error message:', errMessage);
55
- if (err.timedOut) {
56
- debug('error timedOut is true');
57
- return (0, errors_1.throwFormErrorText)(errors_1.errors.smokeTestFailure(smokeTestCommand, true))(errMessage);
58
- }
59
- if (linuxWithDisplayEnv && util_1.default.isBrokenGtkDisplay(errMessage)) {
60
- util_1.default.logBrokenGtkDisplayWarning();
61
- return (0, errors_1.throwFormErrorText)(errors_1.errors.invalidSmokeTestDisplayError)(errMessage);
62
- }
63
- return (0, errors_1.throwFormErrorText)(errors_1.errors.missingDependency)(errMessage);
64
- };
65
- };
66
64
  const needsXvfb = xvfb_1.default.isNeeded();
67
65
  debug('needs Xvfb?', needsXvfb);
68
66
  /**
69
67
  * Spawn Cypress running smoke test to check if all operating system
70
68
  * dependencies are good.
71
69
  */
72
- const spawn = (linuxWithDisplayEnv) => {
70
+ const spawn = (linuxWithDisplayEnv) => __awaiter(void 0, void 0, void 0, function* () {
73
71
  const random = lodash_1.default.random(0, 1000);
74
72
  const args = ['--smoke-test', `--ping=${random}`];
75
- if (needsSandbox()) {
73
+ if ((0, exports.needsSandbox)()) {
76
74
  // electron requires --no-sandbox to run as root
77
75
  debug('disabling Electron sandbox');
78
76
  args.unshift('--no-sandbox');
@@ -90,9 +88,8 @@ const runSmokeTest = (binaryDir, options) => {
90
88
  env: Object.assign(Object.assign({}, process.env), { FORCE_COLOR: '0' }),
91
89
  timeout: options.smokeTestTimeout,
92
90
  });
93
- return bluebird_1.default.resolve(util_1.default.exec(executable, args, stdioOptions))
94
- .catch(onSmokeTestError(smokeTestCommand, linuxWithDisplayEnv))
95
- .then((result) => {
91
+ try {
92
+ const result = yield util_1.default.exec(executable, args, stdioOptions);
96
93
  // TODO: when execa > 1.1 is released
97
94
  // change this to `result.all` for both stderr and stdout
98
95
  // use lodash to be robust during tests against null result or missing stdout
@@ -104,23 +101,40 @@ const runSmokeTest = (binaryDir, options) => {
104
101
  const errorText = smokeTestStderr || smokeTestStdout;
105
102
  return (0, errors_1.throwFormErrorText)(errors_1.errors.smokeTestFailure(smokeTestCommand, false))(errorText);
106
103
  }
107
- });
108
- };
109
- const spawnInXvfb = (linuxWithDisplayEnv) => {
110
- return xvfb_1.default
111
- .start()
112
- .then(() => {
113
- return spawn(linuxWithDisplayEnv || false);
114
- })
115
- .finally(xvfb_1.default.stop);
116
- };
117
- const userFriendlySpawn = (linuxWithDisplayEnv) => {
104
+ }
105
+ catch (err) {
106
+ debug('Smoke test failed:', err);
107
+ let errMessage = err.stderr || err.message;
108
+ debug('error message:', errMessage);
109
+ if (err.timedOut) {
110
+ debug('error timedOut is true');
111
+ return (0, errors_1.throwFormErrorText)(errors_1.errors.smokeTestFailure(smokeTestCommand, true))(errMessage);
112
+ }
113
+ if (linuxWithDisplayEnv && util_1.default.isBrokenGtkDisplay(errMessage)) {
114
+ util_1.default.logBrokenGtkDisplayWarning();
115
+ return (0, errors_1.throwFormErrorText)(errors_1.errors.invalidSmokeTestDisplayError)(errMessage);
116
+ }
117
+ return (0, errors_1.throwFormErrorText)(errors_1.errors.missingDependency)(errMessage);
118
+ }
119
+ });
120
+ const spawnInXvfb = (linuxWithDisplayEnv) => __awaiter(void 0, void 0, void 0, function* () {
121
+ yield xvfb_1.default.start();
122
+ return spawn(linuxWithDisplayEnv || false).finally(() => __awaiter(void 0, void 0, void 0, function* () {
123
+ yield xvfb_1.default.stop();
124
+ }));
125
+ });
126
+ const userFriendlySpawn = (linuxWithDisplayEnv) => __awaiter(void 0, void 0, void 0, function* () {
118
127
  debug('spawning, should retry on display problem?', Boolean(linuxWithDisplayEnv));
119
- return spawn(linuxWithDisplayEnv)
120
- .catch({ code: 'INVALID_SMOKE_TEST_DISPLAY_ERROR' }, () => {
121
- return spawnInXvfb(linuxWithDisplayEnv);
122
- });
123
- };
128
+ try {
129
+ yield spawn(linuxWithDisplayEnv);
130
+ }
131
+ catch (err) {
132
+ if (err.code === 'INVALID_SMOKE_TEST_DISPLAY_ERROR') {
133
+ return spawnInXvfb(linuxWithDisplayEnv);
134
+ }
135
+ throw err;
136
+ }
137
+ });
124
138
  if (needsXvfb) {
125
139
  return spawnInXvfb();
126
140
  }
@@ -152,49 +166,39 @@ function testBinary(version, binaryDir, options) {
152
166
  const tasks = new listr2_1.Listr([
153
167
  {
154
168
  title: util_1.default.titleize('Verifying Cypress can run', chalk_1.default.gray(binaryDir)),
155
- task: (ctx, task) => {
169
+ task: (ctx, task) => __awaiter(this, void 0, void 0, function* () {
156
170
  debug('clearing out the verified version');
157
- return state_1.default.clearBinaryStateAsync(binaryDir)
158
- .then(() => {
159
- return bluebird_1.default.all([
160
- runSmokeTest(binaryDir, options),
161
- bluebird_1.default.delay(1500), // good user experience
162
- ]);
163
- })
164
- .then(() => {
165
- debug('write verified: true');
166
- return state_1.default.writeBinaryVerifiedAsync(true, binaryDir);
167
- })
168
- .then(() => {
169
- util_1.default.setTaskTitle(task, util_1.default.titleize(chalk_1.default.green('Verified Cypress!'), chalk_1.default.gray(binaryDir)), rendererOptions.renderer);
170
- });
171
- },
171
+ yield state_1.default.clearBinaryStateAsync(binaryDir);
172
+ yield Promise.all([
173
+ runSmokeTest(binaryDir, options),
174
+ bluebird_1.default.delay(1500), // good user experience
175
+ ]);
176
+ debug('write verified: true');
177
+ yield state_1.default.writeBinaryVerifiedAsync(true, binaryDir);
178
+ util_1.default.setTaskTitle(task, util_1.default.titleize(chalk_1.default.green('Verified Cypress!'), chalk_1.default.gray(binaryDir)), rendererOptions.renderer);
179
+ }),
172
180
  },
173
181
  ], rendererOptions);
174
182
  return tasks.run();
175
183
  }
176
- const maybeVerify = (installedVersion, binaryDir, options) => {
177
- return state_1.default.getBinaryVerifiedAsync(binaryDir)
178
- .then((isVerified) => {
179
- debug('is Verified ?', isVerified);
180
- let shouldVerify = !isVerified;
181
- // force verify if options.force
182
- if (options.force) {
183
- debug('force verify');
184
- shouldVerify = true;
185
- }
186
- if (shouldVerify) {
187
- return testBinary(installedVersion, binaryDir, options)
188
- .then(() => {
189
- if (options.welcomeMessage) {
190
- logger_1.default.log();
191
- logger_1.default.log('Opening Cypress...');
192
- }
193
- });
184
+ const maybeVerify = (installedVersion, binaryDir, options) => __awaiter(void 0, void 0, void 0, function* () {
185
+ const isVerified = yield state_1.default.getBinaryVerifiedAsync(binaryDir);
186
+ debug('is Verified ?', isVerified);
187
+ let shouldVerify = !isVerified;
188
+ // force verify if options.force
189
+ if (options.force) {
190
+ debug('force verify');
191
+ shouldVerify = true;
192
+ }
193
+ if (shouldVerify) {
194
+ yield testBinary(installedVersion, binaryDir, options);
195
+ if (options.welcomeMessage) {
196
+ logger_1.default.log();
197
+ logger_1.default.log('Opening Cypress...');
194
198
  }
195
- });
196
- };
197
- const start = (options = {}) => {
199
+ }
200
+ });
201
+ const start = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (options = {}) {
198
202
  debug('verifying Cypress app');
199
203
  const packageVersion = util_1.default.pkgVersion();
200
204
  let binaryDir = state_1.default.getBinaryDir(packageVersion);
@@ -202,17 +206,17 @@ const start = (options = {}) => {
202
206
  dev: false,
203
207
  force: false,
204
208
  welcomeMessage: true,
205
- smokeTestTimeout: VERIFY_TEST_RUNNER_TIMEOUT_MS,
209
+ smokeTestTimeout: (0, exports.verifyTestRunnerTimeoutMs)(),
206
210
  skipVerify: util_1.default.getEnv('CYPRESS_SKIP_VERIFY') === 'true',
207
211
  });
208
212
  if (options.skipVerify) {
209
213
  debug('skipping verification of the Cypress app');
210
- return bluebird_1.default.resolve();
214
+ return Promise.resolve();
211
215
  }
212
216
  if (options.dev) {
213
217
  return runSmokeTest('', options);
214
218
  }
215
- const parseBinaryEnvVar = () => {
219
+ const parseBinaryEnvVar = () => __awaiter(void 0, void 0, void 0, function* () {
216
220
  const envBinaryPath = util_1.default.getEnv('CYPRESS_RUN_BINARY');
217
221
  debug('CYPRESS_RUN_BINARY exists, =', envBinaryPath);
218
222
  logger_1.default.log((0, common_tags_1.stripIndent) `
@@ -223,48 +227,37 @@ const start = (options = {}) => {
223
227
  This overrides the default Cypress binary path used.
224
228
  `);
225
229
  logger_1.default.log();
226
- return util_1.default.isExecutableAsync(envBinaryPath)
227
- .then((isExecutable) => {
230
+ try {
231
+ const isExecutable = yield util_1.default.isExecutableAsync(envBinaryPath);
228
232
  debug('CYPRESS_RUN_BINARY is executable? :', isExecutable);
229
233
  if (!isExecutable) {
230
234
  return (0, errors_1.throwFormErrorText)(errors_1.errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))((0, common_tags_1.stripIndent) `
231
- The supplied binary path is not executable
232
- `);
235
+ The supplied binary path is not executable
236
+ `);
233
237
  }
234
- })
235
- .then(() => {
236
- return state_1.default.parseRealPlatformBinaryFolderAsync(envBinaryPath);
237
- })
238
- .then((envBinaryDir) => {
238
+ const envBinaryDir = yield state_1.default.parseRealPlatformBinaryFolderAsync(envBinaryPath);
239
239
  if (!envBinaryDir) {
240
240
  return (0, errors_1.throwFormErrorText)(errors_1.errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))();
241
241
  }
242
242
  debug('CYPRESS_RUN_BINARY has binaryDir:', envBinaryDir);
243
243
  binaryDir = envBinaryDir;
244
- })
245
- .catch({ code: 'ENOENT' }, (err) => {
246
- return (0, errors_1.throwFormErrorText)(errors_1.errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))(err.message);
247
- });
248
- };
249
- return bluebird_1.default.try(() => {
244
+ }
245
+ catch (err) {
246
+ if (err.code === 'ENOENT') {
247
+ return (0, errors_1.throwFormErrorText)(errors_1.errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))(err.message);
248
+ }
249
+ throw err;
250
+ }
251
+ });
252
+ try {
250
253
  debug('checking environment variables');
251
254
  if (util_1.default.getEnv('CYPRESS_RUN_BINARY')) {
252
- return parseBinaryEnvVar();
255
+ yield parseBinaryEnvVar();
253
256
  }
254
- })
255
- .then(() => {
256
- return checkExecutable(binaryDir);
257
- })
258
- .tap(() => {
259
- return debug('binaryDir is ', binaryDir);
260
- })
261
- .then(() => {
262
- return state_1.default.getBinaryPkgAsync(binaryDir);
263
- })
264
- .then((pkg) => {
265
- return state_1.default.getBinaryPkgVersion(pkg);
266
- })
267
- .then((binaryVersion) => {
257
+ yield checkExecutable(binaryDir);
258
+ debug('binaryDir is ', binaryDir);
259
+ const pkg = yield state_1.default.getBinaryPkgAsync(binaryDir);
260
+ const binaryVersion = state_1.default.getBinaryPkgVersion(pkg);
268
261
  if (!binaryVersion) {
269
262
  debug('no Cypress binary found for cli version ', packageVersion);
270
263
  return (0, errors_1.throwFormErrorText)(errors_1.errors.missingApp(binaryDir))(`
@@ -286,15 +279,16 @@ const start = (options = {}) => {
286
279
  `);
287
280
  logger_1.default.log();
288
281
  }
289
- return maybeVerify(binaryVersion, binaryDir, options);
290
- })
291
- .catch((err) => {
282
+ yield maybeVerify(binaryVersion, binaryDir, options);
283
+ }
284
+ catch (err) {
292
285
  if (err.known) {
293
286
  throw err;
294
287
  }
295
288
  return (0, errors_1.throwFormErrorText)(errors_1.errors.unexpected)(err.stack);
296
- });
297
- };
289
+ }
290
+ });
291
+ exports.start = start;
298
292
  const isLinuxLike = () => os_1.default.platform() !== 'win32';
299
293
  /**
300
294
  * Returns true if running on a system where Electron needs "--no-sandbox" flag.
@@ -306,8 +300,4 @@ const isLinuxLike = () => os_1.default.platform() !== 'win32';
306
300
  * @see https://github.com/electron/electron/issues/17972
307
301
  */
308
302
  const needsSandbox = () => isLinuxLike();
309
- exports.default = {
310
- start,
311
- needsSandbox,
312
- VERIFY_TEST_RUNNER_TIMEOUT_MS,
313
- };
303
+ exports.needsSandbox = needsSandbox;
@@ -13,12 +13,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const lodash_1 = __importDefault(require("lodash"));
16
+ const assert_1 = __importDefault(require("assert"));
16
17
  const arch_1 = __importDefault(require("arch"));
17
18
  const os_1 = __importDefault(require("os"));
18
19
  const ospath_1 = __importDefault(require("ospath"));
19
20
  const hasha_1 = __importDefault(require("hasha"));
20
- const lazy_ass_1 = __importDefault(require("lazy-ass"));
21
- const check_more_types_1 = __importDefault(require("check-more-types"));
22
21
  const tty_1 = __importDefault(require("tty"));
23
22
  const path_1 = __importDefault(require("path"));
24
23
  const ci_info_1 = require("ci-info");
@@ -29,27 +28,28 @@ const bluebird_1 = __importDefault(require("bluebird"));
29
28
  const cachedir_1 = __importDefault(require("cachedir"));
30
29
  const log_symbols_1 = __importDefault(require("log-symbols"));
31
30
  const executable_1 = __importDefault(require("executable"));
31
+ const process_1 = require("process");
32
32
  const common_tags_1 = require("common-tags");
33
33
  const supports_color_1 = __importDefault(require("supports-color"));
34
34
  const is_installed_globally_1 = __importDefault(require("is-installed-globally"));
35
35
  const logger_1 = __importDefault(require("./logger"));
36
36
  const debug_1 = __importDefault(require("debug"));
37
- const fs_1 = __importDefault(require("./fs"));
37
+ const fs_extra_1 = __importDefault(require("fs-extra"));
38
+ const package_json_1 = __importDefault(require("../package.json"));
38
39
  const debug = (0, debug_1.default)('cypress:cli');
39
- // Import package.json dynamically to avoid TypeScript JSON import issues
40
- const pkg = require(path_1.default.join(__dirname, '..', 'package.json'));
41
40
  const issuesUrl = 'https://github.com/cypress-io/cypress/issues';
42
41
  /**
43
42
  * Returns SHA512 of a file
44
43
  */
45
44
  const getFileChecksum = (filename) => {
46
- (0, lazy_ass_1.default)(check_more_types_1.default.unemptyString(filename), 'expected filename', filename);
45
+ assert_1.default.ok(lodash_1.default.isString(filename) && !lodash_1.default.isEmpty(filename), 'expected filename');
47
46
  return hasha_1.default.fromFile(filename, { algorithm: 'sha512' });
48
47
  };
49
- const getFileSize = (filename) => {
50
- (0, lazy_ass_1.default)(check_more_types_1.default.unemptyString(filename), 'expected filename', filename);
51
- return fs_1.default.statAsync(filename).get('size');
52
- };
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
53
  const isBrokenGtkDisplayRe = /Gtk: cannot open display/;
54
54
  const stringify = (val) => {
55
55
  return lodash_1.default.isObject(val) ? JSON.stringify(val) : val;
@@ -152,15 +152,14 @@ function printNodeOptions(log = debug) {
152
152
  ```
153
153
  */
154
154
  const dequote = (str) => {
155
- // @ts-expect-error method exists but is not typed
156
- (0, lazy_ass_1.default)(check_more_types_1.default.string(str), 'expected a string to remove double quotes', str);
155
+ assert_1.default.ok(lodash_1.default.isString(str), 'expected a string to remove double quotes');
157
156
  if (str.length > 1 && str[0] === '"' && str[str.length - 1] === '"') {
158
157
  return str.substr(1, str.length - 2);
159
158
  }
160
159
  return str;
161
160
  };
162
161
  const parseOpts = (opts) => {
163
- 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');
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', 'posixExitCodes', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'runnerUi', 'runProject', 'spec', 'tag');
164
163
  if (opts.exit) {
165
164
  opts = lodash_1.default.omit(opts, 'exit');
166
165
  }
@@ -184,7 +183,8 @@ const getApplicationDataFolder = (...paths) => {
184
183
  const { env } = process;
185
184
  // allow overriding the app_data folder
186
185
  let folder = env.CYPRESS_CONFIG_ENV || env.CYPRESS_INTERNAL_ENV || 'development';
187
- const PRODUCT_NAME = pkg.productName || pkg.name;
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
188
  const OS_DATA_PATH = ospath_1.default.data();
189
189
  const ELECTRON_APP_DATA_PATH = path_1.default.join(OS_DATA_PATH, PRODUCT_NAME);
190
190
  if (process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF) {
@@ -205,13 +205,13 @@ const util = {
205
205
  getEnvOverrides(options = {}) {
206
206
  return lodash_1.default
207
207
  .chain({})
208
- .extend(util.getEnvColors())
209
- .extend(util.getForceTty())
208
+ .extend(this.getEnvColors())
209
+ .extend(this.getForceTty())
210
210
  .omitBy(lodash_1.default.isUndefined) // remove undefined values
211
211
  .mapValues((value) => {
212
212
  return value ? '1' : '0';
213
213
  })
214
- .extend(util.getOriginalNodeOptions())
214
+ .extend(this.getOriginalNodeOptions())
215
215
  .value();
216
216
  },
217
217
  getOriginalNodeOptions() {
@@ -223,13 +223,13 @@ const util = {
223
223
  },
224
224
  getForceTty() {
225
225
  return {
226
- FORCE_STDIN_TTY: util.isTty(process.stdin.fd),
227
- FORCE_STDOUT_TTY: util.isTty(process.stdout.fd),
228
- FORCE_STDERR_TTY: util.isTty(process.stderr.fd),
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
229
  };
230
230
  },
231
231
  getEnvColors() {
232
- const sc = util.supportsColor();
232
+ const sc = this.supportsColor();
233
233
  return {
234
234
  FORCE_COLOR: sc,
235
235
  DEBUG_COLORS: sc,
@@ -254,14 +254,16 @@ const util = {
254
254
  return Boolean(supports_color_1.default.stdout) && Boolean(supports_color_1.default.stderr);
255
255
  },
256
256
  cwd() {
257
- return process.cwd();
257
+ return (0, process_1.cwd)();
258
258
  },
259
259
  pkgBuildInfo() {
260
- return pkg.buildInfo;
260
+ // @ts-expect-error value exists but is not typed
261
+ return package_json_1.default.buildInfo;
261
262
  },
262
263
  pkgVersion() {
263
- return pkg.version;
264
+ return package_json_1.default.version;
264
265
  },
266
+ // TODO: remove this method
265
267
  exit(code) {
266
268
  process.exit(code);
267
269
  },
@@ -316,27 +318,28 @@ const util = {
316
318
  },
317
319
  isLinux,
318
320
  getOsVersionAsync() {
319
- return bluebird_1.default.try(() => {
320
- return systeminformation_1.default.osInfo()
321
- .then((osInfo) => {
321
+ return __awaiter(this, void 0, void 0, function* () {
322
+ try {
323
+ const osInfo = yield systeminformation_1.default.osInfo();
322
324
  if (osInfo.distro && osInfo.release) {
323
325
  return `${osInfo.distro} - ${osInfo.release}`;
324
326
  }
327
+ }
328
+ catch (err) {
325
329
  return os_1.default.release();
326
- }).catch(() => {
327
- return os_1.default.release();
328
- });
330
+ }
331
+ return os_1.default.release();
329
332
  });
330
333
  },
331
334
  getPlatformInfo() {
332
335
  return __awaiter(this, void 0, void 0, function* () {
333
336
  const [version, osArch] = yield bluebird_1.default.all([
334
- util.getOsVersionAsync(),
337
+ this.getOsVersionAsync(),
335
338
  this.getRealArch(),
336
339
  ]);
337
340
  return (0, common_tags_1.stripIndent) `
338
341
  Platform: ${os_1.default.platform()}-${osArch} (${version})
339
- Cypress Version: ${util.pkgVersion()}
342
+ Cypress Version: ${this.pkgVersion()}
340
343
  `;
341
344
  });
342
345
  },
@@ -351,7 +354,6 @@ const util = {
351
354
  function _getRealArch() {
352
355
  return __awaiter(this, void 0, void 0, function* () {
353
356
  const osPlatform = os_1.default.platform();
354
- // eslint-disable-next-line no-restricted-syntax
355
357
  const osArch = os_1.default.arch();
356
358
  debug('detecting arch %o', { osPlatform, osArch });
357
359
  if (osArch === 'arm64')
@@ -372,7 +374,6 @@ const util = {
372
374
  if (['aarch64_be', 'aarch64', 'armv8b', 'armv8l'].includes(stdout))
373
375
  return 'arm64';
374
376
  }
375
- // eslint-disable-next-line no-restricted-syntax
376
377
  const pkgArch = (0, arch_1.default)();
377
378
  if (pkgArch === 'x86')
378
379
  return 'ia32';
@@ -390,10 +391,10 @@ const util = {
390
391
  if (path_1.default.isAbsolute(filename)) {
391
392
  return filename;
392
393
  }
393
- return path_1.default.join(process.cwd(), '..', '..', filename);
394
+ return path_1.default.join((0, process_1.cwd)(), '..', '..', filename);
394
395
  },
395
396
  getEnv(varName, trim) {
396
- (0, lazy_ass_1.default)(check_more_types_1.default.unemptyString(varName), 'expected environment variable name, not', varName);
397
+ assert_1.default.ok(lodash_1.default.isString(varName) && !lodash_1.default.isEmpty(varName), 'expected environment variable name, not');
397
398
  const configVarName = `npm_config_${varName}`;
398
399
  const configVarNameLower = configVarName.toLowerCase();
399
400
  const packageConfigVarName = `npm_package_config_${varName}`;
@@ -438,9 +439,8 @@ const util = {
438
439
  logBrokenGtkDisplayWarning,
439
440
  isPossibleLinuxWithIncorrectDisplay,
440
441
  getGitHubIssueUrl(number) {
441
- // @ts-expect-error method exists but is not typed
442
- (0, lazy_ass_1.default)(check_more_types_1.default.positive(number), 'github issue should be a positive number', number);
443
- (0, lazy_ass_1.default)(lodash_1.default.isInteger(number), 'github issue should be an integer', number);
442
+ assert_1.default.ok(lodash_1.default.isInteger(number), 'github issue should be an integer');
443
+ assert_1.default.ok(number > 0, 'github issue should be a positive number');
444
444
  return `${issuesUrl}/${number}`;
445
445
  },
446
446
  getFileChecksum,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "15.2.0",
4
- "main": "index.js",
3
+ "version": "15.4.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
- "lib",
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.0.0 || ^22.0.0 || >=24.0.0"
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"
@@ -109,6 +106,9 @@
109
106
  "require": "./svelte/dist/cypress-svelte.cjs.js"
110
107
  }
111
108
  },
109
+ "lint-staged": {
110
+ "**/*.{js,jsx,ts,tsx,json,vue}": "eslint --fix"
111
+ },
112
112
  "nx": {
113
113
  "targets": {
114
114
  "build-cli": {
@@ -127,8 +127,8 @@
127
127
  },
128
128
  "buildInfo": {
129
129
  "commitBranch": "develop",
130
- "commitSha": "058e7d26c0a0a2402a15ad5638508cd38777b350",
131
- "commitDate": "2025-09-09T18:54:38.000Z",
130
+ "commitSha": "9005a7b9ca793b903fcad167e1fb3f629b0b44bd",
131
+ "commitDate": "2025-10-07T18:50:02.000Z",
132
132
  "stable": true
133
133
  },
134
134
  "description": "Cypress is a next generation front end testing tool built for the modern web",