cypress 3.3.2 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
package/lib/util.js CHANGED
@@ -9,6 +9,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi
9
9
  var _ = require('lodash');
10
10
  var R = require('ramda');
11
11
  var os = require('os');
12
+ var crypto = require('crypto');
12
13
  var la = require('lazy-ass');
13
14
  var is = require('check-more-types');
14
15
  var tty = require('tty');
@@ -30,11 +31,44 @@ var _isInstalledGlobally = require('is-installed-globally');
30
31
  var pkg = require(path.join(__dirname, '..', 'package.json'));
31
32
  var logger = require('./logger');
32
33
  var debug = require('debug')('cypress:cli');
34
+ var fs = require('./fs');
33
35
 
34
36
  var issuesUrl = 'https://github.com/cypress-io/cypress/issues';
35
37
 
36
38
  var getosAsync = Promise.promisify(getos);
37
39
 
40
+ /**
41
+ * Returns SHA512 of a file
42
+ *
43
+ * Implementation lifted from https://github.com/sindresorhus/hasha
44
+ * but without bringing that dependency (since hasha is Node v8+)
45
+ */
46
+ var getFileChecksum = function getFileChecksum(filename) {
47
+ la(is.unemptyString(filename), 'expected filename', filename);
48
+
49
+ var hashStream = function hashStream() {
50
+ var s = crypto.createHash('sha512');
51
+
52
+ s.setEncoding('hex');
53
+
54
+ return s;
55
+ };
56
+
57
+ return new Promise(function (resolve, reject) {
58
+ var stream = fs.createReadStream(filename);
59
+
60
+ stream.on('error', reject).pipe(hashStream()).on('error', reject).on('finish', function () {
61
+ resolve(this.read());
62
+ });
63
+ });
64
+ };
65
+
66
+ var getFileSize = function getFileSize(filename) {
67
+ la(is.unemptyString(filename), 'expected filename', filename);
68
+
69
+ return fs.statAsync(filename).get('size');
70
+ };
71
+
38
72
  var isBrokenGtkDisplayRe = /Gtk: cannot open display/;
39
73
 
40
74
  var stringify = function stringify(val) {
@@ -75,6 +109,7 @@ var logBrokenGtkDisplayWarning = function logBrokenGtkDisplayWarning() {
75
109
 
76
110
  // if we get this error, we are on Linux and DISPLAY is set
77
111
  logger.warn(stripIndent(_templateObject, logSymbols.warning, process.env.DISPLAY));
112
+
78
113
  logger.warn();
79
114
  };
80
115
 
@@ -85,6 +120,25 @@ function stdoutLineMatches(expectedLine, stdout) {
85
120
  return lines.some(lineMatches);
86
121
  }
87
122
 
123
+ /**
124
+ * Confirms if given value is a valid CYPRESS_ENV value. Undefined values
125
+ * are valid, because the system can set the default one.
126
+ *
127
+ * @param {string} value
128
+ * @example util.isValidCypressEnvValue(process.env.CYPRESS_ENV)
129
+ */
130
+ function isValidCypressEnvValue(value) {
131
+ if (_.isUndefined(value)) {
132
+ // will get default value
133
+ return true;
134
+ }
135
+
136
+ // names of config environments, see "packages/server/config/app.yml"
137
+ var names = ['development', 'test', 'staging', 'production'];
138
+
139
+ return _.includes(names, value);
140
+ }
141
+
88
142
  /**
89
143
  * Prints NODE_OPTIONS using debug() module, but only
90
144
  * if DEBUG=cypress... is set
@@ -103,9 +157,30 @@ function printNodeOptions() {
103
157
  }
104
158
  }
105
159
 
160
+ /**
161
+ * Removes double quote characters
162
+ * from the start and end of the given string IF they are both present
163
+ *
164
+ * @example
165
+ ```
166
+ dequote('"foo"')
167
+ // returns string 'foo'
168
+ dequote('foo')
169
+ // returns string 'foo'
170
+ ```
171
+ */
172
+ var dequote = function dequote(str) {
173
+ la(is.string(str), 'expected a string to remove double quotes', str);
174
+ if (str.length > 1 && str[0] === '"' && str[str.length - 1] === '"') {
175
+ return str.substr(1, str.length - 2);
176
+ }
177
+
178
+ return str;
179
+ };
180
+
106
181
  var util = {
107
182
  normalizeModuleOptions: normalizeModuleOptions,
108
-
183
+ isValidCypressEnvValue: isValidCypressEnvValue,
109
184
  printNodeOptions: printNodeOptions,
110
185
 
111
186
  isCi: function isCi() {
@@ -167,6 +242,10 @@ var util = {
167
242
 
168
243
  process.exit(1);
169
244
  },
245
+
246
+
247
+ dequote: dequote,
248
+
170
249
  titleize: function titleize() {
171
250
  for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
172
251
  args[_key] = arguments[_key];
@@ -184,7 +263,7 @@ var util = {
184
263
  calculateEta: function calculateEta(percent, elapsed) {
185
264
  // returns the number of seconds remaining
186
265
 
187
- // if we're at 100 already just return 0
266
+ // if we're at 100% already just return 0
188
267
  if (percent === 100) {
189
268
  return 0;
190
269
  }
@@ -194,6 +273,12 @@ var util = {
194
273
  // subtracting what's already elapsed
195
274
  return elapsed * (1 / (percent / 100)) - elapsed;
196
275
  },
276
+ convertPercentToPercentage: function convertPercentToPercentage(num) {
277
+ // convert a percent with values between 0 and 1
278
+ // with decimals, so that it is between 0 and 100
279
+ // and has no decimal places
280
+ return Math.round(_.isFinite(num) ? num * 100 : 0);
281
+ },
197
282
  secsRemaining: function secsRemaining(eta) {
198
283
  // calculate the seconds reminaing with no decimal places
199
284
  return (_.isFinite(eta) ? eta / 1000 : 0).toFixed(0);
@@ -244,30 +329,39 @@ var util = {
244
329
 
245
330
  return path.join(process.cwd(), '..', '..', filename);
246
331
  },
247
- getEnv: function getEnv(varName) {
332
+ getEnv: function getEnv(varName, trim) {
333
+ la(is.unemptyString(varName), 'expected environment variable name, not', varName);
334
+
248
335
  var envVar = process.env[varName];
249
336
  var configVar = process.env['npm_config_' + varName];
250
337
  var packageConfigVar = process.env['npm_package_config_' + varName];
251
338
 
339
+ var result = void 0;
340
+
252
341
  if (envVar) {
253
342
  debug('Using ' + varName + ' from environment variable');
254
343
 
255
- return envVar;
256
- }
257
-
258
- if (configVar) {
344
+ result = envVar;
345
+ } else if (configVar) {
259
346
  debug('Using ' + varName + ' from npm config');
260
347
 
261
- return configVar;
262
- }
263
-
264
- if (packageConfigVar) {
348
+ result = configVar;
349
+ } else if (packageConfigVar) {
265
350
  debug('Using ' + varName + ' from package.json config');
266
351
 
267
- return packageConfigVar;
352
+ result = packageConfigVar;
268
353
  }
269
354
 
270
- return undefined;
355
+ // environment variables are often set double quotes to escape characters
356
+ // and on Windows it can lead to weird things: for example
357
+ // set FOO="C:\foo.txt" && node -e "console.log('>>>%s<<<', process.env.FOO)"
358
+ // will print
359
+ // >>>"C:\foo.txt" <<<
360
+ // see https://github.com/cypress-io/cypress/issues/4506#issuecomment-506029942
361
+ // so for sanity sake we should first trim whitespace characters and remove
362
+ // double quotes around environment strings if the caller is expected to
363
+ // use this environment string as a file path
364
+ return trim ? dequote(_.trim(result)) : result;
271
365
  },
272
366
  getCacheDir: function getCacheDir() {
273
367
  return cachedir('Cypress');
@@ -294,7 +388,12 @@ var util = {
294
388
  la(_.isInteger(number), 'github issue should be an integer', number);
295
389
 
296
390
  return issuesUrl + '/' + number;
297
- }
391
+ },
392
+
393
+
394
+ getFileChecksum: getFileChecksum,
395
+
396
+ getFileSize: getFileSize
298
397
  };
299
398
 
300
399
  module.exports = util;
package/package.json CHANGED
@@ -1,21 +1,15 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "3.3.2",
3
+ "version": "3.6.0",
4
4
  "main": "index.js",
5
- "bin": {
6
- "cypress": "bin/cypress"
7
- },
8
- "engines": {
9
- "node": ">=4.0.0"
10
- },
11
5
  "scripts": {
12
6
  "postinstall": "node index.js --exec install",
13
7
  "size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
14
8
  },
15
- "types": "types",
16
9
  "dependencies": {
17
10
  "@cypress/listr-verbose-renderer": "0.4.1",
18
11
  "@cypress/xvfb": "1.2.4",
12
+ "@types/sizzle": "2.3.2",
19
13
  "arch": "2.1.1",
20
14
  "bluebird": "3.5.0",
21
15
  "cachedir": "1.3.0",
@@ -29,20 +23,20 @@
29
23
  "extract-zip": "1.6.7",
30
24
  "fs-extra": "5.0.0",
31
25
  "getos": "3.1.1",
32
- "glob": "7.1.3",
33
26
  "is-ci": "1.2.1",
34
27
  "is-installed-globally": "0.1.0",
35
28
  "lazy-ass": "1.6.0",
36
29
  "listr": "0.12.0",
37
- "lodash": "4.17.11",
30
+ "lodash": "4.17.15",
38
31
  "log-symbols": "2.2.0",
39
32
  "minimist": "1.2.0",
40
33
  "moment": "2.24.0",
41
34
  "ramda": "0.24.1",
42
35
  "request": "2.88.0",
43
- "request-progress": "0.4.0",
36
+ "request-progress": "3.0.0",
44
37
  "supports-color": "5.5.0",
45
38
  "tmp": "0.1.0",
39
+ "untildify": "3.0.3",
46
40
  "url": "0.11.0",
47
41
  "yauzl": "2.10.0"
48
42
  },
@@ -52,6 +46,13 @@
52
46
  "index.js",
53
47
  "types/**/*.d.ts"
54
48
  ],
49
+ "bin": {
50
+ "cypress": "bin/cypress"
51
+ },
52
+ "engines": {
53
+ "node": ">=4.0.0"
54
+ },
55
+ "types": "types",
55
56
  "description": "Cypress.io end to end testing tool",
56
57
  "author": "Brian Mann",
57
58
  "homepage": "https://github.com/cypress-io/cypress",
@@ -64,18 +65,18 @@
64
65
  "url": "https://github.com/cypress-io/cypress.git"
65
66
  },
66
67
  "keywords": [
68
+ "automation",
67
69
  "browser",
68
70
  "cypress",
69
71
  "cypress.io",
70
- "automation",
71
- "end-to-end",
72
72
  "e2e",
73
+ "end-to-end",
73
74
  "integration",
74
75
  "mocks",
75
- "test",
76
- "testing",
77
76
  "runner",
78
77
  "spies",
79
- "stubs"
78
+ "stubs",
79
+ "test",
80
+ "testing"
80
81
  ]
81
82
  }
@@ -0,0 +1,51 @@
1
+ {
2
+ "_from": "@types/blob-util@1.3.3",
3
+ "_id": "@types/blob-util@1.3.3",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-4ahcL/QDnpjWA2Qs16ZMQif7HjGP2cw3AGjHabybjw7Vm1EKu+cfQN1D78BaZbS1WJNa1opSMF5HNMztx7lR0w==",
6
+ "_location": "/@types/blob-util",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "version",
10
+ "registry": true,
11
+ "raw": "@types/blob-util@1.3.3",
12
+ "name": "@types/blob-util",
13
+ "escapedName": "@types%2fblob-util",
14
+ "scope": "@types",
15
+ "rawSpec": "1.3.3",
16
+ "saveSpec": null,
17
+ "fetchSpec": "1.3.3"
18
+ },
19
+ "_requiredBy": [
20
+ "#DEV:/"
21
+ ],
22
+ "_resolved": "https://registry.npmjs.org/@types/blob-util/-/blob-util-1.3.3.tgz",
23
+ "_shasum": "adba644ae34f88e1dd9a5864c66ad651caaf628a",
24
+ "_spec": "@types/blob-util@1.3.3",
25
+ "_where": "/root/cypress/cli",
26
+ "bugs": {
27
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28
+ },
29
+ "bundleDependencies": false,
30
+ "contributors": [
31
+ {
32
+ "name": "Max Battcher",
33
+ "url": "https://github.com/WorldMaker"
34
+ }
35
+ ],
36
+ "dependencies": {},
37
+ "deprecated": false,
38
+ "description": "TypeScript definitions for blob-util",
39
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
40
+ "license": "MIT",
41
+ "main": "",
42
+ "name": "@types/blob-util",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
46
+ },
47
+ "scripts": {},
48
+ "typeScriptVersion": "2.1",
49
+ "typesPublisherContentHash": "251d66da417b64481e7f82fee1849478af0caa6fce0b1feee2146884d2dc9c98",
50
+ "version": "1.3.3"
51
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "_from": "@types/bluebird@3.5.18",
3
+ "_id": "@types/bluebird@3.5.18",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-OTPWHmsyW18BhrnG5x8F7PzeZ2nFxmHGb42bZn79P9hl+GI5cMzyPgQTwNjbem0lJhoru/8vtjAFCUOu3+gE2w==",
6
+ "_location": "/@types/bluebird",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "version",
10
+ "registry": true,
11
+ "raw": "@types/bluebird@3.5.18",
12
+ "name": "@types/bluebird",
13
+ "escapedName": "@types%2fbluebird",
14
+ "scope": "@types",
15
+ "rawSpec": "3.5.18",
16
+ "saveSpec": null,
17
+ "fetchSpec": "3.5.18"
18
+ },
19
+ "_requiredBy": [
20
+ "#DEV:/"
21
+ ],
22
+ "_resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.18.tgz",
23
+ "_shasum": "6a60435d4663e290f3709898a4f75014f279c4d6",
24
+ "_spec": "@types/bluebird@3.5.18",
25
+ "_where": "/root/cypress/cli",
26
+ "bugs": {
27
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28
+ },
29
+ "bundleDependencies": false,
30
+ "contributors": [
31
+ {
32
+ "name": "Leonard Hecker",
33
+ "url": "https://github.com/lhecker"
34
+ }
35
+ ],
36
+ "dependencies": {},
37
+ "deprecated": false,
38
+ "description": "TypeScript definitions for bluebird",
39
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
40
+ "license": "MIT",
41
+ "main": "",
42
+ "name": "@types/bluebird",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
46
+ },
47
+ "scripts": {},
48
+ "typeScriptVersion": "2.3",
49
+ "typesPublisherContentHash": "c9b100367d31f8bd36031e55737d6ffde1a9b85dac3df3693f8f684f914c94cb",
50
+ "version": "3.5.18"
51
+ }
@@ -0,0 +1,81 @@
1
+ {
2
+ "_from": "@types/chai@4.0.8",
3
+ "_id": "@types/chai@4.0.8",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-m812CONwdZn/dMzkIJEY0yAs4apyTkTORgfB2UsMOxgkUbC205AHnm4T8I0I5gPg9MHrFc1dJ35iS75c0CJkjg==",
6
+ "_location": "/@types/chai",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "version",
10
+ "registry": true,
11
+ "raw": "@types/chai@4.0.8",
12
+ "name": "@types/chai",
13
+ "escapedName": "@types%2fchai",
14
+ "scope": "@types",
15
+ "rawSpec": "4.0.8",
16
+ "saveSpec": null,
17
+ "fetchSpec": "4.0.8"
18
+ },
19
+ "_requiredBy": [
20
+ "#DEV:/",
21
+ "/@types/chai-jquery",
22
+ "/@types/sinon-chai"
23
+ ],
24
+ "_resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.0.8.tgz",
25
+ "_shasum": "d27600e9ba2f371e08695d90a0fe0408d89c7be7",
26
+ "_spec": "@types/chai@4.0.8",
27
+ "_where": "/root/cypress/cli",
28
+ "bugs": {
29
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
30
+ },
31
+ "bundleDependencies": false,
32
+ "contributors": [
33
+ {
34
+ "name": "Jed Mao",
35
+ "url": "https://github.com/jedmao"
36
+ },
37
+ {
38
+ "name": "Bart van der Schoor",
39
+ "url": "https://github.com/Bartvds"
40
+ },
41
+ {
42
+ "name": "Andrew Brown",
43
+ "url": "https://github.com/AGBrown"
44
+ },
45
+ {
46
+ "name": "Olivier Chevet",
47
+ "url": "https://github.com/olivr70"
48
+ },
49
+ {
50
+ "name": "Matt Wistrand",
51
+ "url": "https://github.com/mwistrand"
52
+ },
53
+ {
54
+ "name": "Josh Goldberg",
55
+ "url": "https://github.com/joshuakgoldberg"
56
+ },
57
+ {
58
+ "name": "Shaun Luttin",
59
+ "url": "https://github.com/shaunluttin"
60
+ },
61
+ {
62
+ "name": "Gintautas Miselis",
63
+ "url": "https://github.com/Naktibalda"
64
+ }
65
+ ],
66
+ "dependencies": {},
67
+ "deprecated": false,
68
+ "description": "TypeScript definitions for chai",
69
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
70
+ "license": "MIT",
71
+ "main": "",
72
+ "name": "@types/chai",
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
76
+ },
77
+ "scripts": {},
78
+ "typeScriptVersion": "2.0",
79
+ "typesPublisherContentHash": "1c89ea9e229c46de0cd9fc9a48b4ce18c27a3bab9d443d01bec054b1126ede4a",
80
+ "version": "4.0.8"
81
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "_from": "@types/chai-jquery@1.1.38",
3
+ "_id": "@types/chai-jquery@1.1.38",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-j/b++tOoQtkqXdkUWnojd+dM+YxkMiWJ193mToN/vv+rkBLv3MSSNwyDxFSXDwdi82Y+J2Js4fvdVkv/JiVeow==",
6
+ "_location": "/@types/chai-jquery",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "version",
10
+ "registry": true,
11
+ "raw": "@types/chai-jquery@1.1.38",
12
+ "name": "@types/chai-jquery",
13
+ "escapedName": "@types%2fchai-jquery",
14
+ "scope": "@types",
15
+ "rawSpec": "1.1.38",
16
+ "saveSpec": null,
17
+ "fetchSpec": "1.1.38"
18
+ },
19
+ "_requiredBy": [
20
+ "#DEV:/"
21
+ ],
22
+ "_resolved": "https://registry.npmjs.org/@types/chai-jquery/-/chai-jquery-1.1.38.tgz",
23
+ "_shasum": "bbab052200871e1b26b9a239caa63b2a2eaa00bc",
24
+ "_spec": "@types/chai-jquery@1.1.38",
25
+ "_where": "/root/cypress/cli",
26
+ "bugs": {
27
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
28
+ },
29
+ "bundleDependencies": false,
30
+ "contributors": [
31
+ {
32
+ "name": "Kazi Manzur Rashid",
33
+ "url": "https://github.com/kazimanzurrashid"
34
+ }
35
+ ],
36
+ "dependencies": {
37
+ "@types/chai": "*",
38
+ "@types/jquery": "*"
39
+ },
40
+ "deprecated": false,
41
+ "description": "TypeScript definitions for chai-jquery",
42
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped#readme",
43
+ "license": "MIT",
44
+ "main": "",
45
+ "name": "@types/chai-jquery",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git"
49
+ },
50
+ "scripts": {},
51
+ "typeScriptVersion": "2.3",
52
+ "types": "index",
53
+ "typesPublisherContentHash": "e12e44b47bd00c6f4a82ba74968fe19edad29fdcd0ffc07a23da854653181f17",
54
+ "version": "1.1.38"
55
+ }
@@ -1,12 +1,10 @@
1
1
  // Shim definition to export a namespace. Cypress is actually a global module
2
2
  // so import/export isn't allowed there. We import here and define a global module
3
3
  /// <reference path="./chai/index.d.ts" />
4
-
5
- export = Chai
6
- export as namespace Chai
7
-
8
4
  declare namespace Chai {
9
- type ChaiStatic = typeof chai
10
- type ExpectStatic = typeof chai.expect
11
- type AssertStatic = typeof chai.assert
5
+ interface Include {
6
+ html(html: string): Assertion
7
+ text(text: string): Assertion
8
+ value(text: string): Assertion
9
+ }
12
10
  }
@@ -43,9 +43,9 @@ declare module 'cypress' {
43
43
  */
44
44
  reporter: string,
45
45
  /**
46
- * A String glob pattern of the test files to load.
46
+ * A String or Array of string glob pattern of the test files to load.
47
47
  */
48
- testFiles: string
48
+ testFiles: string | string[]
49
49
 
50
50
  //
51
51
  // timeouts
@@ -224,7 +224,7 @@ declare module 'cypress' {
224
224
  })
225
225
  ```
226
226
  */
227
- interface CypressRunOptions {
227
+ interface CypressRunOptions extends CypressCommonOptions {
228
228
  /**
229
229
  * Specify different browser to run tests in, either by name or by filesystem path
230
230
  */
@@ -233,14 +233,6 @@ declare module 'cypress' {
233
233
  * Specify a unique identifier for a run to enable grouping or parallelization
234
234
  */
235
235
  ciBuildId: string
236
- /**
237
- * Specify configuration
238
- */
239
- config: Partial<CypressConfiguration>
240
- /**
241
- * Specify environment variables
242
- */
243
- env: object
244
236
  /**
245
237
  * Group recorded tests together under a single run name
246
238
  */
@@ -265,10 +257,6 @@ declare module 'cypress' {
265
257
  * Override default port
266
258
  */
267
259
  port: number
268
- /**
269
- * Path to a specific project
270
- */
271
- project: string
272
260
  /**
273
261
  * Whether to record the test run
274
262
  */
@@ -302,23 +290,15 @@ declare module 'cypress' {
302
290
  })
303
291
  ```
304
292
  */
305
- interface CypressOpenOptions {
293
+ interface CypressOpenOptions extends CypressCommonOptions {
306
294
  /**
307
295
  * Specify a filesystem path to a custom browser
308
296
  */
309
297
  browser: string
310
- /**
311
- * Specify configuration
312
- */
313
- config: Partial<CypressConfiguration>
314
298
  /**
315
299
  * Open Cypress in detached mode
316
300
  */
317
301
  detached: boolean
318
- /**
319
- * Specify environment variables
320
- */
321
- env: object
322
302
  /**
323
303
  * Run in global mode
324
304
  */
@@ -327,6 +307,28 @@ declare module 'cypress' {
327
307
  * Override default port
328
308
  */
329
309
  port: number
310
+ }
311
+
312
+ /**
313
+ * Options available for `cypress.open` and `cypress.run`
314
+ */
315
+ interface CypressCommonOptions {
316
+ /**
317
+ * Specify configuration
318
+ */
319
+ config: Partial<CypressConfiguration>
320
+ /**
321
+ * Path to the config file to be used.
322
+ *
323
+ * If `false` is passed, no config file will be used.
324
+ *
325
+ * @default "cypress.json"
326
+ */
327
+ configFile: string | false
328
+ /**
329
+ * Specify environment variables
330
+ */
331
+ env: object
330
332
  /**
331
333
  * Path to a specific project
332
334
  */
@@ -443,6 +445,7 @@ declare module 'cypress' {
443
445
 
444
446
  /**
445
447
  * Results returned by the test run.
448
+ * @see https://on.cypress.io/module-api
446
449
  */
447
450
  interface CypressRunResult {
448
451
  startedTestsAt: dateTimeISO
@@ -463,6 +466,29 @@ declare module 'cypress' {
463
466
  cypressVersion: string
464
467
  // TODO add resolved object to the configuration
465
468
  config: CypressConfiguration
469
+ /**
470
+ * If Cypress fails to run at all (for example, if there are no spec files to run),
471
+ * then it will set failures to 1 and will have actual error message in the
472
+ * property "message". Check this property before checking other properties.
473
+ *
474
+ * @type {number}
475
+ * @example
476
+ ```
477
+ const result = await cypress.run()
478
+ if (result.failures) {
479
+ console.error(result.message)
480
+ process.exit(result.failures)
481
+ }
482
+ ```
483
+ */
484
+ failures?: number
485
+ /**
486
+ * If returned result has "failures" set, then this property gives
487
+ * the error message.
488
+ *
489
+ * @type {string}
490
+ */
491
+ message?: string
466
492
  }
467
493
 
468
494
  /**