Skip to content

Commit 19c6a24

Browse files
committed
Merge branch 'develop' into patch-3
2 parents 50ea3bc + d307e30 commit 19c6a24

File tree

274 files changed

+6317
-3820
lines changed

Some content is hidden

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

274 files changed

+6317
-3820
lines changed

circle.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ executors:
4242
# the Docker image with Cypress dependencies and Chrome browser
4343
cy-doc:
4444
docker:
45-
- image: cypress/browsers:node12.8.1-chrome80-ff72
45+
- image: cypress/browsers:node12.13.0-chrome80-ff74
4646
environment:
4747
PLATFORM: linux
4848

@@ -319,10 +319,10 @@ jobs:
319319
command: ls -la types
320320
working_directory: cli
321321
- run:
322-
command: ls -la chai
323-
working_directory: cli/types
322+
# Run dtslint, but permit failures for now as per https://github.com/cypress-io/cypress/pull/6819
323+
command: yarn lerna exec --scope cypress "yarn dtslint" || true
324324
- run:
325-
command: yarn lerna exec --scope cypress "yarn dtslint"
325+
command: yarn type-check --ignore-progress
326326
- store-npm-logs
327327

328328
"server-unit-tests":
@@ -610,6 +610,11 @@ jobs:
610610
at: ~/
611611
- run:
612612
command: yarn workspace @packages/desktop-gui build-prod
613+
- run:
614+
name: Desktop GUI server
615+
command: yarn start
616+
working_directory: packages/desktop-gui
617+
background: true
613618
- run:
614619
command: |
615620
CYPRESS_KONFIG_ENV=production \
@@ -621,6 +626,27 @@ jobs:
621626
path: /tmp/artifacts
622627
- store-npm-logs
623628

629+
desktop-gui-visual-tests:
630+
<<: *defaults
631+
parallelism: 1
632+
steps:
633+
- attach_workspace:
634+
at: ~/
635+
- run:
636+
command: yarn lerna exec --scope @packages/desktop-gui "yarn build-prod"
637+
- run:
638+
name: Desktop GUI server
639+
command: yarn start
640+
working_directory: packages/desktop-gui
641+
background: true
642+
- run:
643+
# will use PERCY_TOKEN environment variable if available
644+
command: |
645+
CYPRESS_KONFIG_ENV=production \
646+
yarn lerna exec --scope @packages/desktop-gui "yarn percy exec -- yarn cypress:run --spec cypress/integration/settings_spec.js"
647+
# we don't really need any artifacts - we are only interested in visual screenshots
648+
- store-npm-logs
649+
624650
"reporter-integration-tests":
625651
<<: *defaults
626652
steps:
@@ -1232,6 +1258,9 @@ linux-workflow: &linux-workflow
12321258
- desktop-gui-integration-tests-2x:
12331259
requires:
12341260
- build
1261+
- desktop-gui-visual-tests:
1262+
requires:
1263+
- build
12351264
- reporter-integration-tests:
12361265
requires:
12371266
- build
@@ -1444,6 +1473,7 @@ mac-workflow: &mac-workflow
14441473
- post-pre-release-install-comment:
14451474
context: test-runner:commit-status-checks
14461475
name: Post Mac pre-release install comment
1476+
executor: mac
14471477
filters:
14481478
branches:
14491479
only:

cli/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ yarn test-debug --scope cypress
3131

3232
This will take and compare snapshots of the CLI output. To update snapshots, see `snap-shot-it` instructions: https://github.com/bahmutov/snap-shot-it#advanced-use
3333

34+
#### Type Linting
35+
36+
When testing with `dtslint`, you may need to remove existing typescript installations before running the type linter (for instance, on OS X, you might `rm -rf ~/.dts/typescript-installs`) in order to reproduce issues with new versions of typescript (i.e., `@next`).
37+
3438
### Manual
3539

3640
To build and test an NPM package:

cli/__snapshots__/spawn_spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
exports['lib/exec/spawn .start forces colors and streams when supported 1'] = {
2+
"FORCE_COLOR": "1",
3+
"DEBUG_COLORS": "1",
4+
"MOCHA_COLORS": "1",
5+
"FORCE_STDIN_TTY": "1",
6+
"FORCE_STDOUT_TTY": "1",
7+
"FORCE_STDERR_TTY": "1",
8+
"NODE_OPTIONS": "--max-http-header-size=1048576 --http-parser=legacy"
9+
}
10+
11+
exports['lib/exec/spawn .start does not force colors and streams when not supported 1'] = {
12+
"FORCE_COLOR": "0",
13+
"DEBUG_COLORS": "0",
14+
"FORCE_STDIN_TTY": "0",
15+
"FORCE_STDOUT_TTY": "0",
16+
"FORCE_STDERR_TTY": "0",
17+
"NODE_OPTIONS": "--max-http-header-size=1048576 --http-parser=legacy"
18+
}
19+
120
exports['lib/exec/spawn .start detects kill signal exits with error on SIGKILL 1'] = `
221
The Test Runner unexpectedly exited via a exit event with signal SIGKILL
322

cli/__snapshots__/verify_spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ Cypress Version: 1.2.3
103103
`
104104

105105
exports['fails verifying Cypress 1'] = `
106-
It looks like this is your first time using Cypress: 1.2.3
107106
108107
✖ Verifying Cypress can run /cache/Cypress/1.2.3/Cypress.app
109108
STRIPPED
@@ -309,7 +308,6 @@ Opening Cypress...
309308
`
310309

311310
exports['verification with executable 1'] = `
312-
It looks like this is your first time using Cypress: 1.2.3
313311
314312
✔ Verified Cypress! /cache/Cypress/1.2.3/Cypress.app
315313

cli/lib/exec/spawn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ module.exports = {
109109
}
110110

111111
const { onStderrData, electronLogging } = overrides
112-
const envOverrides = util.getEnvOverrides()
112+
const envOverrides = util.getEnvOverrides(options)
113113
const electronArgs = _.clone(args)
114114
const node11WindowsFix = isPlatform('win32')
115115

cli/lib/tasks/download.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const os = require('os')
55
const url = require('url')
66
const path = require('path')
77
const debug = require('debug')('cypress:cli')
8-
const request = require('request')
8+
const request = require('@cypress/request')
99
const Promise = require('bluebird')
1010
const requestProgress = require('request-progress')
1111
const { stripIndent } = require('common-tags')

cli/lib/tasks/verify.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,12 @@ const runSmokeTest = (binaryDir, options) => {
168168
function testBinary (version, binaryDir, options) {
169169
debug('running binary verification check', version)
170170

171-
logger.log(stripIndent`
172-
It looks like this is your first time using Cypress: ${chalk.cyan(version)}
173-
`)
171+
// if running from 'cypress verify', don't print this message
172+
if (!options.force) {
173+
logger.log(stripIndent`
174+
It looks like this is your first time using Cypress: ${chalk.cyan(version)}
175+
`)
176+
}
174177

175178
logger.log()
176179

cli/lib/util.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const util = {
268268
return isCi
269269
},
270270

271-
getEnvOverrides () {
271+
getEnvOverrides (options = {}) {
272272
return _
273273
.chain({})
274274
.extend(util.getEnvColors())
@@ -277,9 +277,35 @@ const util = {
277277
.mapValues((value) => { // stringify to 1 or 0
278278
return value ? '1' : '0'
279279
})
280+
.extend(util.getNodeOptions(options))
280281
.value()
281282
},
282283

284+
getNodeOptions (options, nodeVersion) {
285+
if (!nodeVersion) {
286+
nodeVersion = Number(process.versions.node.split('.')[0])
287+
}
288+
289+
if (options.dev && nodeVersion < 12) {
290+
// `node` is used instead of Electron when --dev is passed, so this won't work if Node is too old
291+
debug('NODE_OPTIONS=--max-http-header-size could not be set because we\'re in dev mode and Node is < 12.0.0')
292+
293+
return
294+
}
295+
296+
// https://github.com/cypress-io/cypress/issues/5431
297+
const NODE_OPTIONS = `--max-http-header-size=${1024 ** 2} --http-parser=legacy`
298+
299+
if (_.isString(process.env.NODE_OPTIONS)) {
300+
return {
301+
NODE_OPTIONS: `${NODE_OPTIONS} ${process.env.NODE_OPTIONS}`,
302+
ORIGINAL_NODE_OPTIONS: process.env.NODE_OPTIONS || '',
303+
}
304+
}
305+
306+
return { NODE_OPTIONS }
307+
},
308+
283309
getForceTty () {
284310
return {
285311
FORCE_STDIN_TTY: util.isTty(process.stdin.fd),

cli/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@
2121
},
2222
"dependencies": {
2323
"@cypress/listr-verbose-renderer": "0.4.1",
24+
"@cypress/request": "2.88.5",
2425
"@cypress/xvfb": "1.2.4",
26+
"@types/blob-util": "1.3.3",
27+
"@types/bluebird": "3.5.29",
28+
"@types/chai": "4.2.7",
29+
"@types/chai-jquery": "1.1.40",
30+
"@types/jquery": "3.3.31",
31+
"@types/lodash": "4.14.149",
32+
"@types/minimatch": "3.0.3",
33+
"@types/mocha": "5.2.7",
34+
"@types/sinon": "7.5.1",
35+
"@types/sinon-chai": "3.2.3",
2536
"@types/sizzle": "2.3.2",
2637
"arch": "2.1.1",
2738
"bluebird": "3.7.2",
@@ -44,12 +55,11 @@
4455
"listr": "0.14.3",
4556
"lodash": "4.17.15",
4657
"log-symbols": "3.0.0",
47-
"minimist": "1.2.0",
58+
"minimist": "1.2.5",
4859
"moment": "2.24.0",
4960
"ospath": "1.2.2",
5061
"pretty-bytes": "5.3.0",
5162
"ramda": "0.26.1",
52-
"request": "2.88.0",
5363
"request-progress": "3.0.0",
5464
"supports-color": "7.1.0",
5565
"tmp": "0.1.0",
@@ -60,16 +70,6 @@
6070
"devDependencies": {
6171
"@cypress/sinon-chai": "1.1.0",
6272
"@packages/root": "*",
63-
"@types/blob-util": "1.3.3",
64-
"@types/bluebird": "3.5.29",
65-
"@types/chai": "4.2.7",
66-
"@types/chai-jquery": "1.1.40",
67-
"@types/jquery": "3.3.31",
68-
"@types/lodash": "4.14.149",
69-
"@types/minimatch": "3.0.3",
70-
"@types/mocha": "5.2.7",
71-
"@types/sinon": "7.5.1",
72-
"@types/sinon-chai": "3.2.3",
7373
"babel-cli": "6.26.0",
7474
"babel-preset-es2015": "6.24.1",
7575
"chai": "3.5.0",
@@ -83,7 +83,7 @@
8383
"mocha": "6.2.2",
8484
"mock-fs": "4.9.0",
8585
"mocked-env": "1.2.4",
86-
"nock": "9.6.1",
86+
"nock": "12.0.2",
8787
"postinstall-postinstall": "2.0.0",
8888
"proxyquire": "2.1.0",
8989
"resolve-pkg": "2.0.0",

cli/scripts/post-install.js

Lines changed: 27 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,28 @@
1-
#!/usr/bin/env node
2-
3-
const { includeTypes } = require('./utils')
4-
const shell = require('shelljs')
5-
const { join } = require('path')
6-
const resolvePkg = require('resolve-pkg')
7-
8-
shell.set('-v') // verbose
9-
shell.set('-e') // any error is fatal
10-
11-
// We include the TypeScript definitions for the bundled 3rd party tools
12-
// thus we need to copy them from "dev" dependencies into our types folder
13-
// and we need to sometimes tweak these types files to use relative paths
14-
// This ensures that globals like Cypress.$, Cypress._ etc are property typed
15-
// yet we do not install "@types/.." packages with "npm install cypress"
16-
// because they can conflict with user's own libraries
17-
18-
includeTypes.forEach((folder) => {
19-
const source = resolvePkg(`@types/${folder}`, { cwd: join(__dirname, '..', '..') })
20-
21-
shell.cp('-R', source, 'types')
1+
const fs = require('../lib/fs')
2+
const path = require('path')
3+
4+
/**
5+
* https://github.com/cypress-io/cypress/pull/5780
6+
* Folder names in "node_modules/@types" that were copied to cli/types to generate index.d.ts.
7+
* They cause type errors in type checker. So, they should be removed.
8+
*/
9+
const includeTypes = [
10+
'blob-util',
11+
'bluebird',
12+
'lodash',
13+
'mocha',
14+
'minimatch',
15+
'sinon',
16+
'sinon-chai',
17+
'chai',
18+
'chai-jquery',
19+
'jquery',
20+
]
21+
22+
includeTypes.forEach((t) => {
23+
const dir = path.join(__dirname, '../types', t)
24+
25+
if (fs.existsSync(dir)) {
26+
fs.removeSync(dir)
27+
}
2228
})
23-
24-
// jQuery v3.3.x includes "dist" folder that just references back to itself
25-
// causing dtslint to think there are double definitions. Remove that folder.
26-
const typesJqueryDistFolder = join('types', 'jquery', 'dist')
27-
28-
shell.rm('-rf', typesJqueryDistFolder)
29-
30-
// fix paths to Chai, jQuery and other types to be relative
31-
shell.sed(
32-
'-i',
33-
'<reference types="chai" />',
34-
'<reference path="../chai/index.d.ts" />',
35-
join('types', 'chai-jquery', 'index.d.ts'),
36-
)
37-
38-
shell.sed(
39-
'-i',
40-
'<reference types="jquery" />',
41-
'<reference path="../jquery/index.d.ts" />',
42-
join('types', 'chai-jquery', 'index.d.ts'),
43-
)
44-
45-
const sinonChaiFilename = join('types', 'sinon-chai', 'index.d.ts')
46-
47-
shell.sed(
48-
'-i',
49-
'<reference types="chai" />',
50-
'<reference path="../chai/index.d.ts" />',
51-
sinonChaiFilename,
52-
)
53-
54-
// also use relative import via path for sinon-chai
55-
// there is reference comment line we need to fix to be relative
56-
shell.sed(
57-
'-i',
58-
'<reference types="sinon" />',
59-
'<reference path="../sinon/index.d.ts" />',
60-
sinonChaiFilename,
61-
)
62-
63-
// and an import sinon line to be changed to relative path
64-
shell.sed('-i', 'from \'sinon\';', 'from \'../sinon\';', sinonChaiFilename)

0 commit comments

Comments
 (0)