cypress 9.3.0 → 9.3.1
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/README.md +25 -25
- package/bin/cypress +3 -3
- package/lib/cli.js +14 -14
- package/lib/cypress.js +27 -27
- package/lib/errors.js +25 -25
- package/lib/exec/run.js +13 -13
- package/lib/exec/shared.js +8 -8
- package/lib/tasks/cache.js +3 -3
- package/lib/tasks/download.js +7 -7
- package/lib/tasks/get-folder-size.js +8 -8
- package/lib/tasks/state.js +17 -17
- package/lib/tasks/verify.js +11 -11
- package/lib/util.js +45 -45
- package/package.json +1 -1
- package/types/chai/index.d.ts +5 -5
- package/types/cy-blob-util.d.ts +13 -13
- package/types/cy-bluebird.d.ts +12 -12
- package/types/cy-chai.d.ts +10 -10
- package/types/cy-http.d.ts +13 -13
- package/types/cy-minimatch.d.ts +96 -96
- package/types/cypress-eventemitter.d.ts +33 -33
- package/types/cypress-expect.d.ts +3 -3
- package/types/cypress-global-vars.d.ts +22 -22
- package/types/cypress-npm-api.d.ts +404 -404
- package/types/cypress-type-helpers.d.ts +2 -2
- package/types/cypress.d.ts +5860 -5860
- package/types/index.d.ts +33 -33
- package/types/jquery/JQuery.d.ts +12939 -12939
- package/types/jquery/legacy.d.ts +200 -200
- package/types/jquery/misc.d.ts +6661 -6661
- package/types/minimatch/index.d.ts +0 -0
- package/types/mocha/index.d.ts +2801 -2801
- package/types/net-stubbing.ts +553 -553
package/README.md
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
# Cypress
|
2
|
-
|
3
|
-
Fast, easy and reliable testing for anything that runs in a browser.
|
4
|
-
|
5
|
-
## What is this?
|
6
|
-
|
7
|
-
[Cypress](https://www.cypress.io/) comes packaged as an `npm` module, which is all you need to get started testing.
|
8
|
-
|
9
|
-
After installing you'll be able to:
|
10
|
-
|
11
|
-
- Open Cypress from the CLI
|
12
|
-
- Run Cypress from the CLI
|
13
|
-
- `require` Cypress as a module
|
14
|
-
|
15
|
-
## Install
|
16
|
-
|
17
|
-
Please check our [system requirements](https://on.cypress.io/installing-cypress).
|
18
|
-
|
19
|
-
```sh
|
20
|
-
npm install --save-dev cypress
|
21
|
-
```
|
22
|
-
|
23
|
-
## Documentation
|
24
|
-
|
25
|
-
Please [visit our documentation](https://on.cypress.io/cli) for a full list of commands and examples.
|
1
|
+
# Cypress
|
2
|
+
|
3
|
+
Fast, easy and reliable testing for anything that runs in a browser.
|
4
|
+
|
5
|
+
## What is this?
|
6
|
+
|
7
|
+
[Cypress](https://www.cypress.io/) comes packaged as an `npm` module, which is all you need to get started testing.
|
8
|
+
|
9
|
+
After installing you'll be able to:
|
10
|
+
|
11
|
+
- Open Cypress from the CLI
|
12
|
+
- Run Cypress from the CLI
|
13
|
+
- `require` Cypress as a module
|
14
|
+
|
15
|
+
## Install
|
16
|
+
|
17
|
+
Please check our [system requirements](https://on.cypress.io/installing-cypress).
|
18
|
+
|
19
|
+
```sh
|
20
|
+
npm install --save-dev cypress
|
21
|
+
```
|
22
|
+
|
23
|
+
## Documentation
|
24
|
+
|
25
|
+
Please [visit our documentation](https://on.cypress.io/cli) for a full list of commands and examples.
|
package/bin/cypress
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
|
3
|
-
require('../lib/cli').init()
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
require('../lib/cli').init()
|
package/lib/cli.js
CHANGED
@@ -223,12 +223,12 @@ const createProgram = () => {
|
|
223
223
|
const addCypressRunCommand = program => {
|
224
224
|
return program.command('run').usage('[options]').description('Runs Cypress tests from the CLI without the GUI').option('-b, --browser <browser-name-or-path>', text('browserRunMode')).option('--ci-build-id <id>', text('ciBuildId')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-e, --env <env>', text('env')).option('--group <name>', text('group')).option('-k, --key <record-key>', text('key')).option('--headed', text('headed')).option('--headless', text('headless')).option('--no-exit', text('exit')).option('--parallel', text('parallel')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('-q, --quiet', text('quiet')).option('--record [bool]', text('record'), coerceFalse).option('-r, --reporter <reporter>', text('reporter')).option('-o, --reporter-options <reporter-options>', text('reporterOptions')).option('-s, --spec <spec>', text('spec')).option('-t, --tag <tag>', text('tag')).option('--dev', text('dev'), coerceFalse);
|
225
225
|
};
|
226
|
-
/**
|
227
|
-
* Casts known command line options for "cypress run" to their intended type.
|
228
|
-
* For example if the user passes "--port 5005" the ".port" property should be
|
229
|
-
* a number 5005 and not a string "5005".
|
230
|
-
*
|
231
|
-
* Returns a clone of the original object.
|
226
|
+
/**
|
227
|
+
* Casts known command line options for "cypress run" to their intended type.
|
228
|
+
* For example if the user passes "--port 5005" the ".port" property should be
|
229
|
+
* a number 5005 and not a string "5005".
|
230
|
+
*
|
231
|
+
* Returns a clone of the original object.
|
232
232
|
*/
|
233
233
|
|
234
234
|
|
@@ -251,12 +251,12 @@ const castCypressRunOptions = opts => {
|
|
251
251
|
};
|
252
252
|
|
253
253
|
module.exports = {
|
254
|
-
/**
|
255
|
-
* Parses `cypress run` command line option array into an object
|
256
|
-
* with options that you can feed into a `cypress.run()` module API call.
|
257
|
-
* @example
|
258
|
-
* const options = parseRunCommand(['cypress', 'run', '--browser', 'chrome'])
|
259
|
-
* // options is {browser: 'chrome'}
|
254
|
+
/**
|
255
|
+
* Parses `cypress run` command line option array into an object
|
256
|
+
* with options that you can feed into a `cypress.run()` module API call.
|
257
|
+
* @example
|
258
|
+
* const options = parseRunCommand(['cypress', 'run', '--browser', 'chrome'])
|
259
|
+
* // options is {browser: 'chrome'}
|
260
260
|
*/
|
261
261
|
parseRunCommand(args) {
|
262
262
|
return new Promise((resolve, reject) => {
|
@@ -284,8 +284,8 @@ module.exports = {
|
|
284
284
|
});
|
285
285
|
},
|
286
286
|
|
287
|
-
/**
|
288
|
-
* Parses the command line and kicks off Cypress process.
|
287
|
+
/**
|
288
|
+
* Parses the command line and kicks off Cypress process.
|
289
289
|
*/
|
290
290
|
init(args) {
|
291
291
|
if (!args) {
|
package/lib/cypress.js
CHANGED
@@ -16,18 +16,18 @@ const util = require('./util');
|
|
16
16
|
const cli = require('./cli');
|
17
17
|
|
18
18
|
const cypressModuleApi = {
|
19
|
-
/**
|
20
|
-
* Opens Cypress GUI
|
21
|
-
* @see https://on.cypress.io/module-api#cypress-open
|
19
|
+
/**
|
20
|
+
* Opens Cypress GUI
|
21
|
+
* @see https://on.cypress.io/module-api#cypress-open
|
22
22
|
*/
|
23
23
|
open(options = {}) {
|
24
24
|
options = util.normalizeModuleOptions(options);
|
25
25
|
return open.start(options);
|
26
26
|
},
|
27
27
|
|
28
|
-
/**
|
29
|
-
* Runs Cypress tests in the current project
|
30
|
-
* @see https://on.cypress.io/module-api#cypress-run
|
28
|
+
/**
|
29
|
+
* Runs Cypress tests in the current project
|
30
|
+
* @see https://on.cypress.io/module-api#cypress-run
|
31
31
|
*/
|
32
32
|
run(options = {}) {
|
33
33
|
if (!run.isValidProject(options.project)) {
|
@@ -56,15 +56,15 @@ const cypressModuleApi = {
|
|
56
56
|
},
|
57
57
|
|
58
58
|
cli: {
|
59
|
-
/**
|
60
|
-
* Parses CLI arguments into an object that you can pass to "cypress.run"
|
61
|
-
* @example
|
62
|
-
* const cypress = require('cypress')
|
63
|
-
* const cli = ['cypress', 'run', '--browser', 'firefox']
|
64
|
-
* const options = await cypress.cli.parseRunArguments(cli)
|
65
|
-
* // options is {browser: 'firefox'}
|
66
|
-
* await cypress.run(options)
|
67
|
-
* @see https://on.cypress.io/module-api
|
59
|
+
/**
|
60
|
+
* Parses CLI arguments into an object that you can pass to "cypress.run"
|
61
|
+
* @example
|
62
|
+
* const cypress = require('cypress')
|
63
|
+
* const cli = ['cypress', 'run', '--browser', 'firefox']
|
64
|
+
* const options = await cypress.cli.parseRunArguments(cli)
|
65
|
+
* // options is {browser: 'firefox'}
|
66
|
+
* await cypress.run(options)
|
67
|
+
* @see https://on.cypress.io/module-api
|
68
68
|
*/
|
69
69
|
parseRunArguments(args) {
|
70
70
|
return cli.parseRunCommand(args);
|
@@ -72,18 +72,18 @@ const cypressModuleApi = {
|
|
72
72
|
|
73
73
|
},
|
74
74
|
|
75
|
-
/**
|
76
|
-
* Provides automatic code completion for configuration in many popular code editors.
|
77
|
-
* While it's not strictly necessary for Cypress to parse your configuration, we
|
78
|
-
* recommend wrapping your config object with `defineConfig()`
|
79
|
-
* @example
|
80
|
-
* module.exports = defineConfig({
|
81
|
-
* viewportWith: 400
|
82
|
-
* })
|
83
|
-
*
|
84
|
-
* @see ../types/cypress-npm-api.d.ts
|
85
|
-
* @param {Cypress.ConfigOptions} config
|
86
|
-
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
|
75
|
+
/**
|
76
|
+
* Provides automatic code completion for configuration in many popular code editors.
|
77
|
+
* While it's not strictly necessary for Cypress to parse your configuration, we
|
78
|
+
* recommend wrapping your config object with `defineConfig()`
|
79
|
+
* @example
|
80
|
+
* module.exports = defineConfig({
|
81
|
+
* viewportWith: 400
|
82
|
+
* })
|
83
|
+
*
|
84
|
+
* @see ../types/cypress-npm-api.d.ts
|
85
|
+
* @param {Cypress.ConfigOptions} config
|
86
|
+
* @returns {Cypress.ConfigOptions} the configuration passed in parameter
|
87
87
|
*/
|
88
88
|
defineConfig(config) {
|
89
89
|
return config;
|
package/lib/errors.js
CHANGED
@@ -208,12 +208,12 @@ const invalidTestingType = {
|
|
208
208
|
description: 'Invalid testingType',
|
209
209
|
solution: `Please provide a valid testingType. Valid test types are ${chalk.cyan('\'e2e\'')} and ${chalk.cyan('\'component\'')}.`
|
210
210
|
};
|
211
|
-
/**
|
212
|
-
* This error happens when CLI detects that the child Test Runner process
|
213
|
-
* was killed with a signal, like SIGBUS
|
214
|
-
* @see https://github.com/cypress-io/cypress/issues/5808
|
215
|
-
* @param {'close'|'event'} eventName Child close event name
|
216
|
-
* @param {string} signal Signal that closed the child process, like "SIGBUS"
|
211
|
+
/**
|
212
|
+
* This error happens when CLI detects that the child Test Runner process
|
213
|
+
* was killed with a signal, like SIGBUS
|
214
|
+
* @see https://github.com/cypress-io/cypress/issues/5808
|
215
|
+
* @param {'close'|'event'} eventName Child close event name
|
216
|
+
* @param {string} signal Signal that closed the child process, like "SIGBUS"
|
217
217
|
*/
|
218
218
|
|
219
219
|
const childProcessKilled = (eventName, signal) => {
|
@@ -240,17 +240,17 @@ function addPlatformInformation(info) {
|
|
240
240
|
};
|
241
241
|
});
|
242
242
|
}
|
243
|
-
/**
|
244
|
-
* Given an error object (see the errors above), forms error message text with details,
|
245
|
-
* then resolves with Error instance you can throw or reject with.
|
246
|
-
* @param {object} errorObject
|
247
|
-
* @returns {Promise<Error>} resolves with an Error
|
248
|
-
* @example
|
249
|
-
```js
|
250
|
-
// inside a Promise with "resolve" and "reject"
|
251
|
-
const errorObject = childProcessKilled('exit', 'SIGKILL')
|
252
|
-
return getError(errorObject).then(reject)
|
253
|
-
```
|
243
|
+
/**
|
244
|
+
* Given an error object (see the errors above), forms error message text with details,
|
245
|
+
* then resolves with Error instance you can throw or reject with.
|
246
|
+
* @param {object} errorObject
|
247
|
+
* @returns {Promise<Error>} resolves with an Error
|
248
|
+
* @example
|
249
|
+
```js
|
250
|
+
// inside a Promise with "resolve" and "reject"
|
251
|
+
const errorObject = childProcessKilled('exit', 'SIGKILL')
|
252
|
+
return getError(errorObject).then(reject)
|
253
|
+
```
|
254
254
|
*/
|
255
255
|
|
256
256
|
|
@@ -261,9 +261,9 @@ function getError(errorObject) {
|
|
261
261
|
return err;
|
262
262
|
});
|
263
263
|
}
|
264
|
-
/**
|
265
|
-
* Forms nice error message with error and platform information,
|
266
|
-
* and if possible a way to solve it. Resolves with a string.
|
264
|
+
/**
|
265
|
+
* Forms nice error message with error and platform information,
|
266
|
+
* and if possible a way to solve it. Resolves with a string.
|
267
267
|
*/
|
268
268
|
|
269
269
|
|
@@ -343,11 +343,11 @@ const throwFormErrorText = info => {
|
|
343
343
|
return formErrorText(info, msg, prevMessage).then(raise(info));
|
344
344
|
};
|
345
345
|
};
|
346
|
-
/**
|
347
|
-
* Forms full error message with error and OS details, prints to the error output
|
348
|
-
* and then exits the process.
|
349
|
-
* @param {ErrorInformation} info Error information {description, solution}
|
350
|
-
* @example return exitWithError(errors.invalidCypressEnv)('foo')
|
346
|
+
/**
|
347
|
+
* Forms full error message with error and OS details, prints to the error output
|
348
|
+
* and then exits the process.
|
349
|
+
* @param {ErrorInformation} info Error information {description, solution}
|
350
|
+
* @example return exitWithError(errors.invalidCypressEnv)('foo')
|
351
351
|
*/
|
352
352
|
|
353
353
|
|
package/lib/exec/run.js
CHANGED
@@ -19,11 +19,11 @@ const {
|
|
19
19
|
processTestingType,
|
20
20
|
throwInvalidOptionError
|
21
21
|
} = require('./shared');
|
22
|
-
/**
|
23
|
-
* Typically a user passes a string path to the project.
|
24
|
-
* But "cypress open" allows using `false` to open in global mode,
|
25
|
-
* and the user can accidentally execute `cypress run --project false`
|
26
|
-
* which should be invalid.
|
22
|
+
/**
|
23
|
+
* Typically a user passes a string path to the project.
|
24
|
+
* But "cypress open" allows using `false` to open in global mode,
|
25
|
+
* and the user can accidentally execute `cypress run --project false`
|
26
|
+
* which should be invalid.
|
27
27
|
*/
|
28
28
|
|
29
29
|
|
@@ -38,14 +38,14 @@ const isValidProject = v => {
|
|
38
38
|
|
39
39
|
return true;
|
40
40
|
};
|
41
|
-
/**
|
42
|
-
* Maps options collected by the CLI
|
43
|
-
* and forms list of CLI arguments to the server.
|
44
|
-
*
|
45
|
-
* Note: there is lightweight validation, with errors
|
46
|
-
* thrown synchronously.
|
47
|
-
*
|
48
|
-
* @returns {string[]} list of CLI arguments
|
41
|
+
/**
|
42
|
+
* Maps options collected by the CLI
|
43
|
+
* and forms list of CLI arguments to the server.
|
44
|
+
*
|
45
|
+
* Note: there is lightweight validation, with errors
|
46
|
+
* thrown synchronously.
|
47
|
+
*
|
48
|
+
* @returns {string[]} list of CLI arguments
|
49
49
|
*/
|
50
50
|
|
51
51
|
|
package/lib/exec/shared.js
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
const {
|
4
4
|
errors
|
5
5
|
} = require('../errors');
|
6
|
-
/**
|
7
|
-
* Throws an error with "details" property from
|
8
|
-
* "errors" object.
|
9
|
-
* @param {Object} details - Error details
|
6
|
+
/**
|
7
|
+
* Throws an error with "details" property from
|
8
|
+
* "errors" object.
|
9
|
+
* @param {Object} details - Error details
|
10
10
|
*/
|
11
11
|
|
12
12
|
|
@@ -21,10 +21,10 @@ const throwInvalidOptionError = details => {
|
|
21
21
|
err.details = details;
|
22
22
|
throw err;
|
23
23
|
};
|
24
|
-
/**
|
25
|
-
* Selects exec args based on the configured `testingType`
|
26
|
-
* @param {string} testingType The type of tests being executed
|
27
|
-
* @returns {string[]} The array of new exec arguments
|
24
|
+
/**
|
25
|
+
* Selects exec args based on the configured `testingType`
|
26
|
+
* @param {string} testingType The type of tests being executed
|
27
|
+
* @returns {string[]} The array of new exec arguments
|
28
28
|
*/
|
29
29
|
|
30
30
|
|
package/lib/tasks/cache.js
CHANGED
@@ -72,9 +72,9 @@ const prune = () => {
|
|
72
72
|
const fileSizeInMB = size => {
|
73
73
|
return `${(size / 1024 / 1024).toFixed(1)}MB`;
|
74
74
|
};
|
75
|
-
/**
|
76
|
-
* Collects all cached versions, finds when each was used
|
77
|
-
* and prints a table with results to the terminal
|
75
|
+
/**
|
76
|
+
* Collects all cached versions, finds when each was used
|
77
|
+
* and prints a table with results to the terminal
|
78
78
|
*/
|
79
79
|
|
80
80
|
|
package/lib/tasks/download.js
CHANGED
@@ -104,9 +104,9 @@ const prettyDownloadErr = (err, version) => {
|
|
104
104
|
debug(msg);
|
105
105
|
return throwFormErrorText(errors.failedDownload)(msg);
|
106
106
|
};
|
107
|
-
/**
|
108
|
-
* Checks checksum and file size for the given file. Allows both
|
109
|
-
* values or just one of them to be checked.
|
107
|
+
/**
|
108
|
+
* Checks checksum and file size for the given file. Allows both
|
109
|
+
* values or just one of them to be checked.
|
110
110
|
*/
|
111
111
|
|
112
112
|
|
@@ -300,10 +300,10 @@ const downloadFromUrl = ({
|
|
300
300
|
});
|
301
301
|
});
|
302
302
|
};
|
303
|
-
/**
|
304
|
-
* Download Cypress.zip from external url to local file.
|
305
|
-
* @param [string] version Could be "3.3.0" or full URL
|
306
|
-
* @param [string] downloadDestination Local filename to save as
|
303
|
+
/**
|
304
|
+
* Download Cypress.zip from external url to local file.
|
305
|
+
* @param [string] version Could be "3.3.0" or full URL
|
306
|
+
* @param [string] downloadDestination Local filename to save as
|
307
307
|
*/
|
308
308
|
|
309
309
|
|
@@ -7,14 +7,14 @@ const {
|
|
7
7
|
} = require('path');
|
8
8
|
|
9
9
|
const Bluebird = require('bluebird');
|
10
|
-
/**
|
11
|
-
* Get the size of a folder or a file.
|
12
|
-
*
|
13
|
-
* This function returns the actual file size of the folder (size), not the allocated space on disk (size on disk).
|
14
|
-
* For more details between the difference, check this link:
|
15
|
-
* https://www.howtogeek.com/180369/why-is-there-a-big-difference-between-size-and-size-on-disk/
|
16
|
-
*
|
17
|
-
* @param {string} path path to the file or the folder.
|
10
|
+
/**
|
11
|
+
* Get the size of a folder or a file.
|
12
|
+
*
|
13
|
+
* This function returns the actual file size of the folder (size), not the allocated space on disk (size on disk).
|
14
|
+
* For more details between the difference, check this link:
|
15
|
+
* https://www.howtogeek.com/180369/why-is-there-a-big-difference-between-size-and-size-on-disk/
|
16
|
+
*
|
17
|
+
* @param {string} path path to the file or the folder.
|
18
18
|
*/
|
19
19
|
|
20
20
|
|
package/lib/tasks/state.js
CHANGED
@@ -70,8 +70,8 @@ const getBinaryPkgPath = binaryDir => {
|
|
70
70
|
throw new Error(`Platform: "${platform}" is not supported.`);
|
71
71
|
}
|
72
72
|
};
|
73
|
-
/**
|
74
|
-
* Get path to binary directory
|
73
|
+
/**
|
74
|
+
* Get path to binary directory
|
75
75
|
*/
|
76
76
|
|
77
77
|
|
@@ -82,9 +82,9 @@ const getBinaryDir = (version = util.pkgVersion()) => {
|
|
82
82
|
const getVersionDir = (version = util.pkgVersion()) => {
|
83
83
|
return path.join(getCacheDir(), version);
|
84
84
|
};
|
85
|
-
/**
|
86
|
-
* When executing "npm postinstall" hook, the working directory is set to
|
87
|
-
* "<current folder>/node_modules/cypress", which can be surprising when using relative paths.
|
85
|
+
/**
|
86
|
+
* When executing "npm postinstall" hook, the working directory is set to
|
87
|
+
* "<current folder>/node_modules/cypress", which can be surprising when using relative paths.
|
88
88
|
*/
|
89
89
|
|
90
90
|
|
@@ -134,10 +134,10 @@ const parseRealPlatformBinaryFolderAsync = binaryPath => {
|
|
134
134
|
const getDistDir = () => {
|
135
135
|
return path.join(__dirname, '..', '..', 'dist');
|
136
136
|
};
|
137
|
-
/**
|
138
|
-
* Returns full filename to the file that keeps the Test Runner verification state as JSON text.
|
139
|
-
* Note: the binary state file will be stored one level up from the given binary folder.
|
140
|
-
* @param {string} binaryDir - full path to the folder holding the binary.
|
137
|
+
/**
|
138
|
+
* Returns full filename to the file that keeps the Test Runner verification state as JSON text.
|
139
|
+
* Note: the binary state file will be stored one level up from the given binary folder.
|
140
|
+
* @param {string} binaryDir - full path to the folder holding the binary.
|
141
141
|
*/
|
142
142
|
|
143
143
|
|
@@ -162,11 +162,11 @@ const getBinaryVerifiedAsync = binaryDir => {
|
|
162
162
|
const clearBinaryStateAsync = binaryDir => {
|
163
163
|
return fs.removeAsync(getBinaryStatePath(binaryDir));
|
164
164
|
};
|
165
|
-
/**
|
166
|
-
* Writes the new binary status.
|
167
|
-
* @param {boolean} verified The new test runner state after smoke test
|
168
|
-
* @param {string} binaryDir Folder holding the binary
|
169
|
-
* @returns {Promise<void>} returns a promise
|
165
|
+
/**
|
166
|
+
* Writes the new binary status.
|
167
|
+
* @param {boolean} verified The new test runner state after smoke test
|
168
|
+
* @param {string} binaryDir Folder holding the binary
|
169
|
+
* @returns {Promise<void>} returns a promise
|
170
170
|
*/
|
171
171
|
|
172
172
|
|
@@ -183,9 +183,9 @@ const writeBinaryVerifiedAsync = (verified, binaryDir) => {
|
|
183
183
|
const getPathToExecutable = binaryDir => {
|
184
184
|
return path.join(binaryDir, getPlatformExecutable());
|
185
185
|
};
|
186
|
-
/**
|
187
|
-
* Resolves with an object read from the binary app package.json file.
|
188
|
-
* If the file does not exist resolves with null
|
186
|
+
/**
|
187
|
+
* Resolves with an object read from the binary app package.json file.
|
188
|
+
* If the file does not exist resolves with null
|
189
189
|
*/
|
190
190
|
|
191
191
|
|
package/lib/tasks/verify.js
CHANGED
@@ -86,9 +86,9 @@ const runSmokeTest = (binaryDir, options) => {
|
|
86
86
|
|
87
87
|
const needsXvfb = xvfb.isNeeded();
|
88
88
|
debug('needs Xvfb?', needsXvfb);
|
89
|
-
/**
|
90
|
-
* Spawn Cypress running smoke test to check if all operating system
|
91
|
-
* dependencies are good.
|
89
|
+
/**
|
90
|
+
* Spawn Cypress running smoke test to check if all operating system
|
91
|
+
* dependencies are good.
|
92
92
|
*/
|
93
93
|
|
94
94
|
const spawn = linuxWithDisplayEnv => {
|
@@ -329,14 +329,14 @@ const start = (options = {}) => {
|
|
329
329
|
};
|
330
330
|
|
331
331
|
const isLinuxLike = () => os.platform() !== 'win32';
|
332
|
-
/**
|
333
|
-
* Returns true if running on a system where Electron needs "--no-sandbox" flag.
|
334
|
-
* @see https://crbug.com/638180
|
335
|
-
*
|
336
|
-
* On Debian we had problems running in sandbox even for non-root users.
|
337
|
-
* @see https://github.com/cypress-io/cypress/issues/5434
|
338
|
-
* Seems there is a lot of discussion around this issue among Electron users
|
339
|
-
* @see https://github.com/electron/electron/issues/17972
|
332
|
+
/**
|
333
|
+
* Returns true if running on a system where Electron needs "--no-sandbox" flag.
|
334
|
+
* @see https://crbug.com/638180
|
335
|
+
*
|
336
|
+
* On Debian we had problems running in sandbox even for non-root users.
|
337
|
+
* @see https://github.com/cypress-io/cypress/issues/5434
|
338
|
+
* Seems there is a lot of discussion around this issue among Electron users
|
339
|
+
* @see https://github.com/electron/electron/issues/17972
|
340
340
|
*/
|
341
341
|
|
342
342
|
|
package/lib/util.js
CHANGED
@@ -52,11 +52,11 @@ const fs = require('./fs');
|
|
52
52
|
|
53
53
|
const issuesUrl = 'https://github.com/cypress-io/cypress/issues';
|
54
54
|
const getosAsync = Promise.promisify(getos);
|
55
|
-
/**
|
56
|
-
* Returns SHA512 of a file
|
57
|
-
*
|
58
|
-
* Implementation lifted from https://github.com/sindresorhus/hasha
|
59
|
-
* but without bringing that dependency (since hasha is Node v8+)
|
55
|
+
/**
|
56
|
+
* Returns SHA512 of a file
|
57
|
+
*
|
58
|
+
* Implementation lifted from https://github.com/sindresorhus/hasha
|
59
|
+
* but without bringing that dependency (since hasha is Node v8+)
|
60
60
|
*/
|
61
61
|
|
62
62
|
const getFileChecksum = filename => {
|
@@ -90,21 +90,21 @@ const stringify = val => {
|
|
90
90
|
function normalizeModuleOptions(options = {}) {
|
91
91
|
return _.mapValues(options, stringify);
|
92
92
|
}
|
93
|
-
/**
|
94
|
-
* Returns true if the platform is Linux. We do a lot of different
|
95
|
-
* stuff on Linux (like Xvfb) and it helps to has readable code
|
93
|
+
/**
|
94
|
+
* Returns true if the platform is Linux. We do a lot of different
|
95
|
+
* stuff on Linux (like Xvfb) and it helps to has readable code
|
96
96
|
*/
|
97
97
|
|
98
98
|
|
99
99
|
const isLinux = () => {
|
100
100
|
return os.platform() === 'linux';
|
101
101
|
};
|
102
|
-
/**
|
103
|
-
* If the DISPLAY variable is set incorrectly, when trying to spawn
|
104
|
-
* Cypress executable we get an error like this:
|
105
|
-
```
|
106
|
-
[1005:0509/184205.663837:WARNING:browser_main_loop.cc(258)] Gtk: cannot open display: 99
|
107
|
-
```
|
102
|
+
/**
|
103
|
+
* If the DISPLAY variable is set incorrectly, when trying to spawn
|
104
|
+
* Cypress executable we get an error like this:
|
105
|
+
```
|
106
|
+
[1005:0509/184205.663837:WARNING:browser_main_loop.cc(258)] Gtk: cannot open display: 99
|
107
|
+
```
|
108
108
|
*/
|
109
109
|
|
110
110
|
|
@@ -136,12 +136,12 @@ function stdoutLineMatches(expectedLine, stdout) {
|
|
136
136
|
const lines = stdout.split('\n').map(val => val.trim());
|
137
137
|
return lines.some(line => line === expectedLine);
|
138
138
|
}
|
139
|
-
/**
|
140
|
-
* Confirms if given value is a valid CYPRESS_INTERNAL_ENV value. Undefined values
|
141
|
-
* are valid, because the system can set the default one.
|
142
|
-
*
|
143
|
-
* @param {string} value
|
144
|
-
* @example util.isValidCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
139
|
+
/**
|
140
|
+
* Confirms if given value is a valid CYPRESS_INTERNAL_ENV value. Undefined values
|
141
|
+
* are valid, because the system can set the default one.
|
142
|
+
*
|
143
|
+
* @param {string} value
|
144
|
+
* @example util.isValidCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
145
145
|
*/
|
146
146
|
|
147
147
|
|
@@ -155,21 +155,21 @@ function isValidCypressInternalEnvValue(value) {
|
|
155
155
|
const names = ['development', 'test', 'staging', 'production'];
|
156
156
|
return _.includes(names, value);
|
157
157
|
}
|
158
|
-
/**
|
159
|
-
* Confirms if given value is a non-production CYPRESS_INTERNAL_ENV value.
|
160
|
-
* Undefined values are valid, because the system can set the default one.
|
161
|
-
*
|
162
|
-
* @param {string} value
|
163
|
-
* @example util.isNonProductionCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
158
|
+
/**
|
159
|
+
* Confirms if given value is a non-production CYPRESS_INTERNAL_ENV value.
|
160
|
+
* Undefined values are valid, because the system can set the default one.
|
161
|
+
*
|
162
|
+
* @param {string} value
|
163
|
+
* @example util.isNonProductionCypressInternalEnvValue(process.env.CYPRESS_INTERNAL_ENV)
|
164
164
|
*/
|
165
165
|
|
166
166
|
|
167
167
|
function isNonProductionCypressInternalEnvValue(value) {
|
168
168
|
return !_.isUndefined(value) && value !== 'production';
|
169
169
|
}
|
170
|
-
/**
|
171
|
-
* Prints NODE_OPTIONS using debug() module, but only
|
172
|
-
* if DEBUG=cypress... is set
|
170
|
+
/**
|
171
|
+
* Prints NODE_OPTIONS using debug() module, but only
|
172
|
+
* if DEBUG=cypress... is set
|
173
173
|
*/
|
174
174
|
|
175
175
|
|
@@ -184,19 +184,19 @@ function printNodeOptions(log = debug) {
|
|
184
184
|
log('NODE_OPTIONS is not set');
|
185
185
|
}
|
186
186
|
}
|
187
|
-
/**
|
188
|
-
* Removes double quote characters
|
189
|
-
* from the start and end of the given string IF they are both present
|
190
|
-
*
|
191
|
-
* @param {string} str Input string
|
192
|
-
* @returns {string} Trimmed string or the original string if there are no double quotes around it.
|
193
|
-
* @example
|
194
|
-
```
|
195
|
-
dequote('"foo"')
|
196
|
-
// returns string 'foo'
|
197
|
-
dequote('foo')
|
198
|
-
// returns string 'foo'
|
199
|
-
```
|
187
|
+
/**
|
188
|
+
* Removes double quote characters
|
189
|
+
* from the start and end of the given string IF they are both present
|
190
|
+
*
|
191
|
+
* @param {string} str Input string
|
192
|
+
* @returns {string} Trimmed string or the original string if there are no double quotes around it.
|
193
|
+
* @example
|
194
|
+
```
|
195
|
+
dequote('"foo"')
|
196
|
+
// returns string 'foo'
|
197
|
+
dequote('foo')
|
198
|
+
// returns string 'foo'
|
199
|
+
```
|
200
200
|
*/
|
201
201
|
|
202
202
|
|
@@ -232,9 +232,9 @@ const parseOpts = opts => {
|
|
232
232
|
debug('parsed cli options %o', cleanOpts);
|
233
233
|
return cleanOpts;
|
234
234
|
};
|
235
|
-
/**
|
236
|
-
* Copy of packages/server/lib/browsers/utils.ts
|
237
|
-
* because we need same functionality in CLI to show the path :(
|
235
|
+
/**
|
236
|
+
* Copy of packages/server/lib/browsers/utils.ts
|
237
|
+
* because we need same functionality in CLI to show the path :(
|
238
238
|
*/
|
239
239
|
|
240
240
|
|