/
cli_spec.js
505 lines (406 loc) · 16 KB
/
cli_spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
exports['shows help for open --foo 1'] = `
command: bin/cypress open --foo
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
error: unknown option: --foo
Usage: cypress open [options]
Opens Cypress in the interactive GUI.
Options:
-b, --browser <browser-path> 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.
--component runs component tests
-c, --config <config> sets configuration values. separate multiple
values with a comma. overrides any value in
cypress.config.{js,ts,mjs,cjs}.
-C, --config-file <config-file> path to script file where configuration
values are set. defaults to
"cypress.config.{js,ts,mjs,cjs}".
-d, --detached [bool] runs Cypress application in detached mode
--e2e runs end to end tests
-e, --env <env> sets environment variables. separate
multiple values with a comma. overrides any
value in cypress.config.{js,ts,mjs,cjs} or
cypress.env.json
--global force Cypress into global mode as if its
globally installed
-p, --port <port> runs Cypress on a specific port. overrides
any value in cypress.config.{js,ts,mjs,cjs}.
-P, --project <project-path> path to the project
--dev runs cypress in development and bypasses
binary check
-h, --help display help for command
-------
stderr:
-------
-------
`
exports['shows help for run --foo 1'] = `
command: bin/cypress run --foo
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
error: unknown option: --foo
Usage: cypress run [options]
Runs Cypress tests from the CLI without the GUI
Options:
-b, --browser <browser-name-or-path> 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.
--ci-build-id <id> 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
--component runs component tests
-c, --config <config> sets configuration values. separate multiple values with a comma. overrides any value in cypress.config.{js,ts,mjs,cjs}.
-C, --config-file <config-file> path to script file where configuration values are set. defaults to "cypress.config.{js,ts,mjs,cjs}".
--e2e runs end to end tests
-e, --env <env> sets environment variables. separate multiple values with a comma. overrides any value in cypress.config.{js,ts,mjs,cjs} or cypress.env.json
--group <name> a named group for recorded runs in Cypress Cloud
-k, --key <record-key> your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.
--headed displays the browser instead of running headlessly
--headless hide the browser instead of running headed (default for cypress run)
--no-exit keep the browser open after tests finish
--parallel enables concurrent runs and automatic load balancing of specs across multiple machines or processes
-p, --port <port> runs Cypress on a specific port. overrides any value in cypress.config.{js,ts,mjs,cjs}.
-P, --project <project-path> path to the project
-q, --quiet run quietly, using only the configured reporter
--record [bool] records the run. sends test results, screenshots and videos to Cypress Cloud.
-r, --reporter <reporter> runs a specific mocha reporter. pass a path to use a custom reporter. defaults to "spec"
-o, --reporter-options <reporter-options> options for the mocha reporter. defaults to "null"
-s, --spec <spec> runs specific spec file(s). defaults to "all"
-t, --tag <tag> named tag(s) for recorded runs in Cypress Cloud
--dev runs cypress in development and bypasses binary check
-h, --help display help for command
-------
stderr:
-------
-------
`
exports['cli unknown option shows help for cache command - unknown option --foo 1'] = `
command: bin/cypress cache --foo
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
error: unknown option: --foo
Usage: cypress cache [command]
Manages the Cypress binary cache
Options:
list list cached binary versions
path print the path to the binary cache
clear delete all cached binaries
prune deletes all cached binaries except for the version currently in
use
--size Used with the list command to show the sizes of the cached
folders
-h, --help display help for command
-------
stderr:
-------
-------
`
exports['cli unknown option shows help for cache command - unknown sub-command foo 1'] = `
command: bin/cypress cache foo
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
error: unknown command: cache foo
Usage: cypress cache [command]
Manages the Cypress binary cache
Options:
list list cached binary versions
path print the path to the binary cache
clear delete all cached binaries
prune deletes all cached binaries except for the version currently in
use
--size Used with the list command to show the sizes of the cached
folders
-h, --help display help for command
-------
stderr:
-------
-------
`
exports['cli unknown option shows help for cache command - no sub-command 1'] = `
command: bin/cypress cache
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
Usage: cypress cache [command]
Manages the Cypress binary cache
Options:
list list cached binary versions
path print the path to the binary cache
clear delete all cached binaries
prune deletes all cached binaries except for the version currently in
use
--size Used with the list command to show the sizes of the cached
folders
-h, --help display help for command
-------
stderr:
-------
-------
`
exports['cli help command shows help 1'] = `
command: bin/cypress help
code: 0
failed: false
killed: false
signal: null
timedOut: false
stdout:
-------
Usage: cypress <command> [options]
Options:
-v, --version prints Cypress version
-h, --help display help for command
Commands:
help Shows CLI help and exits
version prints Cypress version
open [options] Opens Cypress in the interactive GUI.
run [options] Runs Cypress tests from the CLI without the GUI
open-ct [options] Opens Cypress component testing interactive mode.
Deprecated: use "open --component"
run-ct [options] Runs all Cypress component testing suites. Deprecated:
use "run --component"
install [options] Installs the Cypress executable matching this package's
version
verify [options] Verifies that Cypress is installed correctly and
executable
cache [options] Manages the Cypress binary cache
info [options] Prints Cypress and system information
-------
stderr:
-------
-------
`
exports['cli help command shows help for -h 1'] = `
command: bin/cypress -h
code: 0
failed: false
killed: false
signal: null
timedOut: false
stdout:
-------
Usage: cypress <command> [options]
Options:
-v, --version prints Cypress version
-h, --help display help for command
Commands:
help Shows CLI help and exits
version prints Cypress version
open [options] Opens Cypress in the interactive GUI.
run [options] Runs Cypress tests from the CLI without the GUI
open-ct [options] Opens Cypress component testing interactive mode.
Deprecated: use "open --component"
run-ct [options] Runs all Cypress component testing suites. Deprecated:
use "run --component"
install [options] Installs the Cypress executable matching this package's
version
verify [options] Verifies that Cypress is installed correctly and
executable
cache [options] Manages the Cypress binary cache
info [options] Prints Cypress and system information
-------
stderr:
-------
-------
`
exports['cli help command shows help for --help 1'] = `
command: bin/cypress --help
code: 0
failed: false
killed: false
signal: null
timedOut: false
stdout:
-------
Usage: cypress <command> [options]
Options:
-v, --version prints Cypress version
-h, --help display help for command
Commands:
help Shows CLI help and exits
version prints Cypress version
open [options] Opens Cypress in the interactive GUI.
run [options] Runs Cypress tests from the CLI without the GUI
open-ct [options] Opens Cypress component testing interactive mode.
Deprecated: use "open --component"
run-ct [options] Runs all Cypress component testing suites. Deprecated:
use "run --component"
install [options] Installs the Cypress executable matching this package's
version
verify [options] Verifies that Cypress is installed correctly and
executable
cache [options] Manages the Cypress binary cache
info [options] Prints Cypress and system information
-------
stderr:
-------
-------
`
exports['cli unknown command shows usage and exits 1'] = `
command: bin/cypress foo
code: 1
failed: true
killed: false
signal: null
timedOut: false
stdout:
-------
Unknown command "foo"
Usage: cypress <command> [options]
Options:
-v, --version prints Cypress version
-h, --help display help for command
Commands:
help Shows CLI help and exits
version prints Cypress version
open [options] Opens Cypress in the interactive GUI.
run [options] Runs Cypress tests from the CLI without the GUI
open-ct [options] Opens Cypress component testing interactive mode.
Deprecated: use "open --component"
run-ct [options] Runs all Cypress component testing suites. Deprecated:
use "run --component"
install [options] Installs the Cypress executable matching this package's
version
verify [options] Verifies that Cypress is installed correctly and
executable
cache [options] Manages the Cypress binary cache
info [options] Prints Cypress and system information
-------
stderr:
-------
-------
`
exports['cli CYPRESS_INTERNAL_ENV catches environment "foo" 1'] = `
code: 11
stderr:
-------
The environment variable with the reserved name "CYPRESS_INTERNAL_ENV" is set.
Unset the "CYPRESS_INTERNAL_ENV" environment variable and run Cypress again.
----------
CYPRESS_INTERNAL_ENV=foo
----------
Platform: xxx
Cypress Version: 1.2.3
-------
`
exports['cli version and binary version 1'] = `
Cypress package version: 1.2.3
Cypress binary version: X.Y.Z
Electron version: not found
Bundled Node version: not found
`
exports['cli version and binary version 2'] = `
Cypress package version: 1.2.3
Cypress binary version: X.Y.Z
Electron version: not found
Bundled Node version: not found
`
exports['cli version with electron and node 1'] = `
Cypress package version: 1.2.3
Cypress binary version: X.Y.Z
Electron version: 10.10.88
Bundled Node version: 11.10.3
`
exports['cli version no binary version 1'] = `
Cypress package version: 1.2.3
Cypress binary version: not installed
Electron version: not found
Bundled Node version: not found
`
exports['cli --version no binary version 1'] = `
Cypress package version: 1.2.3
Cypress binary version: not installed
Electron version: not found
Bundled Node version: not found
`
exports['cli -v no binary version 1'] = `
Cypress package version: 1.2.3
Cypress binary version: not installed
Electron version: not found
Bundled Node version: not found
`
exports['cli cypress run warns with space-separated --spec 1'] = `
[33m⚠[39m Warning: It looks like you're passing --spec a space-separated list of arguments:
"a b c d e f g"
This will work, but it's not recommended.
If you are trying to pass multiple arguments, separate them with commas instead:
cypress run --spec arg1,arg2,arg3
The most common cause of this warning is using an unescaped glob pattern. If you are
trying to pass a glob pattern, escape it using quotes:
cypress run --spec "**/*.spec.js"
`
exports['cli cypress run warns with space-separated --tag 1'] = `
[33m⚠[39m Warning: It looks like you're passing --tag a space-separated list of arguments:
"a b c d e f g"
This will work, but it's not recommended.
If you are trying to pass multiple arguments, separate them with commas instead:
cypress run --tag arg1,arg2,arg3
`
exports['cli CYPRESS_INTERNAL_ENV allows and warns when staging environment 1'] = `
code: 0
stdout:
-------
⚠ Warning: It looks like you're passing CYPRESS_INTERNAL_ENV=staging
The environment variable "CYPRESS_INTERNAL_ENV" is reserved and should only be used internally.
Unset the "CYPRESS_INTERNAL_ENV" environment variable and run Cypress again.
Usage: cypress <command> [options]
Options:
-v, --version prints Cypress version
-h, --help display help for command
Commands:
help Shows CLI help and exits
version prints Cypress version
open [options] Opens Cypress in the interactive GUI.
run [options] Runs Cypress tests from the CLI without the GUI
open-ct [options] Opens Cypress component testing interactive mode.
Deprecated: use "open --component"
run-ct [options] Runs all Cypress component testing suites. Deprecated:
use "run --component"
install [options] Installs the Cypress executable matching this package's
version
verify [options] Verifies that Cypress is installed correctly and
executable
cache [options] Manages the Cypress binary cache
info [options] Prints Cypress and system information
-------
stderr:
-------
-------
`
exports['cli version and binary version with npm log silent'] = `
Cypress package version: 1.2.3
Cypress binary version: X.Y.Z
Electron version: not found
Bundled Node version: not found
`
exports['cli version and binary version with npm log warn'] = `
Cypress package version: 1.2.3
Cypress binary version: X.Y.Z
Electron version: not found
Bundled Node version: not found
`
exports['prints explanation when no cache'] = `
No cached binary versions were found.
`