Skip to content

Commit 8c8875b

Browse files
chore: pull forward unification changes we can make now (#20644)
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
1 parent 1bc69d1 commit 8c8875b

File tree

12 files changed

+159
-103
lines changed

12 files changed

+159
-103
lines changed

.github/CODEOWNERS

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
# Each line is a file pattern followed by one or more owners.
22

3-
# End-to-end team are owners of code within root packages concerning e2e, cli, and other utils
3+
# End-to-end team are owners of code within root packages concerning e2e testing, cli, and other utils
4+
# Component-testing team are owners of code within packages concerning component testing
5+
46
/.github/ @cypress-io/end-to-end
5-
/browser-versions.json @cypress-io/end-to-end
7+
/browser-versions.json @cypress-io/end-to-end @cypress-io/component-testing
8+
69
/cli/ @cypress-io/end-to-end
7-
/packages/coffee/ @cypress-io/end-to-end
8-
/packages/datetime-utils/ @cypress-io/end-to-end
10+
11+
/guides/ @cypress-io/end-to-end
12+
13+
/npm/angular @cypress-io/component-testing
14+
/npm/create-cypress-tests @cypress-io/component-testing
15+
/npm/cypress-schematic @cypress-io/component-testing
16+
/npm/design-system @cypress-io/component-testing
17+
/npm/eslint-plugin-dev @cypress-io/end-to-end @cypress-io/component-testing
18+
/npm/mount-utils @cypress-io/component-testing
19+
/npm/react @cypress-io/component-testing
20+
/npm/vue @cypress-io/component-testing
21+
/npm/webpack-batteries-included-preprocessor @cypress-io/end-to-end @cypress-io/component-testing
22+
/npm/webpack-dev-server @cypress-io/component-testing
23+
/npm/webpack-preprocessor @cypress-io/end-to-end @cypress-io/component-testing
24+
25+
/packages/config/ @cypress-io/end-to-end
926
/packages/desktop-gui/ @cypress-io/end-to-end
1027
/packages/driver/ @cypress-io/end-to-end
1128
/packages/electron/ @cypress-io/end-to-end
29+
/packages/errors/ @cypress-io/end-to-end @cypress-io/component-testing
1230
/packages/example/ @cypress-io/end-to-end
1331
/packages/extension/ @cypress-io/end-to-end
1432
/packages/https-proxy/ @cypress-io/end-to-end
@@ -17,14 +35,21 @@
1735
/packages/network/ @cypress-io/end-to-end
1836
/packages/proxy/ @cypress-io/end-to-end
1937
/packages/reporter/ @cypress-io/end-to-end
38+
/packages/resolve-dist/ @cypress-io/end-to-end
2039
/packages/rewriter/ @cypress-io/end-to-end
2140
/packages/root/ @cypress-io/end-to-end
2241
/packages/runner/ @cypress-io/end-to-end
42+
/packages/runner-ct/ @cypress-io/component-testing
2343
/packages/runner-shared/ @cypress-io/end-to-end
2444
/packages/server/ @cypress-io/end-to-end
2545
/packages/socket/ @cypress-io/end-to-end
2646
/packages/static/ @cypress-io/end-to-end
2747
/packages/ts/ @cypress-io/end-to-end
2848
/packages/ui-components/ @cypress-io/end-to-end
2949
/packages/web-config/ @cypress-io/end-to-end
50+
51+
/patches/ @cypress-io/end-to-end
52+
3053
/scripts/ @cypress-io/end-to-end
54+
55+
/system-tests/ @cypress-io/end-to-end @cypress-io/component-testing

.vscode/cspell.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44
"dictionaryDefinitions": [],
55
"dictionaries": [],
66
"words": [
7+
"Chainable",
8+
"composables",
9+
"ERRORED",
10+
"forcedefault",
711
"Iconify",
812
"Lachlan",
913
"msapplication",
14+
"NOTESTS",
15+
"OVERLIMIT",
1016
"Pinia",
17+
"pnpm",
1118
"Screenshotting",
1219
"shiki",
1320
"testid",
21+
"TIMEDOUT",
22+
"unconfigured",
1423
"unplugin",
24+
"unrunnable",
25+
"urql",
1526
"vite",
1627
"vitejs",
1728
"vueuse"

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
// Name: Toggle Quotes
7171
// Description: Toggle cycle " -> ' -> `
72-
"britesnow.vscode-toggle-quotes",
72+
"britesnow.vscode-toggle-quotes",
7373

7474
// Name: Gremlins tracker for Visual Studio Code
7575
// Description: When you paste from Slack, Figma, or Google Docs, you'll get stylized quotes.

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"i18n-ally.keystyle": "nested",
3737

3838
// Volar is the main extension that powers Vue's language features.
39+
// These are commented out because they slow down node development
3940
// "volar.autoCompleteRefs": false,
4041
"volar.takeOverMode.enabled": true,
4142
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
[![npm version](https://badge.fury.io/js/cypress.svg)](https://badge.fury.io/js/cypress)
4444

45-
Install Cypress for Mac, Linux, or Windows, then [get started](https://docs.cypress.io/guides/getting-started/installing-cypress.html).
45+
Install Cypress for Mac, Linux, or Windows, then [get started](https://on.cypress.io/install).
4646

4747
```bash
4848
npm install cypress --save-dev

cli/lib/cli.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,22 @@ const addCypressRunCommand = (program) => {
267267
.option('--dev', text('dev'), coerceFalse)
268268
}
269269

270+
const addCypressOpenCommand = (program) => {
271+
return program
272+
.command('open')
273+
.usage('[options]')
274+
.description('Opens Cypress in the interactive GUI.')
275+
.option('-b, --browser <browser-path>', text('browserOpenMode'))
276+
.option('-c, --config <config>', text('config'))
277+
.option('-C, --config-file <config-file>', text('configFile'))
278+
.option('-d, --detached [bool]', text('detached'), coerceFalse)
279+
.option('-e, --env <env>', text('env'))
280+
.option('--global', text('global'))
281+
.option('-p, --port <port>', text('port'))
282+
.option('-P, --project <project-path>', text('project'))
283+
.option('--dev', text('dev'), coerceFalse)
284+
}
285+
270286
/**
271287
* Casts known command line options for "cypress run" to their intended type.
272288
* For example if the user passes "--port 5005" the ".port" property should be
@@ -384,23 +400,12 @@ module.exports = {
384400
showVersions(args)
385401
})
386402

387-
program
388-
.command('open')
389-
.usage('[options]')
390-
.description('Opens Cypress in the interactive GUI.')
391-
.option('-b, --browser <browser-path>', text('browserOpenMode'))
392-
.option('-c, --config <config>', text('config'))
393-
.option('-C, --config-file <config-file>', text('configFile'))
394-
.option('-d, --detached [bool]', text('detached'), coerceFalse)
395-
.option('-e, --env <env>', text('env'))
396-
.option('--global', text('global'))
397-
.option('-p, --port <port>', text('port'))
398-
.option('-P, --project <project-path>', text('project'))
399-
.option('--dev', text('dev'), coerceFalse)
403+
addCypressOpenCommand(program)
400404
.action((opts) => {
401405
debug('opening Cypress')
402406
require('./exec/open')
403407
.start(util.parseOpts(opts))
408+
.then(util.exit)
404409
.catch(util.logErrorExit1)
405410
})
406411

@@ -430,6 +435,7 @@ module.exports = {
430435
debug('opening Cypress')
431436
require('./exec/open')
432437
.start({ ...util.parseOpts(opts), testingType: 'component' })
438+
.then(util.exit)
433439
.catch(util.logErrorExit1)
434440
})
435441

cli/lib/errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const binaryNotExecutable = (executable) => {
8080
8181
Please check that you have the appropriate user permissions.
8282
83-
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
83+
You can also try clearing the cache with 'cypress cache clear' and reinstalling.
8484
`,
8585
}
8686
}

cli/lib/exec/open.js

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,49 @@ const spawn = require('./spawn')
44
const verify = require('../tasks/verify')
55
const { processTestingType } = require('./shared')
66

7-
module.exports = {
8-
start (options = {}) {
9-
if (!util.isInstalledGlobally() && !options.global && !options.project) {
10-
options.project = process.cwd()
11-
}
7+
const processOpenOptions = (options) => {
8+
if (!util.isInstalledGlobally() && !options.global && !options.project) {
9+
options.project = process.cwd()
10+
}
1211

13-
const args = []
12+
const args = []
1413

15-
if (options.config) {
16-
args.push('--config', options.config)
17-
}
14+
if (options.config) {
15+
args.push('--config', options.config)
16+
}
1817

19-
if (options.configFile !== undefined) {
20-
args.push('--config-file', options.configFile)
21-
}
18+
if (options.configFile !== undefined) {
19+
args.push('--config-file', options.configFile)
20+
}
2221

23-
if (options.browser) {
24-
args.push('--browser', options.browser)
25-
}
22+
if (options.browser) {
23+
args.push('--browser', options.browser)
24+
}
2625

27-
if (options.env) {
28-
args.push('--env', options.env)
29-
}
26+
if (options.env) {
27+
args.push('--env', options.env)
28+
}
3029

31-
if (options.port) {
32-
args.push('--port', options.port)
33-
}
30+
if (options.port) {
31+
args.push('--port', options.port)
32+
}
3433

35-
if (options.project) {
36-
args.push('--project', options.project)
37-
}
34+
if (options.project) {
35+
args.push('--project', options.project)
36+
}
3837

39-
args.push(...processTestingType(options.testingType))
38+
args.push(...processTestingType(options.testingType))
4039

41-
debug('opening from options %j', options)
42-
debug('command line arguments %j', args)
40+
debug('opening from options %j', options)
41+
debug('command line arguments %j', args)
42+
43+
return args
44+
}
45+
46+
module.exports = {
47+
processOpenOptions,
48+
start (options = {}) {
49+
const args = processOpenOptions(options)
4350

4451
function open () {
4552
return spawn.start(args, {

cli/lib/exec/spawn.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ module.exports = {
102102
const electronArgs = []
103103
const node11WindowsFix = isPlatform('win32')
104104

105+
let startScriptPath
106+
105107
if (options.dev) {
108+
executable = 'node'
106109
// if we're in dev then reset
107110
// the launch cmd to be 'npm run dev'
108-
executable = 'node'
109-
electronArgs.unshift(
110-
path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'),
111-
)
111+
startScriptPath = path.resolve(__dirname, '..', '..', '..', 'scripts', 'start.js'),
112112

113113
debug('in dev mode the args became %o', args)
114114
}
@@ -118,6 +118,9 @@ module.exports = {
118118
}
119119

120120
// strip dev out of child process options
121+
/**
122+
* @type {import('child_process').ForkOptions}
123+
*/
121124
let stdioOptions = _.pick(options, 'env', 'detached', 'stdio')
122125

123126
// figure out if we're going to be force enabling or disabling colors.
@@ -141,9 +144,7 @@ module.exports = {
141144

142145
if (stdioOptions.env.ELECTRON_RUN_AS_NODE) {
143146
// Since we are running electron as node, we need to add an entry point file.
144-
const serverEntryPoint = path.join(state.getBinaryPkgPath(path.dirname(executable)), '..', 'index.js')
145-
146-
args = [serverEntryPoint, ...args]
147+
startScriptPath = path.join(state.getBinaryPkgPath(path.dirname(executable)), '..', 'index.js')
147148
} else {
148149
// Start arguments with "--" so Electron knows these are OUR
149150
// arguments and does not try to sanitize them. Otherwise on Windows
@@ -152,8 +153,12 @@ module.exports = {
152153
args = [...electronArgs, '--', ...args]
153154
}
154155

155-
debug('spawning Cypress with executable: %s', executable)
156+
if (startScriptPath) {
157+
args.unshift(startScriptPath)
158+
}
159+
156160
debug('spawn args %o %o', args, _.omit(stdioOptions, 'env'))
161+
debug('spawning Cypress with executable: %s', executable)
157162
const child = cp.spawn(executable, args, stdioOptions)
158163

159164
function resolveOn (event) {

cli/test/spec_helper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const mockfs = require('mock-fs')
66
const Promise = require('bluebird')
77
const util = require('../lib/util')
88
const { MockChildProcess } = require('spawn-mock')
9+
910
const _kill = MockChildProcess.prototype.kill
1011

1112
const patchMockSpawn = () => {

0 commit comments

Comments
 (0)