cypress 15.2.0 → 15.4.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 +221 -190
- package/{lib → dist}/cypress.js +29 -26
- package/{lib → dist}/errors.js +38 -26
- package/{lib → dist}/exec/info.js +2 -2
- package/{lib → dist}/exec/open.js +16 -7
- package/{lib → dist}/exec/run.js +41 -27
- package/dist/exec/spawn.js +311 -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 +39 -39
- package/package.json +13 -13
- package/types/cypress-automation.d.ts +2 -1
- package/types/cypress-npm-api.d.ts +4 -0
- package/types/cypress.d.ts +42 -29
- 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/shared.js +0 -0
- /package/{lib → dist}/logger.js +0 -0
package/types/cypress.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2
1
|
/// <reference path="./cypress-npm-api.d.ts" />
|
3
2
|
/// <reference path="./cypress-eventemitter.d.ts" />
|
4
3
|
/// <reference path="./cypress-type-helpers.d.ts" />
|
@@ -59,6 +58,9 @@ declare namespace Cypress {
|
|
59
58
|
interface ObjectLike {
|
60
59
|
[key: string]: any
|
61
60
|
}
|
61
|
+
interface PromptOptions {
|
62
|
+
placeholders?: Record<string, string>
|
63
|
+
}
|
62
64
|
interface Auth {
|
63
65
|
username: string
|
64
66
|
password: string
|
@@ -684,21 +686,22 @@ declare namespace Cypress {
|
|
684
686
|
Keyboard: {
|
685
687
|
defaults(options: Partial<KeyboardDefaultsOptions>): void
|
686
688
|
Keys: {
|
687
|
-
DOWN: 'ArrowDown'
|
688
|
-
LEFT: 'ArrowLeft'
|
689
|
-
RIGHT: 'ArrowRight'
|
690
|
-
UP: 'ArrowUp'
|
691
|
-
END: 'End'
|
692
|
-
HOME: 'Home'
|
693
|
-
PAGEDOWN: 'PageDown'
|
694
|
-
PAGEUP: 'PageUp'
|
695
|
-
ENTER: 'Enter'
|
696
|
-
TAB: 'Tab'
|
697
|
-
BACKSPACE: 'Backspace'
|
698
|
-
SPACE: 'Space'
|
699
|
-
DELETE: 'Delete'
|
700
|
-
INSERT: 'Insert'
|
701
|
-
|
689
|
+
DOWN: 'ArrowDown'
|
690
|
+
LEFT: 'ArrowLeft'
|
691
|
+
RIGHT: 'ArrowRight'
|
692
|
+
UP: 'ArrowUp'
|
693
|
+
END: 'End'
|
694
|
+
HOME: 'Home'
|
695
|
+
PAGEDOWN: 'PageDown'
|
696
|
+
PAGEUP: 'PageUp'
|
697
|
+
ENTER: 'Enter'
|
698
|
+
TAB: 'Tab'
|
699
|
+
BACKSPACE: 'Backspace'
|
700
|
+
SPACE: 'Space'
|
701
|
+
DELETE: 'Delete'
|
702
|
+
INSERT: 'Insert'
|
703
|
+
ESC: 'Escape'
|
704
|
+
}
|
702
705
|
}
|
703
706
|
|
704
707
|
/**
|
@@ -754,7 +757,7 @@ declare namespace Cypress {
|
|
754
757
|
* Trigger action
|
755
758
|
* @private
|
756
759
|
*/
|
757
|
-
action: <T = (any[] | void)
|
760
|
+
action: <T = (any[] | void)>(action: string, ...args: any[]) => T
|
758
761
|
|
759
762
|
/**
|
760
763
|
* Load files
|
@@ -1690,7 +1693,7 @@ declare namespace Cypress {
|
|
1690
1693
|
* cy.get('h1').should('equal', 'Example Domain')
|
1691
1694
|
* })
|
1692
1695
|
*/
|
1693
|
-
origin<T
|
1696
|
+
origin<T>(urlOrDomain: string, fn: () => void): Chainable<T>
|
1694
1697
|
|
1695
1698
|
/**
|
1696
1699
|
* Enables running Cypress commands in a secondary origin.
|
@@ -1701,7 +1704,7 @@ declare namespace Cypress {
|
|
1701
1704
|
* expect(foo).to.equal('foo')
|
1702
1705
|
* })
|
1703
1706
|
*/
|
1704
|
-
origin<T, S
|
1707
|
+
origin<T, S>(urlOrDomain: string, options: {
|
1705
1708
|
args: T
|
1706
1709
|
}, fn: (args: T) => void): Chainable<S>
|
1707
1710
|
|
@@ -1848,7 +1851,12 @@ declare namespace Cypress {
|
|
1848
1851
|
* @see https://on.cypress.io/prevuntil
|
1849
1852
|
*/
|
1850
1853
|
prevUntil<E extends Node = HTMLElement>(element: E | JQuery<E>, filter?: string, options?: Partial<Loggable & Timeoutable>): Chainable<JQuery<E>>
|
1851
|
-
|
1854
|
+
/**
|
1855
|
+
* An AI-powered command that generates Cypress commands from natural language test steps.
|
1856
|
+
*
|
1857
|
+
* @see https://on.cypress.io/prompt
|
1858
|
+
*/
|
1859
|
+
prompt<T>(steps: string[], options?: PromptOptions): Chainable<T>
|
1852
1860
|
/**
|
1853
1861
|
* Read a file and yield its contents.
|
1854
1862
|
*
|
@@ -2897,8 +2905,8 @@ declare namespace Cypress {
|
|
2897
2905
|
}
|
2898
2906
|
|
2899
2907
|
type RetryStrategyWithModeSpecs = RetryStrategy & {
|
2900
|
-
openMode: boolean
|
2901
|
-
runMode: boolean
|
2908
|
+
openMode: boolean // defaults to false
|
2909
|
+
runMode: boolean // defaults to true
|
2902
2910
|
}
|
2903
2911
|
|
2904
2912
|
type RetryStrategy =
|
@@ -2906,18 +2914,18 @@ declare namespace Cypress {
|
|
2906
2914
|
| RetryStrategyDetectFlakeButAlwaysFailType
|
2907
2915
|
|
2908
2916
|
interface RetryStrategyDetectFlakeAndPassOnThresholdType {
|
2909
|
-
experimentalStrategy:
|
2917
|
+
experimentalStrategy: 'detect-flake-and-pass-on-threshold'
|
2910
2918
|
experimentalOptions?: {
|
2911
|
-
maxRetries: number
|
2912
|
-
passesRequired: number
|
2919
|
+
maxRetries: number // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0
|
2920
|
+
passesRequired: number // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0 and <= maxRetries
|
2913
2921
|
}
|
2914
2922
|
}
|
2915
2923
|
|
2916
2924
|
interface RetryStrategyDetectFlakeButAlwaysFailType {
|
2917
|
-
experimentalStrategy:
|
2925
|
+
experimentalStrategy: 'detect-flake-but-always-fail'
|
2918
2926
|
experimentalOptions?: {
|
2919
|
-
maxRetries: number
|
2920
|
-
stopIfAnyPassed: boolean
|
2927
|
+
maxRetries: number // defaults to 2 if experimentalOptions is not provided, must be a whole number > 0
|
2928
|
+
stopIfAnyPassed: boolean // defaults to false if experimentalOptions is not provided
|
2921
2929
|
}
|
2922
2930
|
}
|
2923
2931
|
interface ResolvedConfigOptions<ComponentDevServerOpts = any> {
|
@@ -3139,7 +3147,7 @@ declare namespace Cypress {
|
|
3139
3147
|
* @see https://on.cypress.io/experiments#Experimental-CSP-Allow-List
|
3140
3148
|
* @default false
|
3141
3149
|
*/
|
3142
|
-
experimentalCspAllowList: boolean | experimentalCspAllowedDirectives[]
|
3150
|
+
experimentalCspAllowList: boolean | experimentalCspAllowedDirectives[]
|
3143
3151
|
/**
|
3144
3152
|
* Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode.
|
3145
3153
|
* @default false
|
@@ -3271,6 +3279,11 @@ declare namespace Cypress {
|
|
3271
3279
|
* @default false
|
3272
3280
|
*/
|
3273
3281
|
experimentalOriginDependencies?: boolean
|
3282
|
+
/**
|
3283
|
+
* Enables support for `cy.prompt`, an AI-powered command that turns natural language steps into executable Cypress test code.
|
3284
|
+
* @default false
|
3285
|
+
*/
|
3286
|
+
experimentalPromptCommand?: boolean
|
3274
3287
|
}
|
3275
3288
|
|
3276
3289
|
/**
|
package/index.mjs
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import module from 'module'
|
2
|
-
|
3
|
-
const require = module.createRequire(import.meta.url)
|
4
|
-
|
5
|
-
const cypress = require('./lib/cypress')
|
6
|
-
|
7
|
-
export default cypress
|
8
|
-
|
9
|
-
export const defineConfig = cypress.defineConfig
|
10
|
-
|
11
|
-
export const defineComponentFramework = cypress.defineComponentFramework
|
12
|
-
|
13
|
-
export const run = cypress.run
|
14
|
-
|
15
|
-
export const open = cypress.open
|
16
|
-
|
17
|
-
export const cli = cypress.cli
|
package/lib/exec/spawn.js
DELETED
@@ -1,285 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
19
|
-
var ownKeys = function(o) {
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
21
|
-
var ar = [];
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
23
|
-
return ar;
|
24
|
-
};
|
25
|
-
return ownKeys(o);
|
26
|
-
};
|
27
|
-
return function (mod) {
|
28
|
-
if (mod && mod.__esModule) return mod;
|
29
|
-
var result = {};
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
31
|
-
__setModuleDefault(result, mod);
|
32
|
-
return result;
|
33
|
-
};
|
34
|
-
})();
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
42
|
-
});
|
43
|
-
};
|
44
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
45
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
46
|
-
};
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
48
|
-
const lodash_1 = __importDefault(require("lodash"));
|
49
|
-
const os_1 = __importDefault(require("os"));
|
50
|
-
const child_process_1 = __importDefault(require("child_process"));
|
51
|
-
const path_1 = __importDefault(require("path"));
|
52
|
-
const bluebird_1 = __importDefault(require("bluebird"));
|
53
|
-
const debug_1 = __importDefault(require("debug"));
|
54
|
-
const util_1 = __importDefault(require("../util"));
|
55
|
-
const state_1 = __importDefault(require("../tasks/state"));
|
56
|
-
const xvfb_1 = __importDefault(require("./xvfb"));
|
57
|
-
const verify_1 = __importDefault(require("../tasks/verify"));
|
58
|
-
const errors_1 = require("../errors");
|
59
|
-
const readline_1 = __importDefault(require("readline"));
|
60
|
-
const debug = (0, debug_1.default)('cypress:cli');
|
61
|
-
function isPlatform(platform) {
|
62
|
-
return os_1.default.platform() === platform;
|
63
|
-
}
|
64
|
-
function needsStderrPiped(needsXvfb) {
|
65
|
-
return lodash_1.default.some([
|
66
|
-
isPlatform('darwin'),
|
67
|
-
(needsXvfb && isPlatform('linux')),
|
68
|
-
util_1.default.isPossibleLinuxWithIncorrectDisplay(),
|
69
|
-
]);
|
70
|
-
}
|
71
|
-
function needsEverythingPipedDirectly() {
|
72
|
-
return isPlatform('win32');
|
73
|
-
}
|
74
|
-
function getStdio(needsXvfb) {
|
75
|
-
if (needsEverythingPipedDirectly()) {
|
76
|
-
return 'pipe';
|
77
|
-
}
|
78
|
-
// https://github.com/cypress-io/cypress/issues/921
|
79
|
-
// https://github.com/cypress-io/cypress/issues/1143
|
80
|
-
// https://github.com/cypress-io/cypress/issues/1745
|
81
|
-
if (needsStderrPiped(needsXvfb)) {
|
82
|
-
// returning pipe here so we can massage stderr
|
83
|
-
// and remove garbage from Xlib and libuv
|
84
|
-
// due to starting the Xvfb process on linux
|
85
|
-
return ['inherit', 'inherit', 'pipe'];
|
86
|
-
}
|
87
|
-
return 'inherit';
|
88
|
-
}
|
89
|
-
const spawnModule = {
|
90
|
-
start(args, options = {}) {
|
91
|
-
const needsXvfb = xvfb_1.default.isNeeded();
|
92
|
-
let executable = state_1.default.getPathToExecutable(state_1.default.getBinaryDir());
|
93
|
-
if (util_1.default.getEnv('CYPRESS_RUN_BINARY')) {
|
94
|
-
executable = path_1.default.resolve(util_1.default.getEnv('CYPRESS_RUN_BINARY'));
|
95
|
-
}
|
96
|
-
debug('needs to start own Xvfb?', needsXvfb);
|
97
|
-
// Always push cwd into the args
|
98
|
-
// which additionally acts as a signal to the
|
99
|
-
// binary that it was invoked through the NPM module
|
100
|
-
args = args || [];
|
101
|
-
if (typeof args === 'string') {
|
102
|
-
args = [args];
|
103
|
-
}
|
104
|
-
args = [...args, '--cwd', process.cwd(), '--userNodePath', process.execPath, '--userNodeVersion', process.versions.node];
|
105
|
-
lodash_1.default.defaults(options, {
|
106
|
-
dev: false,
|
107
|
-
env: process.env,
|
108
|
-
detached: false,
|
109
|
-
stdio: getStdio(needsXvfb),
|
110
|
-
});
|
111
|
-
const spawn = (overrides = {}) => {
|
112
|
-
return new bluebird_1.default((resolve, reject) => {
|
113
|
-
lodash_1.default.defaults(overrides, {
|
114
|
-
onStderrData: false,
|
115
|
-
});
|
116
|
-
const { onStderrData } = overrides;
|
117
|
-
const envOverrides = util_1.default.getEnvOverrides(options);
|
118
|
-
const electronArgs = [];
|
119
|
-
const node11WindowsFix = isPlatform('win32');
|
120
|
-
let startScriptPath;
|
121
|
-
if (options.dev) {
|
122
|
-
executable = 'node';
|
123
|
-
// if we're in dev then reset
|
124
|
-
// the launch cmd to be 'npm run dev'
|
125
|
-
startScriptPath = path_1.default.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js');
|
126
|
-
debug('in dev mode the args became %o', args);
|
127
|
-
}
|
128
|
-
if (!options.dev && verify_1.default.needsSandbox()) {
|
129
|
-
electronArgs.push('--no-sandbox');
|
130
|
-
}
|
131
|
-
// strip dev out of child process options
|
132
|
-
/**
|
133
|
-
* @type {import('child_process').ForkOptions}
|
134
|
-
*/
|
135
|
-
let stdioOptions = lodash_1.default.pick(options, 'env', 'detached', 'stdio');
|
136
|
-
// figure out if we're going to be force enabling or disabling colors.
|
137
|
-
// also figure out whether we should force stdout and stderr into thinking
|
138
|
-
// it is a tty as opposed to a pipe.
|
139
|
-
stdioOptions.env = lodash_1.default.extend({}, stdioOptions.env, envOverrides);
|
140
|
-
if (node11WindowsFix) {
|
141
|
-
stdioOptions = lodash_1.default.extend({}, stdioOptions, { windowsHide: false });
|
142
|
-
}
|
143
|
-
if (util_1.default.isPossibleLinuxWithIncorrectDisplay()) {
|
144
|
-
// make sure we use the latest DISPLAY variable if any
|
145
|
-
debug('passing DISPLAY', process.env.DISPLAY);
|
146
|
-
stdioOptions.env.DISPLAY = process.env.DISPLAY;
|
147
|
-
}
|
148
|
-
if (stdioOptions.env.ELECTRON_RUN_AS_NODE) {
|
149
|
-
// Since we are running electron as node, we need to add an entry point file.
|
150
|
-
startScriptPath = path_1.default.join(state_1.default.getBinaryPkgPath(path_1.default.dirname(executable)), '..', 'index.js');
|
151
|
-
}
|
152
|
-
else {
|
153
|
-
// Start arguments with "--" so Electron knows these are OUR
|
154
|
-
// arguments and does not try to sanitize them. Otherwise on Windows
|
155
|
-
// an url in one of the arguments crashes it :(
|
156
|
-
// https://github.com/cypress-io/cypress/issues/5466
|
157
|
-
args = [...electronArgs, '--', ...args];
|
158
|
-
}
|
159
|
-
if (startScriptPath) {
|
160
|
-
args.unshift(startScriptPath);
|
161
|
-
}
|
162
|
-
if (process.env.CYPRESS_INTERNAL_DEV_DEBUG) {
|
163
|
-
args.unshift(process.env.CYPRESS_INTERNAL_DEV_DEBUG);
|
164
|
-
}
|
165
|
-
debug('spawn args %o %o', args, lodash_1.default.omit(stdioOptions, 'env'));
|
166
|
-
debug('spawning Cypress with executable: %s', executable);
|
167
|
-
const child = child_process_1.default.spawn(executable, args, stdioOptions);
|
168
|
-
function resolveOn(event) {
|
169
|
-
return function (code, signal) {
|
170
|
-
debug('child event fired %o', { event, code, signal });
|
171
|
-
if (code === null) {
|
172
|
-
const errorObject = errors_1.errors.childProcessKilled(event, signal);
|
173
|
-
return (0, errors_1.getError)(errorObject).then(reject);
|
174
|
-
}
|
175
|
-
resolve(code);
|
176
|
-
};
|
177
|
-
}
|
178
|
-
child.on('close', resolveOn('close'));
|
179
|
-
child.on('exit', resolveOn('exit'));
|
180
|
-
child.on('error', reject);
|
181
|
-
if (isPlatform('win32')) {
|
182
|
-
const rl = readline_1.default.createInterface({
|
183
|
-
input: process.stdin,
|
184
|
-
output: process.stdout,
|
185
|
-
});
|
186
|
-
// on windows, SIGINT does not propagate to the child process when ctrl+c is pressed
|
187
|
-
// this makes sure all nested processes are closed(ex: firefox inside the server)
|
188
|
-
rl.on('SIGINT', function () {
|
189
|
-
return __awaiter(this, void 0, void 0, function* () {
|
190
|
-
const kill = (yield Promise.resolve().then(() => __importStar(require('tree-kill')))).default;
|
191
|
-
kill(child.pid, 'SIGINT');
|
192
|
-
});
|
193
|
-
});
|
194
|
-
}
|
195
|
-
// if stdio options is set to 'pipe', then
|
196
|
-
// we should set up pipes:
|
197
|
-
// process STDIN (read stream) => child STDIN (writeable)
|
198
|
-
// child STDOUT => process STDOUT
|
199
|
-
// child STDERR => process STDERR with additional filtering
|
200
|
-
if (child.stdin) {
|
201
|
-
debug('piping process STDIN into child STDIN');
|
202
|
-
process.stdin.pipe(child.stdin);
|
203
|
-
}
|
204
|
-
if (child.stdout) {
|
205
|
-
debug('piping child STDOUT to process STDOUT');
|
206
|
-
child.stdout.pipe(process.stdout);
|
207
|
-
}
|
208
|
-
// if this is defined then we are manually piping for linux
|
209
|
-
// to filter out the garbage
|
210
|
-
if (child.stderr) {
|
211
|
-
debug('piping child STDERR to process STDERR');
|
212
|
-
child.stderr.on('data', (data) => {
|
213
|
-
const str = data.toString();
|
214
|
-
// if we have a callback and this explicitly returns
|
215
|
-
// false then bail
|
216
|
-
if (onStderrData && onStderrData(str)) {
|
217
|
-
return;
|
218
|
-
}
|
219
|
-
// else pass it along!
|
220
|
-
process.stderr.write(data);
|
221
|
-
});
|
222
|
-
}
|
223
|
-
// https://github.com/cypress-io/cypress/issues/1841
|
224
|
-
// https://github.com/cypress-io/cypress/issues/5241
|
225
|
-
// In some versions of node, it will throw on windows
|
226
|
-
// when you close the parent process after piping
|
227
|
-
// into the child process. unpiping does not seem
|
228
|
-
// to have any effect. so we're just catching the
|
229
|
-
// error here and not doing anything.
|
230
|
-
process.stdin.on('error', (err) => {
|
231
|
-
if (['EPIPE', 'ENOTCONN'].includes(err.code)) {
|
232
|
-
return;
|
233
|
-
}
|
234
|
-
throw err;
|
235
|
-
});
|
236
|
-
if (stdioOptions.detached) {
|
237
|
-
child.unref();
|
238
|
-
}
|
239
|
-
});
|
240
|
-
};
|
241
|
-
const spawnInXvfb = () => {
|
242
|
-
return xvfb_1.default
|
243
|
-
.start()
|
244
|
-
.then(userFriendlySpawn)
|
245
|
-
.finally(xvfb_1.default.stop);
|
246
|
-
};
|
247
|
-
const userFriendlySpawn = (linuxWithDisplayEnv) => {
|
248
|
-
debug('spawning, should retry on display problem?', Boolean(linuxWithDisplayEnv));
|
249
|
-
let brokenGtkDisplay;
|
250
|
-
const overrides = {};
|
251
|
-
if (linuxWithDisplayEnv) {
|
252
|
-
lodash_1.default.extend(overrides, {
|
253
|
-
electronLogging: true,
|
254
|
-
onStderrData(str) {
|
255
|
-
// if we receive a broken pipe anywhere
|
256
|
-
// then we know that's why cypress exited early
|
257
|
-
if (util_1.default.isBrokenGtkDisplay(str)) {
|
258
|
-
brokenGtkDisplay = true;
|
259
|
-
}
|
260
|
-
},
|
261
|
-
});
|
262
|
-
}
|
263
|
-
return spawn(overrides)
|
264
|
-
.then((code) => {
|
265
|
-
if (code !== 0 && brokenGtkDisplay) {
|
266
|
-
util_1.default.logBrokenGtkDisplayWarning();
|
267
|
-
return spawnInXvfb();
|
268
|
-
}
|
269
|
-
return code;
|
270
|
-
})
|
271
|
-
// we can format and handle an error message from the code above
|
272
|
-
// prevent wrapping error again by using "known: undefined" filter
|
273
|
-
.catch({ known: undefined }, (0, errors_1.throwFormErrorText)(errors_1.errors.unexpected));
|
274
|
-
};
|
275
|
-
if (needsXvfb) {
|
276
|
-
return spawnInXvfb();
|
277
|
-
}
|
278
|
-
// if we are on linux and there's already a DISPLAY
|
279
|
-
// set, then we may need to rerun cypress after
|
280
|
-
// spawning our own Xvfb server
|
281
|
-
const linuxWithDisplayEnv = util_1.default.isPossibleLinuxWithIncorrectDisplay();
|
282
|
-
return userFriendlySpawn(linuxWithDisplayEnv);
|
283
|
-
},
|
284
|
-
};
|
285
|
-
exports.default = spawnModule;
|
package/lib/exec/versions.js
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
"use strict";
|
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 bluebird_1 = __importDefault(require("bluebird"));
|
7
|
-
const debug_1 = __importDefault(require("debug"));
|
8
|
-
const path_1 = __importDefault(require("path"));
|
9
|
-
const util_1 = __importDefault(require("../util"));
|
10
|
-
const state_1 = __importDefault(require("../tasks/state"));
|
11
|
-
const errors_1 = require("../errors");
|
12
|
-
const debug = (0, debug_1.default)('cypress:cli');
|
13
|
-
const getVersions = () => {
|
14
|
-
return bluebird_1.default.try(() => {
|
15
|
-
if (util_1.default.getEnv('CYPRESS_RUN_BINARY')) {
|
16
|
-
let envBinaryPath = path_1.default.resolve(util_1.default.getEnv('CYPRESS_RUN_BINARY'));
|
17
|
-
return state_1.default.parseRealPlatformBinaryFolderAsync(envBinaryPath)
|
18
|
-
.then((envBinaryDir) => {
|
19
|
-
if (!envBinaryDir) {
|
20
|
-
return (0, errors_1.throwFormErrorText)(errors_1.errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))();
|
21
|
-
}
|
22
|
-
debug('CYPRESS_RUN_BINARY has binaryDir:', envBinaryDir);
|
23
|
-
return envBinaryDir;
|
24
|
-
})
|
25
|
-
.catch({ code: 'ENOENT' }, (err) => {
|
26
|
-
return (0, errors_1.throwFormErrorText)(errors_1.errors.CYPRESS_RUN_BINARY.notValid(envBinaryPath))(err.message);
|
27
|
-
});
|
28
|
-
}
|
29
|
-
return state_1.default.getBinaryDir();
|
30
|
-
})
|
31
|
-
.then(state_1.default.getBinaryPkgAsync)
|
32
|
-
.then((pkg) => {
|
33
|
-
const versions = {
|
34
|
-
binary: state_1.default.getBinaryPkgVersion(pkg),
|
35
|
-
electronVersion: state_1.default.getBinaryElectronVersion(pkg),
|
36
|
-
electronNodeVersion: state_1.default.getBinaryElectronNodeVersion(pkg),
|
37
|
-
};
|
38
|
-
debug('binary versions %o', versions);
|
39
|
-
return versions;
|
40
|
-
})
|
41
|
-
.then((binaryVersions) => {
|
42
|
-
const buildInfo = util_1.default.pkgBuildInfo();
|
43
|
-
let packageVersion = util_1.default.pkgVersion();
|
44
|
-
if (!buildInfo)
|
45
|
-
packageVersion += ' (development)';
|
46
|
-
else if (!buildInfo.stable)
|
47
|
-
packageVersion += ' (pre-release)';
|
48
|
-
const versions = {
|
49
|
-
package: packageVersion,
|
50
|
-
binary: binaryVersions.binary || 'not installed',
|
51
|
-
electronVersion: binaryVersions.electronVersion || 'not found',
|
52
|
-
electronNodeVersion: binaryVersions.electronNodeVersion || 'not found',
|
53
|
-
};
|
54
|
-
debug('combined versions %o', versions);
|
55
|
-
return versions;
|
56
|
-
});
|
57
|
-
};
|
58
|
-
const versionsModule = {
|
59
|
-
getVersions,
|
60
|
-
};
|
61
|
-
exports.default = versionsModule;
|
package/lib/fs.js
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
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 bluebird_1 = __importDefault(require("bluebird"));
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
8
|
-
exports.default = bluebird_1.default.promisifyAll(fs_extra_1.default);
|