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/index.js +1 -1
- package/lib/cli.js +15 -6
- package/lib/errors.js +59 -33
- package/lib/exec/open.js +4 -0
- package/lib/exec/run.js +4 -0
- package/lib/exec/spawn.js +54 -20
- package/lib/exec/versions.js +0 -1
- package/lib/exec/xvfb.js +1 -1
- package/lib/tasks/download.js +124 -15
- package/lib/tasks/install.js +10 -9
- package/lib/tasks/state.js +24 -2
- package/lib/tasks/unzip.js +0 -1
- package/lib/tasks/verify.js +40 -8
- package/lib/util.js +113 -14
- package/package.json +17 -16
- package/types/blob-util/package.json +51 -0
- package/types/bluebird/package.json +51 -0
- package/types/chai/package.json +81 -0
- package/types/chai-jquery/package.json +55 -0
- package/types/cy-chai.d.ts +5 -7
- package/types/cypress-npm-api.d.ts +50 -24
- package/types/index.d.ts +210 -11
- package/types/jquery/JQuery.d.ts +12942 -0
- package/types/jquery/JQueryStatic.d.ts +13521 -0
- package/types/jquery/LICENSE +21 -21
- package/types/jquery/README.md +4 -4
- package/types/jquery/index.d.ts +7 -8533
- package/types/jquery/legacy.d.ts +204 -0
- package/types/jquery/misc.d.ts +6661 -0
- package/types/jquery/package.json +140 -0
- package/types/lodash/package.json +85 -0
- package/types/minimatch/package.json +56 -0
- package/types/mocha/README.md +5 -5
- package/types/mocha/index.d.ts +2986 -241
- package/types/mocha/package.json +73 -0
- package/types/sinon/package.json +88 -0
- package/types/sinon-chai/package.json +63 -0
package/index.js
CHANGED
package/lib/cli.js
CHANGED
@@ -14,6 +14,7 @@ var logSymbols = require('log-symbols');
|
|
14
14
|
var debug = require('debug')('cypress:cli');
|
15
15
|
var util = require('./util');
|
16
16
|
var logger = require('./logger');
|
17
|
+
var errors = require('./errors');
|
17
18
|
var cache = require('./tasks/cache');
|
18
19
|
|
19
20
|
// patch "commander" method called when a user passed an unknown option
|
@@ -38,6 +39,7 @@ var coerceFalse = function coerceFalse(arg) {
|
|
38
39
|
var spaceDelimitedSpecsMsg = function spaceDelimitedSpecsMsg(files) {
|
39
40
|
logger.log();
|
40
41
|
logger.warn(stripIndent(_templateObject, logSymbols.warning, files.join(' ')));
|
42
|
+
|
41
43
|
logger.log();
|
42
44
|
};
|
43
45
|
|
@@ -67,7 +69,7 @@ var parseVariableOpts = function parseVariableOpts(fnArgs, args) {
|
|
67
69
|
};
|
68
70
|
|
69
71
|
var parseOpts = function parseOpts(opts) {
|
70
|
-
opts = _.pick(opts, 'project', 'spec', 'reporter', 'reporterOptions', 'path', 'destination', 'port', 'env', 'cypressVersion', 'config', 'record', 'key', 'browser', 'detached', 'headed', 'global', 'dev', 'force', 'exit', 'cachePath', 'cacheList', 'cacheClear', 'parallel', 'group', 'ciBuildId');
|
72
|
+
opts = _.pick(opts, 'project', 'spec', 'reporter', 'reporterOptions', 'path', 'destination', 'port', 'env', 'cypressVersion', 'config', 'record', 'key', 'configFile', 'browser', 'detached', 'headed', 'global', 'dev', 'force', 'exit', 'cachePath', 'cacheList', 'cacheClear', 'parallel', 'group', 'ciBuildId');
|
71
73
|
|
72
74
|
if (opts.exit) {
|
73
75
|
opts = _.omit(opts, 'exit');
|
@@ -84,14 +86,15 @@ var descriptions = {
|
|
84
86
|
spec: 'runs a specific spec file. defaults to "all"',
|
85
87
|
reporter: 'runs a specific mocha reporter. pass a path to use a custom reporter. defaults to "spec"',
|
86
88
|
reporterOptions: 'options for the mocha reporter. defaults to "null"',
|
87
|
-
port: 'runs Cypress on a specific port. overrides any value in
|
88
|
-
env: 'sets environment variables. separate multiple values with a comma. overrides any value in
|
89
|
-
config: 'sets configuration values. separate multiple values with a comma. overrides any value in
|
89
|
+
port: 'runs Cypress on a specific port. overrides any value in the configuration file.',
|
90
|
+
env: 'sets environment variables. separate multiple values with a comma. overrides any value in the configuration file or cypress.env.json',
|
91
|
+
config: 'sets configuration values. separate multiple values with a comma. overrides any value in the configuration file.',
|
90
92
|
browserRunMode: 'runs Cypress in the browser with the given name. if a filesystem path is supplied, Cypress will attempt to use the browser at that path.',
|
91
93
|
browserOpenMode: 'path to a custom browser to be added to the list of available browsers in Cypress',
|
92
94
|
detached: 'runs Cypress application in detached mode',
|
93
95
|
project: 'path to the project',
|
94
96
|
global: 'force Cypress into global mode as if its globally installed',
|
97
|
+
configFile: 'path to JSON file where configuration values are set. defaults to "cypress.json". pass "false" to disable.',
|
95
98
|
version: 'prints Cypress version',
|
96
99
|
headed: 'displays the Electron browser instead of running headlessly',
|
97
100
|
dev: 'runs cypress in development and bypasses binary check',
|
@@ -137,6 +140,12 @@ module.exports = {
|
|
137
140
|
args = process.argv;
|
138
141
|
}
|
139
142
|
|
143
|
+
if (!util.isValidCypressEnvValue(process.env.CYPRESS_ENV)) {
|
144
|
+
debug('invalid CYPRESS_ENV value', process.env.CYPRESS_ENV);
|
145
|
+
|
146
|
+
return errors.exitWithError(errors.errors.invalidCypressEnv)('CYPRESS_ENV=' + process.env.CYPRESS_ENV);
|
147
|
+
}
|
148
|
+
|
140
149
|
var program = new commander.Command();
|
141
150
|
|
142
151
|
// bug in commaner not printing name
|
@@ -151,7 +160,7 @@ module.exports = {
|
|
151
160
|
|
152
161
|
program.option('-v, --version', text('version')).command('version').description(text('version')).action(showVersions);
|
153
162
|
|
154
|
-
program.command('run').usage('[options]').description('Runs Cypress tests from the CLI without the GUI').option('--record [bool]', text('record'), coerceFalse).option('--headed', text('headed')).option('-k, --key <record-key>', text('key')).option('-s, --spec <spec>', text('spec')).option('-r, --reporter <reporter>', text('reporter')).option('-o, --reporter-options <reporter-options>', text('reporterOptions')).option('-p, --port <port>', text('port')).option('-e, --env <env>', text('env')).option('-c, --config <config>', text('config')).option('-b, --browser <browser-name-or-path>', text('browserRunMode')).option('-P, --project <project-path>', text('project')).option('--parallel', text('parallel')).option('--group <name>', text('group')).option('--ci-build-id <id>', text('ciBuildId')).option('--no-exit', text('exit')).option('--dev', text('dev'), coerceFalse).action(function () {
|
163
|
+
program.command('run').usage('[options]').description('Runs Cypress tests from the CLI without the GUI').option('--record [bool]', text('record'), coerceFalse).option('--headed', text('headed')).option('-k, --key <record-key>', text('key')).option('-s, --spec <spec>', text('spec')).option('-r, --reporter <reporter>', text('reporter')).option('-o, --reporter-options <reporter-options>', text('reporterOptions')).option('-p, --port <port>', text('port')).option('-e, --env <env>', text('env')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-b, --browser <browser-name-or-path>', text('browserRunMode')).option('-P, --project <project-path>', text('project')).option('--parallel', text('parallel')).option('--group <name>', text('group')).option('--ci-build-id <id>', text('ciBuildId')).option('--no-exit', text('exit')).option('--dev', text('dev'), coerceFalse).action(function () {
|
155
164
|
for (var _len = arguments.length, fnArgs = Array(_len), _key = 0; _key < _len; _key++) {
|
156
165
|
fnArgs[_key] = arguments[_key];
|
157
166
|
}
|
@@ -160,7 +169,7 @@ module.exports = {
|
|
160
169
|
require('./exec/run').start(parseVariableOpts(fnArgs, args)).then(util.exit).catch(util.logErrorExit1);
|
161
170
|
});
|
162
171
|
|
163
|
-
program.command('open').usage('[options]').description('Opens Cypress in the interactive GUI.').option('-p, --port <port>', text('port')).option('-e, --env <env>', text('env')).option('-c, --config <config>', text('config')).option('-d, --detached [bool]', text('detached'), coerceFalse).option('-b, --browser <browser-path>', text('browserOpenMode')).option('-P, --project <project-path>', text('project')).option('--global', text('global')).option('--dev', text('dev'), coerceFalse).action(function (opts) {
|
172
|
+
program.command('open').usage('[options]').description('Opens Cypress in the interactive GUI.').option('-p, --port <port>', text('port')).option('-e, --env <env>', text('env')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-d, --detached [bool]', text('detached'), coerceFalse).option('-b, --browser <browser-path>', text('browserOpenMode')).option('-P, --project <project-path>', text('project')).option('--global', text('global')).option('--dev', text('dev'), coerceFalse).action(function (opts) {
|
164
173
|
debug('opening Cypress');
|
165
174
|
require('./exec/open').start(parseOpts(opts)).catch(util.logErrorExit1);
|
166
175
|
});
|
package/lib/errors.js
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var _templateObject = _taggedTemplateLiteral(['\n
|
4
|
-
_templateObject2 = _taggedTemplateLiteral(['\n
|
5
|
-
_templateObject3 = _taggedTemplateLiteral(['\n
|
6
|
-
_templateObject4 = _taggedTemplateLiteral(['\n\n
|
7
|
-
_templateObject5 = _taggedTemplateLiteral(['\n
|
8
|
-
_templateObject6 = _taggedTemplateLiteral(['\n
|
9
|
-
_templateObject7 = _taggedTemplateLiteral(['\n
|
10
|
-
_templateObject8 = _taggedTemplateLiteral(['\n
|
11
|
-
_templateObject9 = _taggedTemplateLiteral(['\n
|
12
|
-
_templateObject10 = _taggedTemplateLiteral(['\n
|
13
|
-
_templateObject11 = _taggedTemplateLiteral(['\n
|
14
|
-
_templateObject12 = _taggedTemplateLiteral(['\n
|
15
|
-
_templateObject13 = _taggedTemplateLiteral(['\n
|
16
|
-
_templateObject14 = _taggedTemplateLiteral(['\n
|
17
|
-
_templateObject15 = _taggedTemplateLiteral(['\n
|
18
|
-
_templateObject16 = _taggedTemplateLiteral(['\n
|
3
|
+
var _templateObject = _taggedTemplateLiteral(['\n Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration\n\n Otherwise, please check network connectivity and try again:'], ['\n Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration\n\n Otherwise, please check network connectivity and try again:']),
|
4
|
+
_templateObject2 = _taggedTemplateLiteral(['\n Search for an existing issue or open a GitHub issue at\n\n ', '\n '], ['\n Search for an existing issue or open a GitHub issue at\n\n ', '\n ']),
|
5
|
+
_templateObject3 = _taggedTemplateLiteral(['\n \nPlease reinstall Cypress by running: ', '\n '], ['\n \\nPlease reinstall Cypress by running: ', '\n ']),
|
6
|
+
_templateObject4 = _taggedTemplateLiteral(['\n\n Reasons this may happen:\n\n - node was installed as \'root\' or with \'sudo\'\n - the cypress npm package as \'root\' or with \'sudo\'\n\n Please check that you have the appropriate user permissions.\n '], ['\\n\n Reasons this may happen:\n\n - node was installed as \'root\' or with \'sudo\'\n - the cypress npm package as \'root\' or with \'sudo\'\n\n Please check that you have the appropriate user permissions.\n ']),
|
7
|
+
_templateObject5 = _taggedTemplateLiteral(['\n\n We expected the binary to be installed here: ', '\n\n Reasons it may be missing:\n\n - You\'re caching \'node_modules\' but are not caching this path: ', '\n - You ran \'npm install\' at an earlier build step but did not persist: ', '\n\n Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.\n\n Alternatively, you can run \'cypress install\' to download the binary again.\n\n ', '\n '], ['\\n\n We expected the binary to be installed here: ', '\n\n Reasons it may be missing:\n\n - You\'re caching \'node_modules\' but are not caching this path: ', '\n - You ran \'npm install\' at an earlier build step but did not persist: ', '\n\n Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.\n\n Alternatively, you can run \'cypress install\' to download the binary again.\n\n ', '\n ']),
|
8
|
+
_templateObject6 = _taggedTemplateLiteral(['\n There was a problem spawning Xvfb.\n\n This is likely a problem with your system, permissions, or installation of Xvfb.\n '], ['\n There was a problem spawning Xvfb.\n\n This is likely a problem with your system, permissions, or installation of Xvfb.\n ']),
|
9
|
+
_templateObject7 = _taggedTemplateLiteral(['\n Install Xvfb and run Cypress again.\n\n Read our documentation on dependencies for more information:\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n '], ['\n Install Xvfb and run Cypress again.\n\n Read our documentation on dependencies for more information:\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n ']),
|
10
|
+
_templateObject8 = _taggedTemplateLiteral(['\n This command failed with the following output:\n\n ', '\n\n '], ['\n This command failed with the following output:\n\n ', '\n\n ']),
|
11
|
+
_templateObject9 = _taggedTemplateLiteral(['\n Cypress failed to start after spawning a new Xvfb server.\n\n The error logs we received were:\n\n ', '\n\n ', '\n\n ', '\n\n This is usually caused by a missing library or dependency.\n\n The error above should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n '], ['\n Cypress failed to start after spawning a new Xvfb server.\n\n The error logs we received were:\n\n ', '\n\n ', '\n\n ', '\n\n This is usually caused by a missing library or dependency.\n\n The error above should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n ']),
|
12
|
+
_templateObject10 = _taggedTemplateLiteral(['\n This is usually caused by a missing library or dependency.\n\n The error below should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n '], ['\n This is usually caused by a missing library or dependency.\n\n The error below should indicate which dependency is missing.\n\n ', '\n\n If you are using Docker, we provide containers with all required dependencies installed.\n ']),
|
13
|
+
_templateObject11 = _taggedTemplateLiteral(['\n See discussion and possible solutions at\n ', '\n '], ['\n See discussion and possible solutions at\n ', '\n ']),
|
14
|
+
_templateObject12 = _taggedTemplateLiteral(['\n Please search Cypress documentation for possible solutions:\n\n ', '\n\n Check if there is a GitHub issue describing this crash:\n\n ', '\n\n Consider opening a new issue.\n '], ['\n Please search Cypress documentation for possible solutions:\n\n ', '\n\n Check if there is a GitHub issue describing this crash:\n\n ', '\n\n Consider opening a new issue.\n ']),
|
15
|
+
_templateObject13 = _taggedTemplateLiteral(['\n The environment variable CYPRESS_BINARY_VERSION has been renamed to CYPRESS_INSTALL_BINARY as of version ', '\n '], ['\n The environment variable CYPRESS_BINARY_VERSION has been renamed to CYPRESS_INSTALL_BINARY as of version ', '\n ']),
|
16
|
+
_templateObject14 = _taggedTemplateLiteral(['\n You should set CYPRESS_INSTALL_BINARY instead.\n '], ['\n You should set CYPRESS_INSTALL_BINARY instead.\n ']),
|
17
|
+
_templateObject15 = _taggedTemplateLiteral(['\n The environment variable CYPRESS_SKIP_BINARY_INSTALL has been removed as of version ', '\n '], ['\n The environment variable CYPRESS_SKIP_BINARY_INSTALL has been removed as of version ', '\n ']),
|
18
|
+
_templateObject16 = _taggedTemplateLiteral(['\n To skip the binary install, set CYPRESS_INSTALL_BINARY=0\n '], ['\n To skip the binary install, set CYPRESS_INSTALL_BINARY=0\n ']),
|
19
|
+
_templateObject17 = _taggedTemplateLiteral(['\n Platform: ', ' (', ')\n Cypress Version: ', '\n '], ['\n Platform: ', ' (', ')\n Cypress Version: ', '\n ']);
|
19
20
|
|
20
21
|
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
21
22
|
|
@@ -46,49 +47,49 @@ var hr = '----------';
|
|
46
47
|
// common errors Cypress application can encounter
|
47
48
|
var failedDownload = {
|
48
49
|
description: 'The Cypress App could not be downloaded.',
|
49
|
-
solution:
|
50
|
+
solution: stripIndent(_templateObject)
|
50
51
|
};
|
51
52
|
|
52
53
|
var failedUnzip = {
|
53
54
|
description: 'The Cypress App could not be unzipped.',
|
54
|
-
solution: stripIndent(
|
55
|
+
solution: stripIndent(_templateObject2, chalk.blue(util.issuesUrl))
|
55
56
|
};
|
56
57
|
|
57
58
|
var missingApp = function missingApp(binaryDir) {
|
58
59
|
return {
|
59
60
|
description: 'No version of Cypress is installed in: ' + chalk.cyan(binaryDir),
|
60
|
-
solution: stripIndent(
|
61
|
+
solution: stripIndent(_templateObject3, chalk.cyan('cypress install'))
|
61
62
|
};
|
62
63
|
};
|
63
64
|
|
64
65
|
var binaryNotExecutable = function binaryNotExecutable(executable) {
|
65
66
|
return {
|
66
67
|
description: 'Cypress cannot run because this binary file does not have executable permissions here:\n\n' + executable,
|
67
|
-
solution: stripIndent(
|
68
|
+
solution: stripIndent(_templateObject4)
|
68
69
|
};
|
69
70
|
};
|
70
71
|
|
71
72
|
var notInstalledCI = function notInstalledCI(executable) {
|
72
73
|
return {
|
73
74
|
description: 'The cypress npm package is installed, but the Cypress binary is missing.',
|
74
|
-
solution: stripIndent(
|
75
|
+
solution: stripIndent(_templateObject5, chalk.cyan(executable), util.getCacheDir(), util.getCacheDir(), chalk.blue('https://on.cypress.io/not-installed-ci-error'))
|
75
76
|
};
|
76
77
|
};
|
77
78
|
|
78
79
|
var nonZeroExitCodeXvfb = {
|
79
80
|
description: 'Xvfb exited with a non zero exit code.',
|
80
|
-
solution: stripIndent(
|
81
|
+
solution: stripIndent(_templateObject6)
|
81
82
|
};
|
82
83
|
|
83
84
|
var missingXvfb = {
|
84
85
|
description: 'Your system is missing the dependency: Xvfb',
|
85
|
-
solution: stripIndent(
|
86
|
+
solution: stripIndent(_templateObject7, chalk.blue(requiredDependenciesUrl))
|
86
87
|
};
|
87
88
|
|
88
89
|
var smokeTestFailure = function smokeTestFailure(smokeTestCommand, timedOut) {
|
89
90
|
return {
|
90
91
|
description: 'Cypress verification ' + (timedOut ? 'timed out' : 'failed') + '.',
|
91
|
-
solution: stripIndent(
|
92
|
+
solution: stripIndent(_templateObject8, smokeTestCommand)
|
92
93
|
};
|
93
94
|
};
|
94
95
|
|
@@ -96,19 +97,19 @@ var invalidSmokeTestDisplayError = {
|
|
96
97
|
code: 'INVALID_SMOKE_TEST_DISPLAY_ERROR',
|
97
98
|
description: 'Cypress verification failed.',
|
98
99
|
solution: function solution(msg) {
|
99
|
-
return stripIndent(
|
100
|
+
return stripIndent(_templateObject9, hr, msg, hr, chalk.blue(requiredDependenciesUrl));
|
100
101
|
}
|
101
102
|
};
|
102
103
|
|
103
104
|
var missingDependency = {
|
104
105
|
description: 'Cypress failed to start.',
|
105
106
|
// this message is too Linux specific
|
106
|
-
solution: stripIndent(
|
107
|
+
solution: stripIndent(_templateObject10, chalk.blue(requiredDependenciesUrl))
|
107
108
|
};
|
108
109
|
|
109
110
|
var invalidCacheDirectory = {
|
110
111
|
description: 'Cypress cannot write to the cache directory due to file permissions',
|
111
|
-
solution: stripIndent(
|
112
|
+
solution: stripIndent(_templateObject11, chalk.blue(util.getGitHubIssueUrl(1281)))
|
112
113
|
};
|
113
114
|
|
114
115
|
var versionMismatch = {
|
@@ -118,17 +119,23 @@ var versionMismatch = {
|
|
118
119
|
|
119
120
|
var unexpected = {
|
120
121
|
description: 'An unexpected error occurred while verifying the Cypress executable.',
|
121
|
-
solution: stripIndent(
|
122
|
+
solution: stripIndent(_templateObject12, chalk.blue(docsUrl), chalk.blue(util.issuesUrl))
|
123
|
+
};
|
124
|
+
|
125
|
+
var invalidCypressEnv = {
|
126
|
+
description: chalk.red('The environment variable with the reserved name "CYPRESS_ENV" is set.'),
|
127
|
+
solution: chalk.red('Unset the "CYPRESS_ENV" environment variable and run Cypress again.'),
|
128
|
+
exitCode: 11
|
122
129
|
};
|
123
130
|
|
124
131
|
var removed = {
|
125
132
|
CYPRESS_BINARY_VERSION: {
|
126
|
-
description: stripIndent(
|
127
|
-
solution: stripIndent(
|
133
|
+
description: stripIndent(_templateObject13, chalk.green('3.0.0')),
|
134
|
+
solution: stripIndent(_templateObject14)
|
128
135
|
},
|
129
136
|
CYPRESS_SKIP_BINARY_INSTALL: {
|
130
|
-
description: stripIndent(
|
131
|
-
solution: stripIndent(
|
137
|
+
description: stripIndent(_templateObject15, chalk.green('3.0.0')),
|
138
|
+
solution: stripIndent(_templateObject16)
|
132
139
|
}
|
133
140
|
};
|
134
141
|
|
@@ -145,7 +152,7 @@ var CYPRESS_RUN_BINARY = {
|
|
145
152
|
|
146
153
|
function getPlatformInfo() {
|
147
154
|
return util.getOsVersionAsync().then(function (version) {
|
148
|
-
return stripIndent(
|
155
|
+
return stripIndent(_templateObject17, os.platform(), version, util.pkgVersion());
|
149
156
|
});
|
150
157
|
}
|
151
158
|
|
@@ -216,8 +223,26 @@ var throwFormErrorText = function throwFormErrorText(info) {
|
|
216
223
|
};
|
217
224
|
};
|
218
225
|
|
226
|
+
/**
|
227
|
+
* Forms full error message with error and OS details, prints to the error output
|
228
|
+
* and then exits the process.
|
229
|
+
* @param {ErrorInformation} info Error information {description, solution}
|
230
|
+
* @example return exitWithError(errors.invalidCypressEnv)('foo')
|
231
|
+
*/
|
232
|
+
var exitWithError = function exitWithError(info) {
|
233
|
+
return function (msg) {
|
234
|
+
return formErrorText(info, msg).then(function (text) {
|
235
|
+
// eslint-disable-next-line no-console
|
236
|
+
console.error(text);
|
237
|
+
process.exit(info.exitCode || 1);
|
238
|
+
});
|
239
|
+
};
|
240
|
+
};
|
241
|
+
|
219
242
|
module.exports = {
|
220
243
|
raise: raise,
|
244
|
+
exitWithError: exitWithError,
|
245
|
+
// formError,
|
221
246
|
formErrorText: formErrorText,
|
222
247
|
throwFormErrorText: throwFormErrorText,
|
223
248
|
hr: hr,
|
@@ -233,6 +258,7 @@ module.exports = {
|
|
233
258
|
unexpected: unexpected,
|
234
259
|
failedDownload: failedDownload,
|
235
260
|
failedUnzip: failedUnzip,
|
261
|
+
invalidCypressEnv: invalidCypressEnv,
|
236
262
|
invalidCacheDirectory: invalidCacheDirectory,
|
237
263
|
removed: removed,
|
238
264
|
CYPRESS_RUN_BINARY: CYPRESS_RUN_BINARY,
|
package/lib/exec/open.js
CHANGED
package/lib/exec/run.js
CHANGED
@@ -30,6 +30,10 @@ var processRunOptions = function processRunOptions() {
|
|
30
30
|
args.push('--config', options.config);
|
31
31
|
}
|
32
32
|
|
33
|
+
if (options.configFile !== undefined) {
|
34
|
+
args.push('--config-file', options.configFile);
|
35
|
+
}
|
36
|
+
|
33
37
|
if (options.port) {
|
34
38
|
args.push('--port', options.port);
|
35
39
|
}
|
package/lib/exec/spawn.js
CHANGED
@@ -11,6 +11,7 @@ var debugElectron = require('debug')('cypress:electron');
|
|
11
11
|
var util = require('../util');
|
12
12
|
var state = require('../tasks/state');
|
13
13
|
var xvfb = require('./xvfb');
|
14
|
+
var verify = require('../tasks/verify');
|
14
15
|
|
15
16
|
var _require = require('../errors'),
|
16
17
|
throwFormErrorText = _require.throwFormErrorText,
|
@@ -18,8 +19,9 @@ var _require = require('../errors'),
|
|
18
19
|
|
19
20
|
var isXlibOrLibudevRe = /^(?:Xlib|libudev)/;
|
20
21
|
var isHighSierraWarningRe = /\*\*\* WARNING/;
|
22
|
+
var isRenderWorkerRe = /\.RenderWorker-/;
|
21
23
|
|
22
|
-
var GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe];
|
24
|
+
var GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe];
|
23
25
|
|
24
26
|
var isGarbageLineWarning = function isGarbageLineWarning(str) {
|
25
27
|
return _.some(GARBAGE_WARNINGS, function (re) {
|
@@ -58,6 +60,8 @@ function getStdio(needsXvfb) {
|
|
58
60
|
}
|
59
61
|
|
60
62
|
module.exports = {
|
63
|
+
isGarbageLineWarning: isGarbageLineWarning,
|
64
|
+
|
61
65
|
start: function start(args) {
|
62
66
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
63
67
|
|
@@ -71,6 +75,8 @@ module.exports = {
|
|
71
75
|
debug('needs to start own Xvfb?', needsXvfb);
|
72
76
|
|
73
77
|
// always push cwd into the args
|
78
|
+
// which additionally acts as a signal to the
|
79
|
+
// binary that it was invoked through the NPM module
|
74
80
|
args = [].concat(args, '--cwd', process.cwd());
|
75
81
|
|
76
82
|
_.defaults(options, {
|
@@ -103,6 +109,10 @@ module.exports = {
|
|
103
109
|
var electronArgs = _.clone(args);
|
104
110
|
var node11WindowsFix = isPlatform('win32');
|
105
111
|
|
112
|
+
if (verify.needsSandbox()) {
|
113
|
+
electronArgs.push('--no-sandbox');
|
114
|
+
}
|
115
|
+
|
106
116
|
// strip dev out of child process options
|
107
117
|
var stdioOptions = _.pick(options, 'env', 'detached', 'stdio');
|
108
118
|
|
@@ -130,40 +140,64 @@ module.exports = {
|
|
130
140
|
|
131
141
|
var child = cp.spawn(executable, electronArgs, stdioOptions);
|
132
142
|
|
133
|
-
|
143
|
+
function resolveOn(event) {
|
144
|
+
return function (code, signal) {
|
145
|
+
debug('child event fired %o', { event: event, code: code, signal: signal });
|
146
|
+
resolve(code);
|
147
|
+
};
|
148
|
+
}
|
149
|
+
|
150
|
+
child.on('close', resolveOn('close'));
|
151
|
+
child.on('exit', resolveOn('exit'));
|
134
152
|
child.on('error', reject);
|
135
153
|
|
136
|
-
|
137
|
-
|
154
|
+
// if stdio options is set to 'pipe', then
|
155
|
+
// we should set up pipes:
|
156
|
+
// process STDIN (read stream) => child STDIN (writeable)
|
157
|
+
// child STDOUT => process STDOUT
|
158
|
+
// child STDERR => process STDERR with additional filtering
|
159
|
+
if (child.stdin) {
|
160
|
+
debug('piping process STDIN into child STDIN');
|
161
|
+
process.stdin.pipe(child.stdin);
|
162
|
+
}
|
163
|
+
|
164
|
+
if (child.stdout) {
|
165
|
+
debug('piping child STDOUT to process STDOUT');
|
166
|
+
child.stdout.pipe(process.stdout);
|
167
|
+
}
|
138
168
|
|
139
169
|
// if this is defined then we are manually piping for linux
|
140
170
|
// to filter out the garbage
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
171
|
+
if (child.stderr) {
|
172
|
+
debug('piping child STDERR to process STDERR');
|
173
|
+
child.stderr.on('data', function (data) {
|
174
|
+
var str = data.toString();
|
175
|
+
|
176
|
+
// bail if this is warning line garbage
|
177
|
+
if (isGarbageLineWarning(str)) {
|
178
|
+
return;
|
179
|
+
}
|
148
180
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
181
|
+
// if we have a callback and this explictly returns
|
182
|
+
// false then bail
|
183
|
+
if (onStderrData && onStderrData(str) === false) {
|
184
|
+
return;
|
185
|
+
}
|
154
186
|
|
155
|
-
|
156
|
-
|
157
|
-
|
187
|
+
// else pass it along!
|
188
|
+
process.stderr.write(data);
|
189
|
+
});
|
190
|
+
}
|
158
191
|
|
159
192
|
// https://github.com/cypress-io/cypress/issues/1841
|
193
|
+
// https://github.com/cypress-io/cypress/issues/5241
|
160
194
|
// In some versions of node, it will throw on windows
|
161
195
|
// when you close the parent process after piping
|
162
196
|
// into the child process. unpiping does not seem
|
163
197
|
// to have any effect. so we're just catching the
|
164
198
|
// error here and not doing anything.
|
165
199
|
process.stdin.on('error', function (err) {
|
166
|
-
if (err.code
|
200
|
+
if (['EPIPE', 'ENOTCONN'].includes(err.code)) {
|
167
201
|
return;
|
168
202
|
}
|
169
203
|
|
package/lib/exec/versions.js
CHANGED
package/lib/exec/xvfb.js
CHANGED
@@ -21,7 +21,7 @@ var _require2 = require('../errors'),
|
|
21
21
|
var util = require('../util');
|
22
22
|
|
23
23
|
var xvfb = Promise.promisifyAll(new Xvfb({
|
24
|
-
timeout:
|
24
|
+
timeout: 30000, // milliseconds
|
25
25
|
onStderrData: function onStderrData(data) {
|
26
26
|
if (debugXvfb.enabled) {
|
27
27
|
debugXvfb(data.toString());
|