cypress 15.2.0 → 15.3.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 +1 -1
- package/{lib → dist}/cli.js +219 -190
- package/{lib → dist}/cypress.js +29 -26
- package/{lib → dist}/errors.js +38 -26
- package/{lib → dist}/exec/open.js +14 -5
- package/{lib → dist}/exec/run.js +37 -26
- package/dist/exec/spawn.js +301 -0
- package/dist/exec/versions.js +67 -0
- package/{lib → dist}/exec/xvfb.js +47 -20
- package/{index.js → dist/index.js} +5 -5
- package/dist/index.mjs +9 -0
- package/{lib → dist}/tasks/cache.js +49 -52
- package/{lib → dist}/tasks/download.js +55 -64
- package/{lib → dist}/tasks/get-folder-size.js +4 -4
- package/{lib → dist}/tasks/install.js +41 -45
- package/{lib → dist}/tasks/state.js +55 -45
- package/dist/tasks/unzip.js +192 -0
- package/{lib → dist}/tasks/verify.js +121 -131
- package/{lib → dist}/util.js +38 -36
- package/package.json +10 -13
- package/types/cypress-automation.d.ts +2 -1
- package/types/cypress.d.ts +1 -0
- package/index.mjs +0 -17
- package/lib/exec/spawn.js +0 -285
- package/lib/exec/versions.js +0 -61
- package/lib/fs.js +0 -8
- package/lib/tasks/unzip.js +0 -198
- /package/{lib → dist}/VerboseRenderer.js +0 -0
- /package/{lib → dist}/exec/info.js +0 -0
- /package/{lib → dist}/exec/shared.js +0 -0
- /package/{lib → dist}/logger.js +0 -0
package/bin/cypress
CHANGED
package/{lib → dist}/cli.js
RENAMED
@@ -1,4 +1,13 @@
|
|
1
1
|
"use strict";
|
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
|
+
};
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
13
|
};
|
@@ -15,7 +24,7 @@ const errors_1 = require("./errors");
|
|
15
24
|
const cache_1 = __importDefault(require("./tasks/cache"));
|
16
25
|
const open_1 = __importDefault(require("./exec/open"));
|
17
26
|
const run_1 = __importDefault(require("./exec/run"));
|
18
|
-
const verify_1 =
|
27
|
+
const verify_1 = require("./tasks/verify");
|
19
28
|
const install_1 = __importDefault(require("./tasks/install"));
|
20
29
|
const versions_1 = __importDefault(require("./exec/versions"));
|
21
30
|
const info_1 = __importDefault(require("./exec/info"));
|
@@ -29,7 +38,7 @@ function unknownOption(flag, type = 'option') {
|
|
29
38
|
logger_1.default.error(` error: unknown ${type}:`, flag);
|
30
39
|
logger_1.default.error();
|
31
40
|
this.outputHelp();
|
32
|
-
|
41
|
+
process.exit(1);
|
33
42
|
}
|
34
43
|
commander_1.default.Command.prototype.unknownOption = unknownOption;
|
35
44
|
const coerceFalse = (arg) => {
|
@@ -150,50 +159,53 @@ function includesVersion(args) {
|
|
150
159
|
lodash_1.default.includes(args, '-v'));
|
151
160
|
}
|
152
161
|
function showVersions(opts) {
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
const reportComponentVersion = (componentName, versions) => {
|
163
|
-
const names = {
|
164
|
-
package: 'package',
|
165
|
-
binary: 'binary',
|
166
|
-
electron: 'electronVersion',
|
167
|
-
node: 'electronNodeVersion',
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
163
|
+
debug('printing Cypress version');
|
164
|
+
debug('additional arguments %o', opts);
|
165
|
+
debug('parsed version arguments %o', opts);
|
166
|
+
const reportAllVersions = (versions) => {
|
167
|
+
logger_1.default.always('Cypress package version:', versions.package);
|
168
|
+
logger_1.default.always('Cypress binary version:', versions.binary);
|
169
|
+
logger_1.default.always('Electron version:', versions.electronVersion);
|
170
|
+
logger_1.default.always('Bundled Node version:', versions.electronNodeVersion);
|
168
171
|
};
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
172
|
+
const reportComponentVersion = (componentName, versions) => {
|
173
|
+
const names = {
|
174
|
+
package: 'package',
|
175
|
+
binary: 'binary',
|
176
|
+
electron: 'electronVersion',
|
177
|
+
node: 'electronNodeVersion',
|
178
|
+
};
|
179
|
+
if (!names[componentName]) {
|
180
|
+
throw new Error(`Unknown component name "${componentName}"`);
|
181
|
+
}
|
182
|
+
const name = names[componentName];
|
183
|
+
if (!versions[name]) {
|
184
|
+
throw new Error(`Cannot find version for component "${componentName}" under property "${name}"`);
|
185
|
+
}
|
186
|
+
const version = versions[name];
|
187
|
+
logger_1.default.always(version);
|
188
|
+
};
|
189
|
+
const defaultVersions = {
|
190
|
+
package: undefined,
|
191
|
+
binary: undefined,
|
192
|
+
electronVersion: undefined,
|
193
|
+
electronNodeVersion: undefined,
|
194
|
+
};
|
195
|
+
try {
|
196
|
+
const versions = (yield versions_1.default.getVersions()) || defaultVersions;
|
197
|
+
if (opts === null || opts === void 0 ? void 0 : opts.component) {
|
198
|
+
reportComponentVersion(opts.component, versions);
|
199
|
+
}
|
200
|
+
else {
|
201
|
+
reportAllVersions(versions);
|
202
|
+
}
|
203
|
+
process.exit(0);
|
190
204
|
}
|
191
|
-
|
192
|
-
|
205
|
+
catch (e) {
|
206
|
+
util_1.default.logErrorExit1(e);
|
193
207
|
}
|
194
|
-
|
195
|
-
})
|
196
|
-
.catch(util_1.default.logErrorExit1);
|
208
|
+
});
|
197
209
|
}
|
198
210
|
const createProgram = () => {
|
199
211
|
const program = new commander_1.default.Command();
|
@@ -345,171 +357,188 @@ const cliModule = {
|
|
345
357
|
* Parses the command line and kicks off Cypress process.
|
346
358
|
*/
|
347
359
|
init(args) {
|
348
|
-
|
349
|
-
args
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
360
|
+
return __awaiter(this, void 0, void 0, function* () {
|
361
|
+
if (!args) {
|
362
|
+
args = process.argv;
|
363
|
+
}
|
364
|
+
const { CYPRESS_INTERNAL_ENV, CYPRESS_DOWNLOAD_USE_CA } = process.env;
|
365
|
+
if (process.env.CYPRESS_DOWNLOAD_USE_CA) {
|
366
|
+
let msg = `
|
354
367
|
${log_symbols_1.default.warning} Warning: It looks like you're setting CYPRESS_DOWNLOAD_USE_CA=${CYPRESS_DOWNLOAD_USE_CA}
|
355
368
|
|
356
369
|
The environment variable "CYPRESS_DOWNLOAD_USE_CA" is no longer required to be set.
|
357
370
|
|
358
371
|
You can safely unset this environment variable.
|
359
372
|
`;
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
373
|
+
logger_1.default.log();
|
374
|
+
logger_1.default.warn((0, common_tags_1.stripIndent)(msg));
|
375
|
+
logger_1.default.log();
|
376
|
+
}
|
377
|
+
if (!util_1.default.isValidCypressInternalEnvValue(CYPRESS_INTERNAL_ENV)) {
|
378
|
+
debug('invalid CYPRESS_INTERNAL_ENV value', CYPRESS_INTERNAL_ENV);
|
379
|
+
return (0, errors_1.exitWithError)(errors_1.errors.invalidCypressEnv)(`CYPRESS_INTERNAL_ENV=${CYPRESS_INTERNAL_ENV}`);
|
380
|
+
}
|
381
|
+
if (util_1.default.isNonProductionCypressInternalEnvValue(CYPRESS_INTERNAL_ENV)) {
|
382
|
+
debug('non-production CYPRESS_INTERNAL_ENV value', CYPRESS_INTERNAL_ENV);
|
383
|
+
let msg = `
|
371
384
|
${log_symbols_1.default.warning} Warning: It looks like you're passing CYPRESS_INTERNAL_ENV=${CYPRESS_INTERNAL_ENV}
|
372
385
|
|
373
386
|
The environment variable "CYPRESS_INTERNAL_ENV" is reserved and should only be used internally.
|
374
387
|
|
375
388
|
Unset the "CYPRESS_INTERNAL_ENV" environment variable and run Cypress again.
|
376
389
|
`;
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
}
|
381
|
-
const program = createProgram();
|
382
|
-
program
|
383
|
-
.command('help')
|
384
|
-
.description('Shows CLI help and exits')
|
385
|
-
.action(() => {
|
386
|
-
program.help();
|
387
|
-
});
|
388
|
-
const handleVersion = (cmd) => {
|
389
|
-
return cmd
|
390
|
-
.option('--component <package|binary|electron|node>', 'component to report version for')
|
391
|
-
.action((opts, ...other) => {
|
392
|
-
showVersions(util_1.default.parseOpts(opts));
|
393
|
-
});
|
394
|
-
};
|
395
|
-
handleVersion(program
|
396
|
-
.storeOptionsAsProperties()
|
397
|
-
.option('-v, --version', text('version'))
|
398
|
-
.command('version')
|
399
|
-
.description(text('version')));
|
400
|
-
maybeAddInspectFlags(addCypressOpenCommand(program))
|
401
|
-
.action((opts) => {
|
402
|
-
debug('opening Cypress');
|
403
|
-
open_1.default.start(util_1.default.parseOpts(opts))
|
404
|
-
.then(util_1.default.exit)
|
405
|
-
.catch(util_1.default.logErrorExit1);
|
406
|
-
});
|
407
|
-
maybeAddInspectFlags(addCypressRunCommand(program))
|
408
|
-
.action((...fnArgs) => {
|
409
|
-
debug('running Cypress with args %o', fnArgs);
|
410
|
-
run_1.default.start(parseVariableOpts(fnArgs, args))
|
411
|
-
.then(util_1.default.exit)
|
412
|
-
.catch(util_1.default.logErrorExit1);
|
413
|
-
});
|
414
|
-
program
|
415
|
-
.command('install')
|
416
|
-
.usage('[options]')
|
417
|
-
.description('Installs the Cypress executable matching this package\'s version')
|
418
|
-
.option('-f, --force', text('forceInstall'))
|
419
|
-
.action((opts) => {
|
420
|
-
install_1.default
|
421
|
-
.start(util_1.default.parseOpts(opts))
|
422
|
-
.catch(util_1.default.logErrorExit1);
|
423
|
-
});
|
424
|
-
program
|
425
|
-
.command('verify')
|
426
|
-
.usage('[options]')
|
427
|
-
.description('Verifies that Cypress is installed correctly and executable')
|
428
|
-
.option('--dev', text('dev'), coerceFalse)
|
429
|
-
.action((opts) => {
|
430
|
-
const defaultOpts = { force: true, welcomeMessage: false };
|
431
|
-
const parsedOpts = util_1.default.parseOpts(opts);
|
432
|
-
const options = lodash_1.default.extend(parsedOpts, defaultOpts);
|
433
|
-
verify_1.default
|
434
|
-
.start(options)
|
435
|
-
.catch(util_1.default.logErrorExit1);
|
436
|
-
});
|
437
|
-
program
|
438
|
-
.command('cache')
|
439
|
-
.usage('[command]')
|
440
|
-
.description('Manages the Cypress binary cache')
|
441
|
-
.option('list', text('cacheList'))
|
442
|
-
.option('path', text('cachePath'))
|
443
|
-
.option('clear', text('cacheClear'))
|
444
|
-
.option('prune', text('cachePrune'))
|
445
|
-
.option('--size', text('cacheSize'))
|
446
|
-
.action(function (opts, args) {
|
447
|
-
if (!args || !args.length) {
|
448
|
-
this.outputHelp();
|
449
|
-
util_1.default.exit(1);
|
390
|
+
logger_1.default.log();
|
391
|
+
logger_1.default.warn((0, common_tags_1.stripIndent)(msg));
|
392
|
+
logger_1.default.log();
|
450
393
|
}
|
451
|
-
const
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
394
|
+
const program = createProgram();
|
395
|
+
program
|
396
|
+
.command('help')
|
397
|
+
.description('Shows CLI help and exits')
|
398
|
+
.action(() => {
|
399
|
+
program.help();
|
400
|
+
});
|
401
|
+
const handleVersion = (cmd) => {
|
402
|
+
return cmd
|
403
|
+
.option('--component <package|binary|electron|node>', 'component to report version for')
|
404
|
+
.action((opts, ...other) => {
|
405
|
+
showVersions(util_1.default.parseOpts(opts));
|
459
406
|
});
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
407
|
+
};
|
408
|
+
handleVersion(program
|
409
|
+
.storeOptionsAsProperties()
|
410
|
+
.option('-v, --version', text('version'))
|
411
|
+
.command('version')
|
412
|
+
.description(text('version')));
|
413
|
+
maybeAddInspectFlags(addCypressOpenCommand(program))
|
414
|
+
.action((opts) => __awaiter(this, void 0, void 0, function* () {
|
415
|
+
debug('opening Cypress');
|
416
|
+
try {
|
417
|
+
const code = yield open_1.default.start(util_1.default.parseOpts(opts));
|
418
|
+
process.exit(code);
|
419
|
+
}
|
420
|
+
catch (e) {
|
421
|
+
util_1.default.logErrorExit1(e);
|
422
|
+
}
|
423
|
+
}));
|
424
|
+
maybeAddInspectFlags(addCypressRunCommand(program))
|
425
|
+
.action((...fnArgs) => __awaiter(this, void 0, void 0, function* () {
|
426
|
+
debug('running Cypress with args %o', fnArgs);
|
427
|
+
try {
|
428
|
+
const code = yield run_1.default.start(parseVariableOpts(fnArgs, args));
|
429
|
+
process.exit(code);
|
430
|
+
}
|
431
|
+
catch (e) {
|
432
|
+
util_1.default.logErrorExit1(e);
|
433
|
+
}
|
434
|
+
}));
|
435
|
+
program
|
436
|
+
.command('install')
|
437
|
+
.usage('[options]')
|
438
|
+
.description('Installs the Cypress executable matching this package\'s version')
|
439
|
+
.option('-f, --force', text('forceInstall'))
|
440
|
+
.action((opts) => __awaiter(this, void 0, void 0, function* () {
|
441
|
+
try {
|
442
|
+
yield install_1.default.start(util_1.default.parseOpts(opts));
|
443
|
+
}
|
444
|
+
catch (e) {
|
467
445
|
util_1.default.logErrorExit1(e);
|
446
|
+
}
|
447
|
+
}));
|
448
|
+
program
|
449
|
+
.command('verify')
|
450
|
+
.usage('[options]')
|
451
|
+
.description('Verifies that Cypress is installed correctly and executable')
|
452
|
+
.option('--dev', text('dev'), coerceFalse)
|
453
|
+
.action((opts) => __awaiter(this, void 0, void 0, function* () {
|
454
|
+
const defaultOpts = { force: true, welcomeMessage: false };
|
455
|
+
const parsedOpts = util_1.default.parseOpts(opts);
|
456
|
+
const options = lodash_1.default.extend(parsedOpts, defaultOpts);
|
457
|
+
try {
|
458
|
+
yield (0, verify_1.start)(options);
|
459
|
+
}
|
460
|
+
catch (e) {
|
461
|
+
util_1.default.logErrorExit1(e);
|
462
|
+
}
|
463
|
+
}));
|
464
|
+
program
|
465
|
+
.command('cache')
|
466
|
+
.usage('[command]')
|
467
|
+
.description('Manages the Cypress binary cache')
|
468
|
+
.option('list', text('cacheList'))
|
469
|
+
.option('path', text('cachePath'))
|
470
|
+
.option('clear', text('cacheClear'))
|
471
|
+
.option('prune', text('cachePrune'))
|
472
|
+
.option('--size', text('cacheSize'))
|
473
|
+
.action(function (opts, args) {
|
474
|
+
return __awaiter(this, void 0, void 0, function* () {
|
475
|
+
if (!args || !args.length) {
|
476
|
+
this.outputHelp();
|
477
|
+
process.exit(1);
|
478
|
+
}
|
479
|
+
const [command] = args;
|
480
|
+
if (!lodash_1.default.includes(['list', 'path', 'clear', 'prune'], command)) {
|
481
|
+
unknownOption.call(this, `cache ${command}`, 'command');
|
482
|
+
}
|
483
|
+
if (command === 'list') {
|
484
|
+
debug('cache command %o', {
|
485
|
+
command,
|
486
|
+
size: opts.size,
|
487
|
+
});
|
488
|
+
try {
|
489
|
+
const result = yield cache_1.default.list(opts.size);
|
490
|
+
return result;
|
491
|
+
}
|
492
|
+
catch (e) {
|
493
|
+
if (e.code === 'ENOENT') {
|
494
|
+
logger_1.default.always('No cached binary versions were found.');
|
495
|
+
process.exit(0);
|
496
|
+
}
|
497
|
+
util_1.default.logErrorExit1(e);
|
498
|
+
}
|
499
|
+
}
|
500
|
+
cache_1.default[command]();
|
468
501
|
});
|
502
|
+
});
|
503
|
+
program
|
504
|
+
.command('info')
|
505
|
+
.usage('[command]')
|
506
|
+
.description('Prints Cypress and system information')
|
507
|
+
.option('--dev', text('dev'), coerceFalse)
|
508
|
+
.action((opts) => __awaiter(this, void 0, void 0, function* () {
|
509
|
+
try {
|
510
|
+
const code = yield info_1.default.start(opts);
|
511
|
+
process.exit(code);
|
512
|
+
}
|
513
|
+
catch (e) {
|
514
|
+
util_1.default.logErrorExit1(e);
|
515
|
+
}
|
516
|
+
}));
|
517
|
+
debug('cli starts with arguments %j', args);
|
518
|
+
util_1.default.printNodeOptions();
|
519
|
+
// if there are no arguments
|
520
|
+
if (args.length <= 2) {
|
521
|
+
debug('printing help');
|
522
|
+
program.help();
|
523
|
+
// exits
|
469
524
|
}
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
.
|
481
|
-
|
525
|
+
const firstCommand = args[2];
|
526
|
+
if (!lodash_1.default.includes(knownCommands, firstCommand)) {
|
527
|
+
debug('unknown command %s', firstCommand);
|
528
|
+
logger_1.default.error('Unknown command', `"${firstCommand}"`);
|
529
|
+
program.outputHelp();
|
530
|
+
return process.exit(1);
|
531
|
+
}
|
532
|
+
if (includesVersion(args)) {
|
533
|
+
// commander 2.11.0 changes behavior
|
534
|
+
// and now does not understand top level options
|
535
|
+
// .option('-v, --version').command('version')
|
536
|
+
// so we have to manually catch '-v, --version'
|
537
|
+
handleVersion(program);
|
538
|
+
}
|
539
|
+
debug('program parsing arguments');
|
540
|
+
return program.parse(args);
|
482
541
|
});
|
483
|
-
debug('cli starts with arguments %j', args);
|
484
|
-
util_1.default.printNodeOptions();
|
485
|
-
// if there are no arguments
|
486
|
-
if (args.length <= 2) {
|
487
|
-
debug('printing help');
|
488
|
-
program.help();
|
489
|
-
// exits
|
490
|
-
}
|
491
|
-
const firstCommand = args[2];
|
492
|
-
if (!lodash_1.default.includes(knownCommands, firstCommand)) {
|
493
|
-
debug('unknown command %s', firstCommand);
|
494
|
-
logger_1.default.error('Unknown command', `"${firstCommand}"`);
|
495
|
-
program.outputHelp();
|
496
|
-
return util_1.default.exit(1);
|
497
|
-
}
|
498
|
-
if (includesVersion(args)) {
|
499
|
-
// commander 2.11.0 changes behavior
|
500
|
-
// and now does not understand top level options
|
501
|
-
// .option('-v, --version').command('version')
|
502
|
-
// so we have to manually catch '-v, --version'
|
503
|
-
handleVersion(program);
|
504
|
-
}
|
505
|
-
debug('program parsing arguments');
|
506
|
-
return program.parse(args);
|
507
542
|
},
|
508
543
|
};
|
509
544
|
exports.default = cliModule;
|
510
|
-
// @ts-ignore
|
511
|
-
if (!module.parent) {
|
512
|
-
logger_1.default.error('This CLI module should be required from another Node module');
|
513
|
-
logger_1.default.error('and not executed directly');
|
514
|
-
process.exit(-1);
|
515
|
-
}
|
package/{lib → dist}/cypress.js
RENAMED
@@ -1,16 +1,23 @@
|
|
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
|
+
};
|
3
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
4
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
5
13
|
};
|
6
|
-
|
14
|
+
// https://github.com/cypress-io/cypress/issues/316
|
7
15
|
const tmp_1 = __importDefault(require("tmp"));
|
8
|
-
const
|
16
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
9
17
|
const open_1 = __importDefault(require("./exec/open"));
|
10
18
|
const run_1 = __importDefault(require("./exec/run"));
|
11
19
|
const util_1 = __importDefault(require("./util"));
|
12
20
|
const cli_1 = __importDefault(require("./cli"));
|
13
|
-
const tmp = bluebird_1.default.promisifyAll(tmp_1.default);
|
14
21
|
const cypressModuleApi = {
|
15
22
|
/**
|
16
23
|
* Opens Cypress GUI
|
@@ -24,29 +31,25 @@ const cypressModuleApi = {
|
|
24
31
|
* Runs Cypress tests in the current project
|
25
32
|
* @see https://on.cypress.io/module-api#cypress-run
|
26
33
|
*/
|
27
|
-
run(
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
.
|
34
|
+
run() {
|
35
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
36
|
+
if (!run_1.default.isValidProject(options.project)) {
|
37
|
+
throw new Error(`Invalid project path parameter: ${options.project}`);
|
38
|
+
}
|
39
|
+
options = util_1.default.normalizeModuleOptions(options);
|
40
|
+
tmp_1.default.setGracefulCleanup();
|
41
|
+
const outputPath = tmp_1.default.fileSync().name;
|
35
42
|
options.outputPath = outputPath;
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
return output;
|
48
|
-
});
|
49
|
-
});
|
43
|
+
const failedTests = yield run_1.default.start(options);
|
44
|
+
const output = yield fs_extra_1.default.readJson(outputPath, { throws: false });
|
45
|
+
if (!output) {
|
46
|
+
return {
|
47
|
+
status: 'failed',
|
48
|
+
failures: failedTests,
|
49
|
+
message: 'Could not find Cypress test run results',
|
50
|
+
};
|
51
|
+
}
|
52
|
+
return output;
|
50
53
|
});
|
51
54
|
},
|
52
55
|
cli: {
|