Skip to content

Commit 5367165

Browse files
committed
Standardize on --component, misc review feedback
1 parent ce398fc commit 5367165

File tree

42 files changed

+104
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+104
-103
lines changed

cli/__snapshots__/cli_spec.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ exports['shows help for open --foo 1'] = `
1818
Options:
1919
-b, --browser <browser-path> path to a custom browser to be added to the
2020
list of available browsers in Cypress
21+
--component runs component tests
2122
-c, --config <config> sets configuration values. separate multiple
2223
values with a comma. overrides any value in
2324
cypress.json.
24-
--ct, --component runs component tests
2525
-C, --config-file <config-file> path to JSON file where configuration values
2626
are set. defaults to "cypress.json". pass
2727
"false" to disable.
@@ -66,7 +66,7 @@ exports['shows help for run --foo 1'] = `
6666
Options:
6767
-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.
6868
--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
69-
--ct, --component runs component tests
69+
--component runs component tests
7070
-c, --config <config> sets configuration values. separate multiple values with a comma. overrides any value in cypress.json.
7171
-C, --config-file <config-file> path to JSON file where configuration values are set. defaults to "cypress.json". pass "false" to disable.
7272
--e2e runs end to end tests
@@ -218,9 +218,9 @@ exports['cli help command shows help 1'] = `
218218
open [options] Opens Cypress in the interactive GUI.
219219
run [options] Runs Cypress tests from the CLI without the GUI
220220
open-ct [options] Opens Cypress component testing interactive mode.
221-
Deprecated: use "open --ct"
221+
Deprecated: use "open --component"
222222
run-ct [options] Runs all Cypress component testing suites. Deprecated:
223-
use "run --ct"
223+
use "run --component"
224224
install [options] Installs the Cypress executable matching this package's
225225
version
226226
verify [options] Verifies that Cypress is installed correctly and
@@ -258,9 +258,9 @@ exports['cli help command shows help for -h 1'] = `
258258
open [options] Opens Cypress in the interactive GUI.
259259
run [options] Runs Cypress tests from the CLI without the GUI
260260
open-ct [options] Opens Cypress component testing interactive mode.
261-
Deprecated: use "open --ct"
261+
Deprecated: use "open --component"
262262
run-ct [options] Runs all Cypress component testing suites. Deprecated:
263-
use "run --ct"
263+
use "run --component"
264264
install [options] Installs the Cypress executable matching this package's
265265
version
266266
verify [options] Verifies that Cypress is installed correctly and
@@ -298,9 +298,9 @@ exports['cli help command shows help for --help 1'] = `
298298
open [options] Opens Cypress in the interactive GUI.
299299
run [options] Runs Cypress tests from the CLI without the GUI
300300
open-ct [options] Opens Cypress component testing interactive mode.
301-
Deprecated: use "open --ct"
301+
Deprecated: use "open --component"
302302
run-ct [options] Runs all Cypress component testing suites. Deprecated:
303-
use "run --ct"
303+
use "run --component"
304304
install [options] Installs the Cypress executable matching this package's
305305
version
306306
verify [options] Verifies that Cypress is installed correctly and
@@ -339,9 +339,9 @@ exports['cli unknown command shows usage and exits 1'] = `
339339
open [options] Opens Cypress in the interactive GUI.
340340
run [options] Runs Cypress tests from the CLI without the GUI
341341
open-ct [options] Opens Cypress component testing interactive mode.
342-
Deprecated: use "open --ct"
342+
Deprecated: use "open --component"
343343
run-ct [options] Runs all Cypress component testing suites. Deprecated:
344-
use "run --ct"
344+
use "run --component"
345345
install [options] Installs the Cypress executable matching this package's
346346
version
347347
verify [options] Verifies that Cypress is installed correctly and
@@ -466,9 +466,9 @@ exports['cli CYPRESS_INTERNAL_ENV allows and warns when staging environment 1']
466466
open [options] Opens Cypress in the interactive GUI.
467467
run [options] Runs Cypress tests from the CLI without the GUI
468468
open-ct [options] Opens Cypress component testing interactive mode.
469-
Deprecated: use "open --ct"
469+
Deprecated: use "open --component"
470470
run-ct [options] Runs all Cypress component testing suites. Deprecated:
471-
use "run --ct"
471+
use "run --component"
472472
install [options] Installs the Cypress executable matching this package's
473473
version
474474
verify [options] Verifies that Cypress is installed correctly and

cli/lib/cli.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ const addCypressRunCommand = (program) => {
250250
.description('Runs Cypress tests from the CLI without the GUI')
251251
.option('-b, --browser <browser-name-or-path>', text('browserRunMode'))
252252
.option('--ci-build-id <id>', text('ciBuildId'))
253-
.option('--ct, --component', text('component'))
253+
.option('--component', text('component'))
254254
.option('-c, --config <config>', text('config'))
255255
.option('-C, --config-file <config-file>', text('configFile'))
256256
.option('--e2e', text('e2e'))
@@ -389,8 +389,8 @@ module.exports = {
389389
.usage('[options]')
390390
.description('Opens Cypress in the interactive GUI.')
391391
.option('-b, --browser <browser-path>', text('browserOpenMode'))
392+
.option('--component', text('component'))
392393
.option('-c, --config <config>', text('config'))
393-
.option('--ct, --component', text('component'))
394394
.option('-C, --config-file <config-file>', text('configFile'))
395395
.option('-d, --detached [bool]', text('detached'), coerceFalse)
396396
.option('--e2e', text('e2e'))
@@ -419,7 +419,7 @@ module.exports = {
419419
program
420420
.command('open-ct')
421421
.usage('[options]')
422-
.description('Opens Cypress component testing interactive mode. Deprecated: use "open --ct"')
422+
.description('Opens Cypress component testing interactive mode. Deprecated: use "open --component"')
423423
.option('-b, --browser <browser-path>', text('browserOpenMode'))
424424
.option('-c, --config <config>', text('config'))
425425
.option('-C, --config-file <config-file>', text('configFile'))
@@ -432,9 +432,10 @@ module.exports = {
432432
.action((opts) => {
433433
debug('opening Cypress')
434434

435-
let msg = `
435+
const msg = `
436436
${logSymbols.warning} Warning: open-ct is deprecated and will be removed in a future release.
437-
Use \`open --ct\` or \`open --component\` instead.
437+
438+
Use \`open --component\` instead.
438439
`
439440

440441
logger.log()
@@ -449,7 +450,7 @@ module.exports = {
449450
program
450451
.command('run-ct')
451452
.usage('[options]')
452-
.description('Runs all Cypress component testing suites. Deprecated: use "run --ct"')
453+
.description('Runs all Cypress component testing suites. Deprecated: use "run --component"')
453454
.option('-b, --browser <browser-name-or-path>', text('browserRunMode'))
454455
.option('--ci-build-id <id>', text('ciBuildId'))
455456
.option('-c, --config <config>', text('config'))
@@ -473,14 +474,14 @@ module.exports = {
473474
.action((opts) => {
474475
debug('running Cypress run-ct')
475476

476-
let msg = `
477+
const msg = `
477478
${logSymbols.warning} Warning: run-ct is deprecated and will be removed in a future release.
478-
Use \`run --ct\` or \`run --component\` instead.
479+
Use \`run --component\` instead.
479480
`
480481

481-
logger.log()
482+
logger.warn()
482483
logger.warn(stripIndent(msg))
483-
logger.log()
484+
logger.warn()
484485

485486
require('./exec/run')
486487
.start({ ...util.parseOpts(opts), testingType: 'component' })

cli/test/lib/cli_spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ describe('cli', () => {
629629
})
630630

631631
it('spawns server with correct args for component-testing', () => {
632-
this.exec('open --ct --dev')
632+
this.exec('open --component --dev')
633633
expect(spawn.start.firstCall.args[0]).to.include('--testing-type')
634634
expect(spawn.start.firstCall.args[0]).to.include('component')
635635
})
@@ -641,7 +641,7 @@ describe('cli', () => {
641641
})
642642

643643
it('runs server with correct args for component-testing', () => {
644-
this.exec('run --ct --dev')
644+
this.exec('run --component --dev')
645645
expect(spawn.start.firstCall.args[0]).to.include('--testing-type')
646646
expect(spawn.start.firstCall.args[0]).to.include('component')
647647
})

cli/test/lib/exec/run_spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ describe('exec run', function () {
197197
})
198198
})
199199

200-
it('spawns with --testing-type component when given --ct', function () {
201-
return run.start({ ct: true })
200+
it('spawns with --testing-type component when given --component', function () {
201+
return run.start({ component: true })
202202
.then(() => {
203203
expect(spawn.start).to.be.calledWith(['--run-project', process.cwd(), '--testing-type', 'component'])
204204
})

cli/types/cypress.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ declare namespace Cypress {
143143

144144
/**
145145
* Spec type for the given test. "integration" is the default, but
146-
* tests run using `open --ct` will be "component"
146+
* tests run using `open --component` will be "component"
147147
*
148148
* @see https://on.cypress.io/experiments
149149
*/

npm/angular/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"scripts": {
88
"build": "tsc --project tsconfig.lib.json",
99
"watch": "tsc --project tsconfig.lib.json -w",
10-
"cy:open": "node ../../scripts/cypress.js open --ct",
11-
"cy:run": "node ../../scripts/cypress.js run --ct",
10+
"cy:open": "node ../../scripts/cypress.js open --component",
11+
"cy:run": "node ../../scripts/cypress.js run --component",
1212
"ng": "ng",
1313
"app-start": "ng serve",
1414
"app-build": "ng build",

npm/create-cypress-tests/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function printCypressCommandsHelper (options: { shouldSetupComponentTesting: boo
6464
printCommand('cypress run', 'Runs tests in headless mode.')
6565

6666
if (options.shouldSetupComponentTesting) {
67-
printCommand('cypress open --ct', 'Opens Cypress component testing interactive mode.')
67+
printCommand('cypress open --component', 'Opens Cypress component testing interactive mode.')
6868
printCommand('cypress run-ct', 'Runs all Cypress component testing suites.')
6969
}
7070
}

npm/design-system/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"build-prod": "yarn build",
99
"build-storybook": "build-storybook",
1010
"build-style-types": "tsm \"src/css/derived/*.scss\" --nameFormat none --exportType default",
11-
"cy:open": "node ../../scripts/cypress.js open --ct --project ${PWD}",
11+
"cy:open": "node ../../scripts/cypress.js open --component --project ${PWD}",
1212
"cy:open:debug": "node --inspect-brk ../../scripts/start.js --component-testing --project ${PWD}",
13-
"cy:run": "node ../../scripts/cypress.js run --ct --project ${PWD}",
13+
"cy:run": "node ../../scripts/cypress.js run --component --project ${PWD}",
1414
"cy:run:debug": "node --inspect-brk ../../scripts/start.js --component-testing --run-project ${PWD}",
1515
"storybook": "start-storybook -p 6006",
1616
"test": "yarn cy:run",

npm/react/examples/a11y/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "Testing component accessibility",
44
"private": true,
55
"scripts": {
6-
"cy:open": "node ../../../../scripts/cypress open --ct",
7-
"test": "node ../../../../scripts/cypress run --ct"
6+
"cy:open": "node ../../../../scripts/cypress open --component",
7+
"test": "node ../../../../scripts/cypress run --component"
88
},
99
"devDependencies": {
1010
"@cypress/react": "file:../../dist",

npm/react/examples/craco/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"cy:open": "node ../../../../scripts/cypress open --ct",
7-
"test": "node ../../../../scripts/cypress run --ct",
6+
"cy:open": "node ../../../../scripts/cypress open --component",
7+
"test": "node ../../../../scripts/cypress run --component",
88
"start": "craco start",
99
"build": "craco build"
1010
},

npm/react/examples/find-webpack/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Most tests will start with `mount` from `@cypress/react`. This is similar to `re
7171
Open the component testing runner with:
7272

7373
```sh
74-
yarn cypress open --ct
74+
yarn cypress open --component
7575
```
7676

7777
And select the spec to run.
@@ -80,7 +80,7 @@ And select the spec to run.
8080

8181
Try making a change - the tests will re-run instantly. You not only immediately know if the test passed or failed, but be able to visually inspect and debug any changes.
8282

83-
You can run all the specs with `yarn cypress run --ct`. This is useful for executing all the specs in a CI environment, or one last check before you commit and push your code!
83+
You can run all the specs with `yarn cypress run --component`. This is useful for executing all the specs in a CI environment, or one last check before you commit and push your code!
8484

8585
## Discussion
8686

npm/react/examples/find-webpack/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "1.0.0",
44
"private": true,
55
"scripts": {
6-
"cy:open": "node ../../../../scripts/cypress open --ct",
7-
"test": "node ../../../../scripts/cypress run --ct"
6+
"cy:open": "node ../../../../scripts/cypress open --component",
7+
"test": "node ../../../../scripts/cypress run --component"
88
},
99
"dependencies": {
1010
"@types/react": "^17.0.0",

npm/react/examples/nextjs-webpack-5/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"cy:open": "node ../../../../scripts/cypress open --ct",
6+
"cy:open": "node ../../../../scripts/cypress open --component",
77
"dev": "next",
88
"start": "next start",
9-
"test": "node ../../../../scripts/cypress run --ct"
9+
"test": "node ../../../../scripts/cypress run --component"
1010
},
1111
"dependencies": {
1212
"next": "10.1.3",

npm/react/examples/nextjs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"build": "next build",
77
"build:static": "next build && next out",
88
"check-coverage": "check-coverage components/Search.jsx && check-coverage pages/index.js && check-coverage pages/router.js",
9-
"cy:open": "node ../../../../scripts/cypress open --ct",
9+
"cy:open": "node ../../../../scripts/cypress open --component",
1010
"dev": "next",
1111
"only-covered": "only-covered components/Search.jsx pages/index.js pages/router.js",
1212
"start": "next start",
13-
"test": "node ../../../../scripts/cypress run --ct"
13+
"test": "node ../../../../scripts/cypress run --component"
1414
},
1515
"devDependencies": {
1616
"@cypress/react": "file:../../dist",

npm/react/examples/react-scripts-folder/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"private": true,
66
"scripts": {
77
"check-coverage": "check-coverage src/App.js src/calc.js src/Child.js",
8-
"cy:open": "node ../../../../scripts/cypress open --ct",
8+
"cy:open": "node ../../../../scripts/cypress open --component",
99
"only-covered": "only-covered src/App.js src/calc.js src/Child.js",
10-
"test": "node ../../../../scripts/cypress run --ct"
10+
"test": "node ../../../../scripts/cypress run --component"
1111
},
1212
"devDependencies": {
1313
"@cypress/react": "file:../../dist",

npm/react/examples/react-scripts-typescript/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"private": true,
33
"scripts": {
4-
"cy:open": "node ../../../../scripts/cypress open --ct",
4+
"cy:open": "node ../../../../scripts/cypress open --component",
55
"start": "react-scripts start",
6-
"test": "node ../../../../scripts/cypress run --ct"
6+
"test": "node ../../../../scripts/cypress run --component"
77
},
88
"dependencies": {
99
"react": "^17.0.1",

npm/react/examples/react-scripts/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"private": true,
55
"scripts": {
66
"check-coverage": "check-coverage src/App.js src/calc.js src/Child.js src/services.js src/RemotePizza.js cypress/fixtures/add.js",
7-
"cy:open": "node ../../../../scripts/cypress open --ct",
7+
"cy:open": "node ../../../../scripts/cypress open --component",
88
"only-covered": "only-covered src/App.js src/calc.js src/Child.js src/services.js src/RemotePizza.js cypress/fixtures/add.js",
99
"start": "react-scripts start",
10-
"test": "node ../../../../scripts/cypress run --ct"
10+
"test": "node ../../../../scripts/cypress run --component"
1111
},
1212
"devDependencies": {
1313
"@cypress/react": "file:../../dist",

npm/react/examples/sass-and-ts/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"private": true,
55
"scripts": {
66
"check-coverage": "check-coverage src/App.tsx",
7-
"cy:open": "node ../../../../scripts/cypress open --ct",
7+
"cy:open": "node ../../../../scripts/cypress open --component",
88
"only-covered": "only-covered src/App.tsx",
9-
"test": "node ../../../../scripts/cypress run --ct"
9+
"test": "node ../../../../scripts/cypress run --component"
1010
},
1111
"dependencies": {
1212
"sass-loader": "10.0.2"

npm/react/examples/snapshots/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"private": true,
55
"scripts": {
66
"check-coverage": "check-coverage src/App.js",
7-
"cy:open": "node ../../../../scripts/cypress open --ct",
7+
"cy:open": "node ../../../../scripts/cypress open --component",
88
"only-covered": "only-covered src/App.js",
9-
"test": "node ../../../../scripts/cypress run --ct"
9+
"test": "node ../../../../scripts/cypress run --component"
1010
},
1111
"devDependencies": {
1212
"@cypress/react": "file:../../dist",

npm/react/examples/tailwind/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"scripts": {
66
"build:css": "tailwindcss build src/styles/tailwind.css -o src/styles/main.generated.css",
77
"precy:open": "npm run build:css",
8-
"cy:open": "node ../../../../scripts/cypress open --ct",
8+
"cy:open": "node ../../../../scripts/cypress open --component",
99
"pretest": "npm run build:css",
10-
"test": "node ../../../../scripts/cypress run --ct"
10+
"test": "node ../../../../scripts/cypress run --component"
1111
},
1212
"devDependencies": {
1313
"@cypress/react": "file:../../dist",

npm/react/examples/using-babel-typescript/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "Component testing for TypeScript projects using Babel config",
44
"private": true,
55
"scripts": {
6-
"cy:open": "node ../../../../scripts/cypress open --ct",
7-
"test": "node ../../../../scripts/cypress run --ct"
6+
"cy:open": "node ../../../../scripts/cypress open --component",
7+
"test": "node ../../../../scripts/cypress run --component"
88
},
99
"devDependencies": {
1010
"@babel/core": "7.4.5",

npm/react/examples/using-babel/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "Component testing for projects using Babel config",
44
"private": true,
55
"scripts": {
6-
"cy:open": "node ../../../../scripts/cypress open --ct",
7-
"test": "node ../../../../scripts/cypress run --ct"
6+
"cy:open": "node ../../../../scripts/cypress open --component",
7+
"test": "node ../../../../scripts/cypress run --component"
88
},
99
"devDependencies": {
1010
"@babel/core": "7.4.5",

0 commit comments

Comments
 (0)