cypress 9.6.0 → 10.0.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/index.mjs +15 -0
- package/lib/cli.js +72 -23
- package/lib/errors.js +16 -1
- package/lib/exec/open.js +45 -10
- package/lib/exec/run.js +17 -10
- package/lib/exec/shared.js +30 -9
- package/lib/exec/spawn.js +4 -0
- package/lib/exec/xvfb.js +1 -0
- package/lib/util.js +10 -3
- package/mount-utils/CHANGELOG.md +20 -0
- package/mount-utils/README.md +14 -0
- package/mount-utils/dist/index.d.ts +54 -0
- package/mount-utils/dist/index.js +134 -0
- package/mount-utils/package.json +31 -0
- package/package.json +39 -4
- package/react/CHANGELOG.md +373 -0
- package/react/README.md +414 -0
- package/react/dist/cypress-react.browser.js +497 -0
- package/react/dist/cypress-react.cjs.js +495 -0
- package/react/dist/cypress-react.esm-bundler.js +467 -0
- package/react/dist/getDisplayName.d.ts +8 -0
- package/react/dist/index.d.ts +2 -0
- package/react/dist/mount.d.ts +143 -0
- package/react/dist/mountHook.d.ts +11 -0
- package/react/package.json +105 -0
- package/types/bluebird/index.d.ts +18 -4
- package/types/cypress-eventemitter.d.ts +1 -1
- package/types/cypress-global-vars.d.ts +2 -2
- package/types/cypress-npm-api.d.ts +4 -10
- package/types/cypress.d.ts +180 -120
- package/types/minimatch/index.d.ts +15 -5
- package/vue/CHANGELOG.md +380 -0
- package/vue/README.md +678 -0
- package/vue/dist/cypress-vue.cjs.js +13535 -0
- package/vue/dist/cypress-vue.esm-bundler.js +13511 -0
- package/vue/dist/index.d.ts +56 -0
- package/vue/package.json +86 -0
- package/vue2/CHANGELOG.md +5 -0
- package/vue2/README.md +693 -0
- package/vue2/dist/cypress-vue2.browser.js +20191 -0
- package/vue2/dist/cypress-vue2.cjs.js +20188 -0
- package/vue2/dist/cypress-vue2.esm-bundler.js +20179 -0
- package/vue2/dist/index.d.ts +171 -0
- package/vue2/package.json +59 -0
package/index.mjs
ADDED
@@ -0,0 +1,15 @@
|
|
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 run = cypress.run
|
12
|
+
|
13
|
+
export const open = cypress.open
|
14
|
+
|
15
|
+
export const cli = cypress.cli
|
package/lib/cli.js
CHANGED
@@ -34,10 +34,6 @@ function unknownOption(flag, type = 'option') {
|
|
34
34
|
|
35
35
|
commander.Command.prototype.unknownOption = unknownOption;
|
36
36
|
|
37
|
-
const coerceFalseOrString = arg => {
|
38
|
-
return arg !== 'false' ? arg : false;
|
39
|
-
};
|
40
|
-
|
41
37
|
const coerceFalse = arg => {
|
42
38
|
return arg !== 'false';
|
43
39
|
};
|
@@ -110,19 +106,20 @@ const parseVariableOpts = (fnArgs, args) => {
|
|
110
106
|
};
|
111
107
|
|
112
108
|
const descriptions = {
|
113
|
-
|
114
|
-
browserRunMode: 'runs Cypress in the browser with the given name. if a filesystem path is supplied, Cypress will attempt to use the browser at that path.',
|
109
|
+
browser: 'runs Cypress in the browser with the given name. if a filesystem path is supplied, Cypress will attempt to use the browser at that path.',
|
115
110
|
cacheClear: 'delete all cached binaries',
|
116
111
|
cachePrune: 'deletes all cached binaries except for the version currently in use',
|
117
112
|
cacheList: 'list cached binary versions',
|
118
113
|
cachePath: 'print the path to the binary cache',
|
119
114
|
cacheSize: 'Used with the list command to show the sizes of the cached folders',
|
120
115
|
ciBuildId: 'the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers',
|
121
|
-
|
122
|
-
|
116
|
+
component: 'runs component tests',
|
117
|
+
config: 'sets configuration values. separate multiple values with a comma. overrides any value in cypress.config.{js,ts,mjs,cjs}.',
|
118
|
+
configFile: 'path to script file where configuration values are set. defaults to "cypress.config.{js,ts,mjs,cjs}".',
|
123
119
|
detached: 'runs Cypress application in detached mode',
|
124
120
|
dev: 'runs cypress in development and bypasses binary check',
|
125
|
-
|
121
|
+
e2e: 'runs end to end tests',
|
122
|
+
env: 'sets environment variables. separate multiple values with a comma. overrides any value in cypress.config.{js,ts,mjs,cjs} or cypress.env.json',
|
126
123
|
exit: 'keep the browser open after tests finish',
|
127
124
|
forceInstall: 'force install the Cypress binary',
|
128
125
|
global: 'force Cypress into global mode as if its globally installed',
|
@@ -131,7 +128,7 @@ const descriptions = {
|
|
131
128
|
headless: 'hide the browser instead of running headed (default for cypress run)',
|
132
129
|
key: 'your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.',
|
133
130
|
parallel: 'enables concurrent runs and automatic load balancing of specs across multiple machines or processes',
|
134
|
-
port: 'runs Cypress on a specific port. overrides any value in cypress.
|
131
|
+
port: 'runs Cypress on a specific port. overrides any value in cypress.config.{js,ts,mjs,cjs}.',
|
135
132
|
project: 'path to the project',
|
136
133
|
quiet: 'run quietly, using only the configured reporter',
|
137
134
|
record: 'records the run. sends test results, screenshots and videos to your Cypress Dashboard.',
|
@@ -221,11 +218,19 @@ const createProgram = () => {
|
|
221
218
|
};
|
222
219
|
|
223
220
|
const addCypressRunCommand = program => {
|
224
|
-
return program.command('run').usage('[options]').description('Runs Cypress tests from the CLI without the GUI').option('-b, --browser <browser-name-or-path>', text('
|
221
|
+
return program.command('run').usage('[options]').description('Runs Cypress tests from the CLI without the GUI').option('-b, --browser <browser-name-or-path>', text('browser')).option('--ci-build-id <id>', text('ciBuildId')).option('--component', text('component')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('--e2e', text('e2e')).option('-e, --env <env>', text('env')).option('--group <name>', text('group')).option('-k, --key <record-key>', text('key')).option('--headed', text('headed')).option('--headless', text('headless')).option('--no-exit', text('exit')).option('--parallel', text('parallel')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('-q, --quiet', text('quiet')).option('--record [bool]', text('record'), coerceFalse).option('-r, --reporter <reporter>', text('reporter')).option('-o, --reporter-options <reporter-options>', text('reporterOptions')).option('-s, --spec <spec>', text('spec')).option('-t, --tag <tag>', text('tag')).option('--dev', text('dev'), coerceFalse);
|
225
222
|
};
|
226
223
|
|
227
224
|
const addCypressOpenCommand = program => {
|
228
|
-
return program.command('open').usage('[options]').description('Opens Cypress in the interactive GUI.').option('-b, --browser <browser-path>', text('
|
225
|
+
return program.command('open').usage('[options]').description('Opens Cypress in the interactive GUI.').option('-b, --browser <browser-path>', text('browser')).option('--component', text('component')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-d, --detached [bool]', text('detached'), coerceFalse).option('--e2e', text('e2e')).option('-e, --env <env>', text('env')).option('--global', text('global')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('--dev', text('dev'), coerceFalse);
|
226
|
+
};
|
227
|
+
|
228
|
+
const maybeAddInspectFlags = program => {
|
229
|
+
if (process.argv.includes('--dev')) {
|
230
|
+
return program.option('--inspect', 'Node option').option('--inspect-brk', 'Node option');
|
231
|
+
}
|
232
|
+
|
233
|
+
return program;
|
229
234
|
};
|
230
235
|
/**
|
231
236
|
* Casts known command line options for "cypress run" to their intended type.
|
@@ -236,7 +241,7 @@ const addCypressOpenCommand = program => {
|
|
236
241
|
*/
|
237
242
|
|
238
243
|
|
239
|
-
const
|
244
|
+
const castCypressOptions = opts => {
|
240
245
|
// only properties that have type "string | false" in our TS definition
|
241
246
|
// require special handling, because CLI parsing takes care of purely
|
242
247
|
// boolean arguments
|
@@ -247,10 +252,6 @@ const castCypressRunOptions = opts => {
|
|
247
252
|
castOpts.port = coerceAnyStringToInt(opts.port);
|
248
253
|
}
|
249
254
|
|
250
|
-
if (_.has(opts, 'configFile')) {
|
251
|
-
castOpts.configFile = coerceFalseOrString(opts.configFile);
|
252
|
-
}
|
253
|
-
|
254
255
|
return castOpts;
|
255
256
|
};
|
256
257
|
|
@@ -275,11 +276,44 @@ module.exports = {
|
|
275
276
|
cliArgs.unshift(null, null);
|
276
277
|
debug('creating program parser');
|
277
278
|
const program = createProgram();
|
278
|
-
addCypressRunCommand(program).action((...fnArgs) => {
|
279
|
+
maybeAddInspectFlags(addCypressRunCommand(program)).action((...fnArgs) => {
|
279
280
|
debug('parsed Cypress run %o', fnArgs);
|
280
281
|
const options = parseVariableOpts(fnArgs, cliArgs);
|
281
282
|
debug('parsed options %o', options);
|
282
|
-
const casted =
|
283
|
+
const casted = castCypressOptions(options);
|
284
|
+
debug('casted options %o', casted);
|
285
|
+
resolve(casted);
|
286
|
+
});
|
287
|
+
debug('parsing args: %o', cliArgs);
|
288
|
+
program.parse(cliArgs);
|
289
|
+
});
|
290
|
+
},
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Parses `cypress open` command line option array into an object
|
294
|
+
* with options that you can feed into cy.openModeSystemTest test calls
|
295
|
+
* @example
|
296
|
+
* const options = parseOpenCommand(['cypress', 'open', '--browser', 'chrome'])
|
297
|
+
* // options is {browser: 'chrome'}
|
298
|
+
*/
|
299
|
+
parseOpenCommand(args) {
|
300
|
+
return new Promise((resolve, reject) => {
|
301
|
+
if (!Array.isArray(args)) {
|
302
|
+
return reject(new Error('Expected array of arguments'));
|
303
|
+
} // make a copy of the input arguments array
|
304
|
+
// and add placeholders where "node ..." would usually be
|
305
|
+
// also remove "cypress" keyword at the start if present
|
306
|
+
|
307
|
+
|
308
|
+
const cliArgs = args[0] === 'cypress' ? [...args.slice(1)] : [...args];
|
309
|
+
cliArgs.unshift(null, null);
|
310
|
+
debug('creating program parser');
|
311
|
+
const program = createProgram();
|
312
|
+
maybeAddInspectFlags(addCypressOpenCommand(program)).action((...fnArgs) => {
|
313
|
+
debug('parsed Cypress open %o', fnArgs);
|
314
|
+
const options = parseVariableOpts(fnArgs, cliArgs);
|
315
|
+
debug('parsed options %o', options);
|
316
|
+
const casted = castCypressOptions(options);
|
283
317
|
debug('casted options %o', casted);
|
284
318
|
resolve(casted);
|
285
319
|
});
|
@@ -326,25 +360,40 @@ module.exports = {
|
|
326
360
|
program.option('-v, --version', text('version')).command('version').description(text('version')).action(() => {
|
327
361
|
showVersions(args);
|
328
362
|
});
|
329
|
-
addCypressOpenCommand(program).action(opts => {
|
363
|
+
maybeAddInspectFlags(addCypressOpenCommand(program)).action(opts => {
|
330
364
|
debug('opening Cypress');
|
331
365
|
|
332
366
|
require('./exec/open').start(util.parseOpts(opts)).then(util.exit).catch(util.logErrorExit1);
|
333
367
|
});
|
334
|
-
addCypressRunCommand(program).action((...fnArgs) => {
|
368
|
+
maybeAddInspectFlags(addCypressRunCommand(program)).action((...fnArgs) => {
|
335
369
|
debug('running Cypress with args %o', fnArgs);
|
336
370
|
|
337
371
|
require('./exec/run').start(parseVariableOpts(fnArgs, args)).then(util.exit).catch(util.logErrorExit1);
|
338
372
|
});
|
339
|
-
program.command('open-ct').usage('[options]').description('Opens Cypress component testing interactive mode.').option('-b, --browser <browser-path>', text('
|
373
|
+
program.command('open-ct').usage('[options]').description('Opens Cypress component testing interactive mode. Deprecated: use "open --component"').option('-b, --browser <browser-path>', text('browser')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-d, --detached [bool]', text('detached'), coerceFalse).option('-e, --env <env>', text('env')).option('--global', text('global')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('--dev', text('dev'), coerceFalse).action(opts => {
|
340
374
|
debug('opening Cypress');
|
375
|
+
const msg = `
|
376
|
+
${logSymbols.warning} Warning: open-ct is deprecated and will be removed in a future release.
|
377
|
+
|
378
|
+
Use \`cypress open --component\` instead.
|
379
|
+
`;
|
380
|
+
logger.warn();
|
381
|
+
logger.warn(stripIndent(msg));
|
382
|
+
logger.warn();
|
341
383
|
|
342
384
|
require('./exec/open').start({ ...util.parseOpts(opts),
|
343
385
|
testingType: 'component'
|
344
386
|
}).then(util.exit).catch(util.logErrorExit1);
|
345
387
|
});
|
346
|
-
program.command('run-ct').usage('[options]').description('Runs all Cypress
|
388
|
+
program.command('run-ct').usage('[options]').description('Runs all Cypress component testing suites. Deprecated: use "run --component"').option('-b, --browser <browser-name-or-path>', text('browser')).option('--ci-build-id <id>', text('ciBuildId')).option('-c, --config <config>', text('config')).option('-C, --config-file <config-file>', text('configFile')).option('-e, --env <env>', text('env')).option('--group <name>', text('group')).option('-k, --key <record-key>', text('key')).option('--headed', text('headed')).option('--headless', text('headless')).option('--no-exit', text('exit')).option('--parallel', text('parallel')).option('-p, --port <port>', text('port')).option('-P, --project <project-path>', text('project')).option('-q, --quiet', text('quiet')).option('--record [bool]', text('record'), coerceFalse).option('-r, --reporter <reporter>', text('reporter')).option('-o, --reporter-options <reporter-options>', text('reporterOptions')).option('-s, --spec <spec>', text('spec')).option('-t, --tag <tag>', text('tag')).option('--dev', text('dev'), coerceFalse).action(opts => {
|
347
389
|
debug('running Cypress run-ct');
|
390
|
+
const msg = `
|
391
|
+
${logSymbols.warning} Warning: run-ct is deprecated and will be removed in a future release.
|
392
|
+
Use \`cypress run --component\` instead.
|
393
|
+
`;
|
394
|
+
logger.warn();
|
395
|
+
logger.warn(stripIndent(msg));
|
396
|
+
logger.warn();
|
348
397
|
|
349
398
|
require('./exec/run').start({ ...util.parseOpts(opts),
|
350
399
|
testingType: 'component'
|
package/lib/errors.js
CHANGED
@@ -214,6 +214,18 @@ const invalidTestingType = {
|
|
214
214
|
description: 'Invalid testingType',
|
215
215
|
solution: `Please provide a valid testingType. Valid test types are ${chalk.cyan('\'e2e\'')} and ${chalk.cyan('\'component\'')}.`
|
216
216
|
};
|
217
|
+
const incompatibleTestTypeFlags = {
|
218
|
+
description: '`--e2e` and `--component` cannot both be passed.',
|
219
|
+
solution: 'Either pass `--e2e` or `--component`, but not both.'
|
220
|
+
};
|
221
|
+
const incompatibleTestingTypeAndFlag = {
|
222
|
+
description: 'Set a `testingType` and also passed `--e2e` or `--component` flags.',
|
223
|
+
solution: 'Either set `testingType` or pass a testing type flag, but not both.'
|
224
|
+
};
|
225
|
+
const invalidConfigFile = {
|
226
|
+
description: '`--config-file` cannot be false.',
|
227
|
+
solution: 'Either pass a relative path to a valid Cypress config file or remove this option.'
|
228
|
+
};
|
217
229
|
/**
|
218
230
|
* This error happens when CLI detects that the child Test Runner process
|
219
231
|
* was killed with a signal, like SIGBUS
|
@@ -397,6 +409,9 @@ module.exports = {
|
|
397
409
|
childProcessKilled,
|
398
410
|
incompatibleHeadlessFlags,
|
399
411
|
invalidRunProjectPath,
|
400
|
-
invalidTestingType
|
412
|
+
invalidTestingType,
|
413
|
+
incompatibleTestTypeFlags,
|
414
|
+
incompatibleTestingTypeAndFlag,
|
415
|
+
invalidConfigFile
|
401
416
|
}
|
402
417
|
};
|
package/lib/exec/open.js
CHANGED
@@ -9,10 +9,25 @@ const spawn = require('./spawn');
|
|
9
9
|
const verify = require('../tasks/verify');
|
10
10
|
|
11
11
|
const {
|
12
|
-
processTestingType
|
12
|
+
processTestingType,
|
13
|
+
checkConfigFile
|
13
14
|
} = require('./shared');
|
14
15
|
|
15
|
-
const
|
16
|
+
const {
|
17
|
+
exitWithError
|
18
|
+
} = require('../errors');
|
19
|
+
/**
|
20
|
+
* Maps options collected by the CLI
|
21
|
+
* and forms list of CLI arguments to the server.
|
22
|
+
*
|
23
|
+
* Note: there is lightweight validation, with errors
|
24
|
+
* thrown synchronously.
|
25
|
+
*
|
26
|
+
* @returns {string[]} list of CLI arguments
|
27
|
+
*/
|
28
|
+
|
29
|
+
|
30
|
+
const processOpenOptions = (options = {}) => {
|
16
31
|
if (!util.isInstalledGlobally() && !options.global && !options.project) {
|
17
32
|
options.project = process.cwd();
|
18
33
|
}
|
@@ -24,6 +39,7 @@ const processOpenOptions = options => {
|
|
24
39
|
}
|
25
40
|
|
26
41
|
if (options.configFile !== undefined) {
|
42
|
+
checkConfigFile(options);
|
27
43
|
args.push('--config-file', options.configFile);
|
28
44
|
}
|
29
45
|
|
@@ -43,7 +59,19 @@ const processOpenOptions = options => {
|
|
43
59
|
args.push('--project', options.project);
|
44
60
|
}
|
45
61
|
|
46
|
-
|
62
|
+
if (options.global) {
|
63
|
+
args.push('--global', options.global);
|
64
|
+
}
|
65
|
+
|
66
|
+
if (options.inspect) {
|
67
|
+
args.push('--inspect');
|
68
|
+
}
|
69
|
+
|
70
|
+
if (options.inspectBrk) {
|
71
|
+
args.push('--inspectBrk');
|
72
|
+
}
|
73
|
+
|
74
|
+
args.push(...processTestingType(options));
|
47
75
|
debug('opening from options %j', options);
|
48
76
|
debug('command line arguments %j', args);
|
49
77
|
return args;
|
@@ -53,14 +81,21 @@ module.exports = {
|
|
53
81
|
processOpenOptions,
|
54
82
|
|
55
83
|
start(options = {}) {
|
56
|
-
const args = processOpenOptions(options);
|
57
|
-
|
58
84
|
function open() {
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
85
|
+
try {
|
86
|
+
const args = processOpenOptions(options);
|
87
|
+
return spawn.start(args, {
|
88
|
+
dev: options.dev,
|
89
|
+
detached: Boolean(options.detached),
|
90
|
+
stdio: 'inherit'
|
91
|
+
});
|
92
|
+
} catch (err) {
|
93
|
+
if (err.details) {
|
94
|
+
return exitWithError(err.details)();
|
95
|
+
}
|
96
|
+
|
97
|
+
throw err;
|
98
|
+
}
|
64
99
|
}
|
65
100
|
|
66
101
|
if (options.dev) {
|
package/lib/exec/run.js
CHANGED
@@ -17,7 +17,8 @@ const {
|
|
17
17
|
|
18
18
|
const {
|
19
19
|
processTestingType,
|
20
|
-
throwInvalidOptionError
|
20
|
+
throwInvalidOptionError,
|
21
|
+
checkConfigFile
|
21
22
|
} = require('./shared');
|
22
23
|
/**
|
23
24
|
* Typically a user passes a string path to the project.
|
@@ -74,6 +75,7 @@ const processRunOptions = (options = {}) => {
|
|
74
75
|
}
|
75
76
|
|
76
77
|
if (options.configFile !== undefined) {
|
78
|
+
checkConfigFile(options);
|
77
79
|
args.push('--config-file', options.configFile);
|
78
80
|
}
|
79
81
|
|
@@ -153,7 +155,15 @@ const processRunOptions = (options = {}) => {
|
|
153
155
|
args.push('--tag', options.tag);
|
154
156
|
}
|
155
157
|
|
156
|
-
|
158
|
+
if (options.inspect) {
|
159
|
+
args.push('--inspect');
|
160
|
+
}
|
161
|
+
|
162
|
+
if (options.inspectBrk) {
|
163
|
+
args.push('--inspectBrk');
|
164
|
+
}
|
165
|
+
|
166
|
+
args.push(...processTestingType(options));
|
157
167
|
return args;
|
158
168
|
};
|
159
169
|
|
@@ -172,10 +182,12 @@ module.exports = {
|
|
172
182
|
});
|
173
183
|
|
174
184
|
function run() {
|
175
|
-
let args;
|
176
|
-
|
177
185
|
try {
|
178
|
-
args = processRunOptions(options);
|
186
|
+
const args = processRunOptions(options);
|
187
|
+
debug('run to spawn.start args %j', args);
|
188
|
+
return spawn.start(args, {
|
189
|
+
dev: options.dev
|
190
|
+
});
|
179
191
|
} catch (err) {
|
180
192
|
if (err.details) {
|
181
193
|
return exitWithError(err.details)();
|
@@ -183,11 +195,6 @@ module.exports = {
|
|
183
195
|
|
184
196
|
throw err;
|
185
197
|
}
|
186
|
-
|
187
|
-
debug('run to spawn.start args %j', args);
|
188
|
-
return spawn.start(args, {
|
189
|
-
dev: options.dev
|
190
|
-
});
|
191
198
|
}
|
192
199
|
|
193
200
|
if (options.dev) {
|
package/lib/exec/shared.js
CHANGED
@@ -28,23 +28,44 @@ const throwInvalidOptionError = details => {
|
|
28
28
|
*/
|
29
29
|
|
30
30
|
|
31
|
-
const processTestingType =
|
32
|
-
if (
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
const processTestingType = options => {
|
32
|
+
if (options.e2e && options.component) {
|
33
|
+
return throwInvalidOptionError(errors.incompatibleTestTypeFlags);
|
34
|
+
}
|
35
|
+
|
36
|
+
if (options.testingType && (options.component || options.e2e)) {
|
37
|
+
return throwInvalidOptionError(errors.incompatibleTestTypeFlags);
|
38
|
+
}
|
36
39
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
if (options.testingType === 'component' || options.component || options.ct) {
|
41
|
+
return ['--testing-type', 'component'];
|
42
|
+
}
|
43
|
+
|
44
|
+
if (options.testingType === 'e2e' || options.e2e) {
|
45
|
+
return ['--testing-type', 'e2e'];
|
46
|
+
}
|
40
47
|
|
48
|
+
if (options.testingType) {
|
41
49
|
return throwInvalidOptionError(errors.invalidTestingType);
|
42
50
|
}
|
43
51
|
|
44
52
|
return [];
|
45
53
|
};
|
54
|
+
/**
|
55
|
+
* Throws an error if configFile is string 'false' or boolean false
|
56
|
+
* @param {*} options
|
57
|
+
*/
|
58
|
+
|
59
|
+
|
60
|
+
const checkConfigFile = options => {
|
61
|
+
// CLI will parse as string, module API can pass in boolean
|
62
|
+
if (options.configFile === 'false' || options.configFile === false) {
|
63
|
+
throwInvalidOptionError(errors.invalidConfigFile);
|
64
|
+
}
|
65
|
+
};
|
46
66
|
|
47
67
|
module.exports = {
|
48
68
|
throwInvalidOptionError,
|
49
|
-
processTestingType
|
69
|
+
processTestingType,
|
70
|
+
checkConfigFile
|
50
71
|
};
|
package/lib/exec/spawn.js
CHANGED
@@ -175,6 +175,10 @@ module.exports = {
|
|
175
175
|
args.unshift(startScriptPath);
|
176
176
|
}
|
177
177
|
|
178
|
+
if (process.env.CYPRESS_INTERNAL_DEV_DEBUG) {
|
179
|
+
args.unshift(process.env.CYPRESS_INTERNAL_DEV_DEBUG);
|
180
|
+
}
|
181
|
+
|
178
182
|
debug('spawn args %o %o', args, _.omit(stdioOptions, 'env'));
|
179
183
|
debug('spawning Cypress with executable: %s', executable);
|
180
184
|
const child = cp.spawn(executable, args, stdioOptions);
|
package/lib/exec/xvfb.js
CHANGED
@@ -23,6 +23,7 @@ const debug = Debug('cypress:cli');
|
|
23
23
|
const debugXvfb = Debug('cypress:xvfb');
|
24
24
|
debug.Debug = debugXvfb.Debug = Debug;
|
25
25
|
const xvfbOptions = {
|
26
|
+
displayNum: process.env.XVFB_DISPLAY_NUM,
|
26
27
|
timeout: 30000,
|
27
28
|
// milliseconds
|
28
29
|
// need to explicitly define screen otherwise electron will crash
|
package/lib/util.js
CHANGED
@@ -213,7 +213,7 @@ const dequote = str => {
|
|
213
213
|
};
|
214
214
|
|
215
215
|
const parseOpts = opts => {
|
216
|
-
opts = _.pick(opts, 'browser', 'cachePath', 'cacheList', 'cacheClear', 'cachePrune', 'ciBuildId', 'config', 'configFile', 'cypressVersion', 'destination', 'detached', 'dev', 'exit', 'env', 'force', 'global', 'group', 'headed', 'headless', 'key', 'path', 'parallel', 'port', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'runProject', 'spec', 'tag');
|
216
|
+
opts = _.pick(opts, 'browser', 'cachePath', 'cacheList', 'cacheClear', 'cachePrune', 'ciBuildId', 'ct', 'component', 'config', 'configFile', 'cypressVersion', 'destination', 'detached', 'dev', 'e2e', 'exit', 'env', 'force', 'global', 'group', 'headed', 'headless', 'inspect', 'inspectBrk', 'key', 'path', 'parallel', 'port', 'project', 'quiet', 'reporter', 'reporterOptions', 'record', 'runProject', 'spec', 'tag');
|
217
217
|
|
218
218
|
if (opts.exit) {
|
219
219
|
opts = _.omit(opts, 'exit');
|
@@ -245,10 +245,15 @@ const getApplicationDataFolder = (...paths) => {
|
|
245
245
|
env
|
246
246
|
} = process; // allow overriding the app_data folder
|
247
247
|
|
248
|
-
|
248
|
+
let folder = env.CYPRESS_KONFIG_ENV || env.CYPRESS_INTERNAL_ENV || 'development';
|
249
249
|
const PRODUCT_NAME = pkg.productName || pkg.name;
|
250
250
|
const OS_DATA_PATH = ospath.data();
|
251
251
|
const ELECTRON_APP_DATA_PATH = path.join(OS_DATA_PATH, PRODUCT_NAME);
|
252
|
+
|
253
|
+
if (process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF) {
|
254
|
+
folder = `${folder}-e2e-test`;
|
255
|
+
}
|
256
|
+
|
252
257
|
const p = path.join(ELECTRON_APP_DATA_PATH, 'cy', folder, ...paths);
|
253
258
|
return p;
|
254
259
|
};
|
@@ -289,7 +294,9 @@ const util = {
|
|
289
294
|
// Node's builtin crypto.hash function.
|
290
295
|
|
291
296
|
|
292
|
-
if (process.versions && semver.satisfies(process.versions.node, '>=17.0.0') && process.versions.openssl
|
297
|
+
if (process.versions && semver.satisfies(process.versions.node, '>=17.0.0') && semver.satisfies(process.versions.openssl, '>=3', {
|
298
|
+
includePrerelease: true
|
299
|
+
})) {
|
293
300
|
opts.ORIGINAL_NODE_OPTIONS = `${opts.ORIGINAL_NODE_OPTIONS || ''} --openssl-legacy-provider`;
|
294
301
|
}
|
295
302
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# [@cypress/mount-utils-v1.0.2](https://github.com/cypress-io/cypress/compare/@cypress/mount-utils-v1.0.1...@cypress/mount-utils-v1.0.2) (2021-04-30)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* avoid unmounting React components twice ([#16280](https://github.com/cypress-io/cypress/issues/16280)) ([bd629d3](https://github.com/cypress-io/cypress/commit/bd629d307eca9165b2c6f44ff87164a9e07a3eb5))
|
7
|
+
|
8
|
+
# [@cypress/mount-utils-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/mount-utils-v1.0.0...@cypress/mount-utils-v1.0.1) (2021-04-26)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* **webpack-dev-server:** remove hard dependency on html-webpack-plugin v4 ([#16108](https://github.com/cypress-io/cypress/issues/16108)) ([4cfe4b1](https://github.com/cypress-io/cypress/commit/4cfe4b1971c615d615c05ce35b9f7dd5ef8315fc))
|
14
|
+
|
15
|
+
# @cypress/mount-utils-v1.0.0 (2021-04-21)
|
16
|
+
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* improve handling of userland injected styles in component testing ([#16024](https://github.com/cypress-io/cypress/issues/16024)) ([fe0b63c](https://github.com/cypress-io/cypress/commit/fe0b63c299947470c9cdce3a0d00364a1e224bdb))
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# @cypress/mount-utils
|
2
|
+
|
3
|
+
> **Note** this package is not meant to be used outside of cypress component testing.
|
4
|
+
|
5
|
+
This librares exports some shared types and utility functions designed to build adapters for components frameworks.
|
6
|
+
|
7
|
+
It is used in:
|
8
|
+
|
9
|
+
- [`@cypress/react`](https://github.com/cypress-io/cypress/tree/develop/npm/react)
|
10
|
+
- [`@cypress/vue`](https://github.com/cypress-io/cypress/tree/develop/npm/vue)
|
11
|
+
|
12
|
+
## Changelog
|
13
|
+
|
14
|
+
[Changelog](./CHANGELOG.md)
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/**
|
2
|
+
* Additional styles to inject into the document.
|
3
|
+
* A component might need 3rd party libraries from CDN,
|
4
|
+
* local CSS files and custom styles.
|
5
|
+
*/
|
6
|
+
export interface StyleOptions {
|
7
|
+
/**
|
8
|
+
* Creates <link href="..." /> element for each stylesheet
|
9
|
+
* @alias stylesheet
|
10
|
+
*/
|
11
|
+
stylesheets: string | string[];
|
12
|
+
/**
|
13
|
+
* Creates <link href="..." /> element for each stylesheet
|
14
|
+
* @alias stylesheets
|
15
|
+
*/
|
16
|
+
stylesheet: string | string[];
|
17
|
+
/**
|
18
|
+
* Creates <style>...</style> element and inserts given CSS.
|
19
|
+
* @alias styles
|
20
|
+
*/
|
21
|
+
style: string | string[];
|
22
|
+
/**
|
23
|
+
* Creates <style>...</style> element for each given CSS text.
|
24
|
+
* @alias style
|
25
|
+
*/
|
26
|
+
styles: string | string[];
|
27
|
+
/**
|
28
|
+
* Loads each file and creates a <style>...</style> element
|
29
|
+
* with the loaded CSS
|
30
|
+
* @alias cssFile
|
31
|
+
*/
|
32
|
+
cssFiles: string | string[];
|
33
|
+
/**
|
34
|
+
* Single CSS file to load into a <style></style> element
|
35
|
+
* @alias cssFile
|
36
|
+
*/
|
37
|
+
cssFile: string | string[];
|
38
|
+
}
|
39
|
+
export declare const ROOT_SELECTOR = "[data-cy-root]";
|
40
|
+
export declare const getContainerEl: () => HTMLElement;
|
41
|
+
/**
|
42
|
+
* Remove any style or extra link elements from the iframe placeholder
|
43
|
+
* left from any previous test
|
44
|
+
*
|
45
|
+
*/
|
46
|
+
export declare function cleanupStyles(): void;
|
47
|
+
/**
|
48
|
+
* Injects custom style text or CSS file or 3rd party style resources
|
49
|
+
* into the given document.
|
50
|
+
*/
|
51
|
+
export declare const injectStylesBeforeElement: (options: Partial<StyleOptions & {
|
52
|
+
log: boolean;
|
53
|
+
}>, document: Document, el: HTMLElement | null) => HTMLElement;
|
54
|
+
export declare function setupHooks(optionalCallback?: Function): void;
|