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/bin/cypress
CHANGED
package/index.js
CHANGED
@@ -1,27 +1,52 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
+
const minimist_1 = __importDefault(require("minimist"));
|
15
|
+
const debug_1 = __importDefault(require("debug"));
|
16
|
+
const util_1 = __importDefault(require("./lib/util"));
|
17
|
+
const cypress_1 = __importDefault(require("./lib/cypress"));
|
18
|
+
const install_1 = __importDefault(require("./lib/tasks/install"));
|
19
|
+
const verify_1 = __importDefault(require("./lib/tasks/verify"));
|
20
|
+
const debugCli = (0, debug_1.default)('cypress:cli');
|
21
|
+
const args = (0, minimist_1.default)(process.argv.slice(2));
|
8
22
|
// we're being used from the command line
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
function handleExec() {
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
25
|
+
switch (args.exec) {
|
26
|
+
case 'install': {
|
27
|
+
debugCli('installing Cypress from NPM');
|
28
|
+
install_1.default.start({ force: args.force })
|
29
|
+
.catch(util_1.default.logErrorExit1);
|
30
|
+
break;
|
31
|
+
}
|
32
|
+
case 'verify': {
|
33
|
+
// for simple testing in the monorepo
|
34
|
+
debugCli('verifying Cypress');
|
35
|
+
verify_1.default.start({ force: true }) // always force verification
|
36
|
+
.catch(util_1.default.logErrorExit1);
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
default: {
|
40
|
+
break;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
});
|
27
44
|
}
|
45
|
+
// Execute the async function
|
46
|
+
if (args.exec) {
|
47
|
+
handleExec().catch(util_1.default.logErrorExit1);
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
debugCli('exporting Cypress module interface');
|
51
|
+
}
|
52
|
+
module.exports = cypress_1.default;
|
package/lib/VerboseRenderer.js
CHANGED
@@ -1,58 +1,61 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
// Vendored from @cypress/listr-verbose-renderer
|
4
|
-
const
|
5
|
-
const
|
6
|
-
const
|
7
|
-
const
|
7
|
+
const figures_1 = __importDefault(require("figures"));
|
8
|
+
const cli_cursor_1 = __importDefault(require("cli-cursor"));
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
10
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
8
11
|
const formattedLog = (options, output) => {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
console.log(`${chalk.dim(`[${timestamp}]`)} ${output}`);
|
12
|
+
const timestamp = (0, dayjs_1.default)().format(options.dateFormat);
|
13
|
+
// eslint-disable-next-line no-console
|
14
|
+
console.log(`${chalk_1.default.dim(`[${timestamp}]`)} ${output}`);
|
13
15
|
};
|
14
16
|
const renderHelper = (task, event, options) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
const log = formattedLog.bind(undefined, options);
|
18
|
+
if (event.type === 'STATE') {
|
19
|
+
const message = task.isPending() ? 'started' : task.state;
|
20
|
+
log(`${task.title} [${message}]`);
|
21
|
+
if (task.isSkipped() && task.output) {
|
22
|
+
log(`${figures_1.default.arrowRight} ${task.output}`);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
else if (event.type === 'TITLE') {
|
26
|
+
log(`${task.title} [title changed]`);
|
21
27
|
}
|
22
|
-
} else if (event.type === 'TITLE') {
|
23
|
-
log(`${task.title} [title changed]`);
|
24
|
-
}
|
25
28
|
};
|
26
29
|
const render = (tasks, options) => {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
for (const task of tasks) {
|
31
|
+
task.subscribe((event) => {
|
32
|
+
if (event.type === 'SUBTASKS') {
|
33
|
+
render(task.subtasks, options);
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
renderHelper(task, event, options);
|
37
|
+
}, (err) => {
|
38
|
+
// eslint-disable-next-line no-console
|
39
|
+
console.log(err);
|
40
|
+
});
|
41
|
+
}
|
39
42
|
};
|
40
43
|
class VerboseRenderer {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
44
|
+
constructor(tasks, options) {
|
45
|
+
this._tasks = tasks;
|
46
|
+
this._options = Object.assign({
|
47
|
+
dateFormat: 'HH:mm:ss',
|
48
|
+
}, options);
|
49
|
+
}
|
50
|
+
static get nonTTY() {
|
51
|
+
return true;
|
52
|
+
}
|
53
|
+
render() {
|
54
|
+
cli_cursor_1.default.hide();
|
55
|
+
render(this._tasks, this._options);
|
56
|
+
}
|
57
|
+
end() {
|
58
|
+
cli_cursor_1.default.show();
|
59
|
+
}
|
57
60
|
}
|
58
|
-
|
61
|
+
exports.default = VerboseRenderer;
|