cypress 15.1.0 → 15.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cypress +3 -1
- package/index.js +49 -24
- package/lib/VerboseRenderer.js +50 -47
- package/lib/cli.js +455 -351
- package/lib/cypress.js +93 -90
- package/lib/errors.js +181 -194
- package/lib/exec/info.js +85 -74
- package/lib/exec/open.js +77 -73
- package/lib/exec/run.js +144 -154
- package/lib/exec/shared.js +37 -44
- package/lib/exec/spawn.js +270 -232
- package/lib/exec/versions.js +57 -49
- package/lib/exec/xvfb.js +79 -81
- package/lib/fs.js +7 -3
- package/lib/logger.js +37 -32
- package/lib/tasks/cache.js +128 -113
- package/lib/tasks/download.js +247 -258
- package/lib/tasks/get-folder-size.js +33 -22
- package/lib/tasks/install.js +274 -312
- package/lib/tasks/state.js +132 -143
- package/lib/tasks/unzip.js +186 -188
- package/lib/tasks/verify.js +274 -261
- package/lib/util.js +357 -355
- package/package.json +3 -3
package/lib/exec/info.js
CHANGED
@@ -1,92 +1,103 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
15
|
/* eslint-disable no-console */
|
4
|
-
const
|
5
|
-
const
|
6
|
-
const
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
|
16
|
+
const spawn_1 = __importDefault(require("./spawn"));
|
17
|
+
const util_1 = __importDefault(require("../util"));
|
18
|
+
const state_1 = __importDefault(require("../tasks/state"));
|
19
|
+
const os_1 = __importDefault(require("os"));
|
20
|
+
const chalk_1 = __importDefault(require("chalk"));
|
21
|
+
const pretty_bytes_1 = __importDefault(require("pretty-bytes"));
|
22
|
+
const lodash_1 = __importDefault(require("lodash"));
|
12
23
|
// color for numbers and show values
|
13
|
-
const g =
|
24
|
+
const g = chalk_1.default.green;
|
14
25
|
// color for paths
|
15
|
-
const p =
|
16
|
-
const red =
|
26
|
+
const p = chalk_1.default.cyan;
|
27
|
+
const red = chalk_1.default.red;
|
17
28
|
// urls
|
18
|
-
const link =
|
19
|
-
|
29
|
+
const link = chalk_1.default.blue.underline;
|
20
30
|
// to be exported
|
21
31
|
const methods = {};
|
22
32
|
methods.findProxyEnvironmentVariables = () => {
|
23
|
-
|
33
|
+
return lodash_1.default.pick(process.env, ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY']);
|
24
34
|
};
|
25
|
-
const maskSensitiveVariables = obj => {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
masked
|
31
|
-
}
|
32
|
-
return masked;
|
35
|
+
const maskSensitiveVariables = (obj) => {
|
36
|
+
const masked = Object.assign({}, obj);
|
37
|
+
if (masked.CYPRESS_RECORD_KEY) {
|
38
|
+
masked.CYPRESS_RECORD_KEY = '<redacted>';
|
39
|
+
}
|
40
|
+
return masked;
|
33
41
|
};
|
34
42
|
methods.findCypressEnvironmentVariables = () => {
|
35
|
-
|
36
|
-
|
43
|
+
const isCyVariable = (val, key) => key.startsWith('CYPRESS_');
|
44
|
+
return lodash_1.default.pickBy(process.env, isCyVariable);
|
37
45
|
};
|
38
46
|
const formatCypressVariables = () => {
|
39
|
-
|
40
|
-
|
47
|
+
const vars = methods.findCypressEnvironmentVariables();
|
48
|
+
return maskSensitiveVariables(vars);
|
41
49
|
};
|
42
|
-
methods.start =
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
});
|
47
|
-
console.log();
|
48
|
-
const proxyVars = methods.findProxyEnvironmentVariables();
|
49
|
-
if (_.isEmpty(proxyVars)) {
|
50
|
-
console.log('Proxy Settings: none detected');
|
51
|
-
} else {
|
52
|
-
console.log('Proxy Settings:');
|
53
|
-
_.forEach(proxyVars, (value, key) => {
|
54
|
-
console.log('%s: %s', key, g(value));
|
50
|
+
methods.start = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (options = {}) {
|
51
|
+
const args = ['--mode=info'];
|
52
|
+
yield spawn_1.default.start(args, {
|
53
|
+
dev: options.dev,
|
55
54
|
});
|
56
55
|
console.log();
|
57
|
-
|
56
|
+
const proxyVars = methods.findProxyEnvironmentVariables();
|
57
|
+
if (lodash_1.default.isEmpty(proxyVars)) {
|
58
|
+
console.log('Proxy Settings: none detected');
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
console.log('Proxy Settings:');
|
62
|
+
lodash_1.default.forEach(proxyVars, (value, key) => {
|
63
|
+
console.log('%s: %s', key, g(value));
|
64
|
+
});
|
65
|
+
console.log();
|
66
|
+
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'));
|
67
|
+
console.log();
|
68
|
+
}
|
69
|
+
const cyVars = formatCypressVariables();
|
70
|
+
if (lodash_1.default.isEmpty(cyVars)) {
|
71
|
+
console.log('Environment Variables: none detected');
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
console.log('Environment Variables:');
|
75
|
+
lodash_1.default.forEach(cyVars, (value, key) => {
|
76
|
+
console.log('%s: %s', key, g(value));
|
77
|
+
});
|
78
|
+
}
|
58
79
|
console.log();
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
console.log('Environment Variables: none detected');
|
63
|
-
} else {
|
64
|
-
console.log('Environment Variables:');
|
65
|
-
_.forEach(cyVars, (value, key) => {
|
66
|
-
console.log('%s: %s', key, g(value));
|
67
|
-
});
|
68
|
-
}
|
69
|
-
console.log();
|
70
|
-
console.log('Application Data:', p(util.getApplicationDataFolder()));
|
71
|
-
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')));
|
72
|
-
console.log('Binary Caches: %s', p(state.getCacheDir()));
|
73
|
-
console.log();
|
74
|
-
const osVersion = await util.getOsVersionAsync();
|
75
|
-
const buildInfo = util.pkgBuildInfo();
|
76
|
-
const isStable = buildInfo && buildInfo.stable;
|
77
|
-
console.log('Cypress Version: %s', g(util.pkgVersion()), isStable ? g('(stable)') : red('(pre-release)'));
|
78
|
-
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion));
|
79
|
-
console.log('System Memory: %s free %s', g(prettyBytes(os.totalmem())), g(prettyBytes(os.freemem())));
|
80
|
-
if (!buildInfo) {
|
81
|
-
console.log();
|
82
|
-
console.log('This is the', red('development'), '(un-built) Cypress CLI.');
|
83
|
-
} else if (!isStable) {
|
80
|
+
console.log('Application Data:', p(util_1.default.getApplicationDataFolder()));
|
81
|
+
console.log('Browser Profiles:', p(util_1.default.getApplicationDataFolder('browsers')));
|
82
|
+
console.log('Binary Caches: %s', p(state_1.default.getCacheDir()));
|
84
83
|
console.log();
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
console.log('
|
89
|
-
console.log('
|
90
|
-
|
91
|
-
|
92
|
-
|
84
|
+
const osVersion = yield util_1.default.getOsVersionAsync();
|
85
|
+
const buildInfo = util_1.default.pkgBuildInfo();
|
86
|
+
const isStable = buildInfo && buildInfo.stable;
|
87
|
+
console.log('Cypress Version: %s', g(util_1.default.pkgVersion()), isStable ? g('(stable)') : red('(pre-release)'));
|
88
|
+
console.log('System Platform: %s (%s)', g(os_1.default.platform()), g(osVersion));
|
89
|
+
console.log('System Memory: %s free %s', g((0, pretty_bytes_1.default)(os_1.default.totalmem())), g((0, pretty_bytes_1.default)(os_1.default.freemem())));
|
90
|
+
if (!buildInfo) {
|
91
|
+
console.log();
|
92
|
+
console.log('This is the', red('development'), '(un-built) Cypress CLI.');
|
93
|
+
}
|
94
|
+
else if (!isStable) {
|
95
|
+
console.log();
|
96
|
+
console.log('This is a', red('pre-release'), 'build of Cypress.');
|
97
|
+
console.log('Build info:');
|
98
|
+
console.log(' Commit SHA:', g(buildInfo.commitSha));
|
99
|
+
console.log(' Commit Branch:', g(buildInfo.commitBranch));
|
100
|
+
console.log(' Commit Date:', g(buildInfo.commitDate));
|
101
|
+
}
|
102
|
+
});
|
103
|
+
exports.default = methods;
|
package/lib/exec/open.js
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.start = exports.processOpenOptions = void 0;
|
7
|
+
const debug_1 = __importDefault(require("debug"));
|
8
|
+
const util_1 = __importDefault(require("../util"));
|
9
|
+
const spawn_1 = __importDefault(require("./spawn"));
|
10
|
+
const verify_1 = __importDefault(require("../tasks/verify"));
|
11
|
+
const shared_1 = require("./shared");
|
12
|
+
const errors_1 = require("../errors");
|
13
|
+
const debug = (0, debug_1.default)('cypress:cli');
|
15
14
|
/**
|
16
15
|
* Maps options collected by the CLI
|
17
16
|
* and forms list of CLI arguments to the server.
|
@@ -22,69 +21,74 @@ const {
|
|
22
21
|
* @returns {string[]} list of CLI arguments
|
23
22
|
*/
|
24
23
|
const processOpenOptions = (options = {}) => {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
24
|
+
// In addition to setting the project directory, setting the project option
|
25
|
+
// here ultimately decides whether cypress is run in global mode or not.
|
26
|
+
// It's first based off whether it's installed globally by npm/yarn (-g).
|
27
|
+
// A global install can be overridden by the --project flag, putting Cypress
|
28
|
+
// in project mode. A non-global install can be overridden by the --global
|
29
|
+
// flag, putting it in global mode.
|
30
|
+
if (!util_1.default.isInstalledGlobally() && !options.global && !options.project) {
|
31
|
+
options.project = process.cwd();
|
32
|
+
}
|
33
|
+
const args = [];
|
34
|
+
if (options.config) {
|
35
|
+
args.push('--config', options.config);
|
36
|
+
}
|
37
|
+
if (options.configFile !== undefined) {
|
38
|
+
(0, shared_1.checkConfigFile)(options);
|
39
|
+
args.push('--config-file', options.configFile);
|
40
|
+
}
|
41
|
+
if (options.browser) {
|
42
|
+
args.push('--browser', options.browser);
|
43
|
+
}
|
44
|
+
if (options.env) {
|
45
|
+
args.push('--env', options.env);
|
46
|
+
}
|
47
|
+
if (options.port) {
|
48
|
+
args.push('--port', options.port);
|
49
|
+
}
|
50
|
+
if (options.project) {
|
51
|
+
args.push('--project', options.project);
|
52
|
+
}
|
53
|
+
if (options.global) {
|
54
|
+
args.push('--global', options.global);
|
55
|
+
}
|
56
|
+
if (options.inspect) {
|
57
|
+
args.push('--inspect');
|
58
|
+
}
|
59
|
+
if (options.inspectBrk) {
|
60
|
+
args.push('--inspectBrk');
|
61
|
+
}
|
62
|
+
args.push(...(0, shared_1.processTestingType)(options));
|
63
|
+
debug('opening from options %j', options);
|
64
|
+
debug('command line arguments %j', args);
|
65
|
+
return args;
|
67
66
|
};
|
68
|
-
|
69
|
-
|
70
|
-
start(options = {}) {
|
67
|
+
exports.processOpenOptions = processOpenOptions;
|
68
|
+
const start = (options = {}) => {
|
71
69
|
function open() {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
70
|
+
try {
|
71
|
+
const args = (0, exports.processOpenOptions)(options);
|
72
|
+
return spawn_1.default.start(args, {
|
73
|
+
dev: options.dev,
|
74
|
+
detached: Boolean(options.detached),
|
75
|
+
});
|
76
|
+
}
|
77
|
+
catch (err) {
|
78
|
+
if (err.details) {
|
79
|
+
return (0, errors_1.exitWithError)(err.details)();
|
80
|
+
}
|
81
|
+
throw err;
|
81
82
|
}
|
82
|
-
throw err;
|
83
|
-
}
|
84
83
|
}
|
85
84
|
if (options.dev) {
|
86
|
-
|
85
|
+
return open();
|
87
86
|
}
|
88
|
-
return
|
89
|
-
|
90
|
-
};
|
87
|
+
return verify_1.default.start()
|
88
|
+
.then(open);
|
89
|
+
};
|
90
|
+
exports.start = start;
|
91
|
+
exports.default = {
|
92
|
+
start: exports.start,
|
93
|
+
processOpenOptions: exports.processOpenOptions,
|
94
|
+
};
|
package/lib/exec/run.js
CHANGED
@@ -1,36 +1,31 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
const
|
7
|
-
const
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const
|
13
|
-
|
14
|
-
throwInvalidOptionError,
|
15
|
-
checkConfigFile
|
16
|
-
} = require('./shared');
|
17
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const lodash_1 = __importDefault(require("lodash"));
|
7
|
+
const debug_1 = __importDefault(require("debug"));
|
8
|
+
const util_1 = __importDefault(require("../util"));
|
9
|
+
const spawn_1 = __importDefault(require("./spawn"));
|
10
|
+
const verify_1 = __importDefault(require("../tasks/verify"));
|
11
|
+
const errors_1 = require("../errors");
|
12
|
+
const shared_1 = require("./shared");
|
13
|
+
const debug = (0, debug_1.default)('cypress:cli:run');
|
18
14
|
/**
|
19
15
|
* Typically a user passes a string path to the project.
|
20
16
|
* But "cypress open" allows using `false` to open in global mode,
|
21
17
|
* and the user can accidentally execute `cypress run --project false`
|
22
18
|
* which should be invalid.
|
23
19
|
*/
|
24
|
-
const isValidProject = v => {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
20
|
+
const isValidProject = (v) => {
|
21
|
+
if (typeof v === 'boolean') {
|
22
|
+
return false;
|
23
|
+
}
|
24
|
+
if (v === '' || v === 'false' || v === 'true') {
|
25
|
+
return false;
|
26
|
+
}
|
27
|
+
return true;
|
32
28
|
};
|
33
|
-
|
34
29
|
/**
|
35
30
|
* Maps options collected by the CLI
|
36
31
|
* and forms list of CLI arguments to the server.
|
@@ -41,136 +36,131 @@ const isValidProject = v => {
|
|
41
36
|
* @returns {string[]} list of CLI arguments
|
42
37
|
*/
|
43
38
|
const processRunOptions = (options = {}) => {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
args.push('--group', options.group);
|
76
|
-
}
|
77
|
-
if (options.headed) {
|
78
|
-
args.push('--headed', options.headed);
|
79
|
-
}
|
80
|
-
if (options.headless) {
|
39
|
+
debug('processing run options %o', options);
|
40
|
+
if (!isValidProject(options.project)) {
|
41
|
+
debug('invalid project option %o', { project: options.project });
|
42
|
+
return (0, shared_1.throwInvalidOptionError)(errors_1.errors.invalidRunProjectPath);
|
43
|
+
}
|
44
|
+
const args = ['--run-project', options.project];
|
45
|
+
if (options.autoCancelAfterFailures || options.autoCancelAfterFailures === 0 || options.autoCancelAfterFailures === false) {
|
46
|
+
args.push('--auto-cancel-after-failures', options.autoCancelAfterFailures);
|
47
|
+
}
|
48
|
+
if (options.browser) {
|
49
|
+
args.push('--browser', options.browser);
|
50
|
+
}
|
51
|
+
if (options.ciBuildId) {
|
52
|
+
args.push('--ci-build-id', options.ciBuildId);
|
53
|
+
}
|
54
|
+
if (options.config) {
|
55
|
+
args.push('--config', options.config);
|
56
|
+
}
|
57
|
+
if (options.configFile !== undefined) {
|
58
|
+
(0, shared_1.checkConfigFile)(options);
|
59
|
+
args.push('--config-file', options.configFile);
|
60
|
+
}
|
61
|
+
if (options.env) {
|
62
|
+
args.push('--env', options.env);
|
63
|
+
}
|
64
|
+
if (options.exit === false) {
|
65
|
+
args.push('--no-exit');
|
66
|
+
}
|
67
|
+
if (options.group) {
|
68
|
+
args.push('--group', options.group);
|
69
|
+
}
|
81
70
|
if (options.headed) {
|
82
|
-
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
// if key is set use that - else attempt to find it by environment variable
|
88
|
-
if (options.key == null) {
|
89
|
-
debug('--key is not set, looking up environment variable CYPRESS_RECORD_KEY');
|
90
|
-
options.key = util.getEnv('CYPRESS_RECORD_KEY');
|
91
|
-
}
|
92
|
-
|
93
|
-
// if we have a key assume we're in record mode
|
94
|
-
if (options.key) {
|
95
|
-
args.push('--key', options.key);
|
96
|
-
}
|
97
|
-
if (options.outputPath) {
|
98
|
-
args.push('--output-path', options.outputPath);
|
99
|
-
}
|
100
|
-
if (options.parallel) {
|
101
|
-
args.push('--parallel');
|
102
|
-
}
|
103
|
-
if (options.port) {
|
104
|
-
args.push('--port', options.port);
|
105
|
-
}
|
106
|
-
if (options.quiet) {
|
107
|
-
args.push('--quiet');
|
108
|
-
}
|
109
|
-
|
110
|
-
// if record is defined and we're not
|
111
|
-
// already in ci mode, then send it up
|
112
|
-
if (options.record != null) {
|
113
|
-
args.push('--record', options.record);
|
114
|
-
}
|
115
|
-
|
116
|
-
// if we have a specific reporter push that into the args
|
117
|
-
if (options.reporter) {
|
118
|
-
args.push('--reporter', options.reporter);
|
119
|
-
}
|
120
|
-
|
121
|
-
// if we have a specific reporter push that into the args
|
122
|
-
if (options.reporterOptions) {
|
123
|
-
args.push('--reporter-options', options.reporterOptions);
|
124
|
-
}
|
125
|
-
if (options.runnerUi != null) {
|
126
|
-
args.push('--runner-ui', options.runnerUi);
|
127
|
-
}
|
128
|
-
|
129
|
-
// if we have specific spec(s) push that into the args
|
130
|
-
if (options.spec) {
|
131
|
-
args.push('--spec', options.spec);
|
132
|
-
}
|
133
|
-
if (options.tag) {
|
134
|
-
args.push('--tag', options.tag);
|
135
|
-
}
|
136
|
-
if (options.inspect) {
|
137
|
-
args.push('--inspect');
|
138
|
-
}
|
139
|
-
if (options.inspectBrk) {
|
140
|
-
args.push('--inspectBrk');
|
141
|
-
}
|
142
|
-
args.push(...processTestingType(options));
|
143
|
-
return args;
|
144
|
-
};
|
145
|
-
module.exports = {
|
146
|
-
processRunOptions,
|
147
|
-
isValidProject,
|
148
|
-
// resolves with the number of failed tests
|
149
|
-
start(options = {}) {
|
150
|
-
_.defaults(options, {
|
151
|
-
key: null,
|
152
|
-
spec: null,
|
153
|
-
reporter: null,
|
154
|
-
reporterOptions: null,
|
155
|
-
project: process.cwd()
|
156
|
-
});
|
157
|
-
function run() {
|
158
|
-
try {
|
159
|
-
const args = processRunOptions(options);
|
160
|
-
debug('run to spawn.start args %j', args);
|
161
|
-
return spawn.start(args, {
|
162
|
-
dev: options.dev
|
163
|
-
});
|
164
|
-
} catch (err) {
|
165
|
-
if (err.details) {
|
166
|
-
return exitWithError(err.details)();
|
71
|
+
args.push('--headed', options.headed);
|
72
|
+
}
|
73
|
+
if (options.headless) {
|
74
|
+
if (options.headed) {
|
75
|
+
return (0, shared_1.throwInvalidOptionError)(errors_1.errors.incompatibleHeadlessFlags);
|
167
76
|
}
|
168
|
-
|
169
|
-
|
77
|
+
args.push('--headed', String(!options.headless));
|
78
|
+
}
|
79
|
+
// if key is set use that - else attempt to find it by environment variable
|
80
|
+
if (options.key == null) {
|
81
|
+
debug('--key is not set, looking up environment variable CYPRESS_RECORD_KEY');
|
82
|
+
options.key = util_1.default.getEnv('CYPRESS_RECORD_KEY');
|
83
|
+
}
|
84
|
+
// if we have a key assume we're in record mode
|
85
|
+
if (options.key) {
|
86
|
+
args.push('--key', options.key);
|
170
87
|
}
|
171
|
-
if (options.
|
172
|
-
|
88
|
+
if (options.outputPath) {
|
89
|
+
args.push('--output-path', options.outputPath);
|
173
90
|
}
|
174
|
-
|
175
|
-
|
176
|
-
}
|
91
|
+
if (options.parallel) {
|
92
|
+
args.push('--parallel');
|
93
|
+
}
|
94
|
+
if (options.port) {
|
95
|
+
args.push('--port', options.port);
|
96
|
+
}
|
97
|
+
if (options.quiet) {
|
98
|
+
args.push('--quiet');
|
99
|
+
}
|
100
|
+
// if record is defined and we're not
|
101
|
+
// already in ci mode, then send it up
|
102
|
+
if (options.record != null) {
|
103
|
+
args.push('--record', options.record);
|
104
|
+
}
|
105
|
+
// if we have a specific reporter push that into the args
|
106
|
+
if (options.reporter) {
|
107
|
+
args.push('--reporter', options.reporter);
|
108
|
+
}
|
109
|
+
// if we have a specific reporter push that into the args
|
110
|
+
if (options.reporterOptions) {
|
111
|
+
args.push('--reporter-options', options.reporterOptions);
|
112
|
+
}
|
113
|
+
if (options.runnerUi != null) {
|
114
|
+
args.push('--runner-ui', options.runnerUi);
|
115
|
+
}
|
116
|
+
// if we have specific spec(s) push that into the args
|
117
|
+
if (options.spec) {
|
118
|
+
args.push('--spec', options.spec);
|
119
|
+
}
|
120
|
+
if (options.tag) {
|
121
|
+
args.push('--tag', options.tag);
|
122
|
+
}
|
123
|
+
if (options.inspect) {
|
124
|
+
args.push('--inspect');
|
125
|
+
}
|
126
|
+
if (options.inspectBrk) {
|
127
|
+
args.push('--inspectBrk');
|
128
|
+
}
|
129
|
+
args.push(...(0, shared_1.processTestingType)(options));
|
130
|
+
return args;
|
131
|
+
};
|
132
|
+
const runModule = {
|
133
|
+
processRunOptions,
|
134
|
+
isValidProject,
|
135
|
+
// resolves with the number of failed tests
|
136
|
+
start(options = {}) {
|
137
|
+
lodash_1.default.defaults(options, {
|
138
|
+
key: null,
|
139
|
+
spec: null,
|
140
|
+
reporter: null,
|
141
|
+
reporterOptions: null,
|
142
|
+
project: process.cwd(),
|
143
|
+
});
|
144
|
+
function run() {
|
145
|
+
try {
|
146
|
+
const args = processRunOptions(options);
|
147
|
+
debug('run to spawn.start args %j', args);
|
148
|
+
return spawn_1.default.start(args, {
|
149
|
+
dev: options.dev,
|
150
|
+
});
|
151
|
+
}
|
152
|
+
catch (err) {
|
153
|
+
if (err.details) {
|
154
|
+
return (0, errors_1.exitWithError)(err.details)();
|
155
|
+
}
|
156
|
+
throw err;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
if (options.dev) {
|
160
|
+
return run();
|
161
|
+
}
|
162
|
+
return verify_1.default.start()
|
163
|
+
.then(run);
|
164
|
+
},
|
165
|
+
};
|
166
|
+
exports.default = runModule;
|