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 CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('../lib/cli').init()
3
+ const CLI = require('../lib/cli').default
4
+
5
+ CLI.init()
package/index.js CHANGED
@@ -1,27 +1,52 @@
1
1
  "use strict";
2
-
3
- const minimist = require('minimist');
4
- const debug = require('debug')('cypress:cli');
5
- const args = minimist(process.argv.slice(2));
6
- const util = require('./lib/util');
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
- switch (args.exec) {
10
- case 'install':
11
- debug('installing Cypress from NPM');
12
- require('./lib/tasks/install').start({
13
- force: args.force
14
- }).catch(util.logErrorExit1);
15
- break;
16
- case 'verify':
17
- // for simple testing in the monorepo
18
- debug('verifying Cypress');
19
- require('./lib/tasks/verify').start({
20
- force: true
21
- }) // always force verification
22
- .catch(util.logErrorExit1);
23
- break;
24
- default:
25
- debug('exporting Cypress module interface');
26
- module.exports = require('./lib/cypress');
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;
@@ -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 figures = require('figures');
5
- const cliCursor = require('cli-cursor');
6
- const chalk = require('chalk');
7
- const dayjs = require('dayjs');
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
- const timestamp = dayjs().format(options.dateFormat);
10
-
11
- // eslint-disable-next-line no-console
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
- const log = formattedLog.bind(undefined, options);
16
- if (event.type === 'STATE') {
17
- const message = task.isPending() ? 'started' : task.state;
18
- log(`${task.title} [${message}]`);
19
- if (task.isSkipped() && task.output) {
20
- log(`${figures.arrowRight} ${task.output}`);
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
- for (const task of tasks) {
28
- task.subscribe(event => {
29
- if (event.type === 'SUBTASKS') {
30
- render(task.subtasks, options);
31
- return;
32
- }
33
- renderHelper(task, event, options);
34
- }, err => {
35
- // eslint-disable-next-line no-console
36
- console.log(err);
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
- constructor(tasks, options) {
42
- this._tasks = tasks;
43
- this._options = Object.assign({
44
- dateFormat: 'HH:mm:ss'
45
- }, options);
46
- }
47
- static get nonTTY() {
48
- return true;
49
- }
50
- render() {
51
- cliCursor.hide();
52
- render(this._tasks, this._options);
53
- }
54
- end() {
55
- cliCursor.show();
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
- module.exports = VerboseRenderer;
61
+ exports.default = VerboseRenderer;