Skip to content

Commit b52ac98

Browse files
renovate[bot]renovate-botflotwig
authored
feat(deps): update dependency electron to version 12.x 🌟 (#15292)
Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Zach Bloomquist <git@chary.us>
1 parent c449775 commit b52ac98

File tree

36 files changed

+181
-380
lines changed

36 files changed

+181
-380
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ npm/**/cypress/screenshots
3131
# from example
3232
packages/example/app
3333
packages/example/build
34-
packages/example/cypress
34+
packages/example/cypress/integration
3535

3636
# from server
3737
packages/server/.cy

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.18.3
1+
14.16.0

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ branches:
99
# https://www.appveyor.com/docs/lang/nodejs-iojs/
1010
environment:
1111
# use matching version of Node.js
12-
nodejs_version: "12.18.3"
12+
nodejs_version: "14.16.0"
1313
# encode secure variables which will NOT be used
1414
# in pull requests
1515
# https://www.appveyor.com/docs/build-configuration/#secure-variables

circle.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ executors:
4444
# the Docker image with Cypress dependencies and Chrome browser
4545
cy-doc:
4646
docker:
47-
- image: cypress/browsers:node12.18.3-chrome83-ff77
47+
- image: cypress/browsers:node14.16.0-chrome89-ff77
4848
environment:
4949
PLATFORM: linux
5050

5151
# Docker image with non-root "node" user
5252
non-root-docker-user:
5353
docker:
54-
- image: cypress/browsers:node12.18.3-chrome83-ff77
54+
- image: cypress/browsers:node14.16.0-chrome89-ff77
5555
user: node
5656
environment:
5757
PLATFORM: linux
@@ -62,7 +62,7 @@ executors:
6262
mac:
6363
macos:
6464
# Executor should have Node >= required version
65-
xcode: "11.3.1"
65+
xcode: "12.2.0"
6666
environment:
6767
PLATFORM: mac
6868

cli/__snapshots__/spawn_spec.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ exports['lib/exec/spawn .start forces colors and streams when supported 1'] = {
44
"MOCHA_COLORS": "1",
55
"FORCE_STDIN_TTY": "1",
66
"FORCE_STDOUT_TTY": "1",
7-
"FORCE_STDERR_TTY": "1",
8-
"NODE_OPTIONS": "--max-http-header-size=1048576"
7+
"FORCE_STDERR_TTY": "1"
98
}
109

1110
exports['lib/exec/spawn .start does not force colors and streams when not supported 1'] = {
1211
"FORCE_COLOR": "0",
1312
"DEBUG_COLORS": "0",
1413
"FORCE_STDIN_TTY": "0",
1514
"FORCE_STDOUT_TTY": "0",
16-
"FORCE_STDERR_TTY": "0",
17-
"NODE_OPTIONS": "--max-http-header-size=1048576"
15+
"FORCE_STDERR_TTY": "0"
1816
}
1917

2018
exports['lib/exec/spawn .start detects kill signal exits with error on SIGKILL 1'] = `

cli/lib/util.js

-26
Original file line numberDiff line numberDiff line change
@@ -281,35 +281,9 @@ const util = {
281281
.mapValues((value) => { // stringify to 1 or 0
282282
return value ? '1' : '0'
283283
})
284-
.extend(util.getNodeOptions(options))
285284
.value()
286285
},
287286

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

cli/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@cypress/listr-verbose-renderer": "^0.4.1",
2424
"@cypress/request": "^2.88.5",
2525
"@cypress/xvfb": "^1.2.4",
26-
"@types/node": "^12.12.50",
26+
"@types/node": "^14.14.31",
2727
"@types/sinonjs__fake-timers": "^6.0.2",
2828
"@types/sizzle": "^2.3.2",
2929
"arch": "^2.2.0",
@@ -38,7 +38,7 @@
3838
"dayjs": "^1.10.4",
3939
"debug": "4.3.2",
4040
"eventemitter2": "^6.4.3",
41-
"execa": "^5.0.0",
41+
"execa": "4.1.0",
4242
"executable": "^4.1.1",
4343
"extract-zip": "^1.7.0",
4444
"fs-extra": "^9.1.0",

cli/test/lib/util_spec.js

-44
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ require('../spec_helper')
33
const os = require('os')
44
const tty = require('tty')
55
const snapshot = require('../support/snapshot')
6-
const mockedEnv = require('mocked-env')
76
const supportsColor = require('supports-color')
87
const proxyquire = require('proxyquire')
98
const hasha = require('hasha')
@@ -12,9 +11,6 @@ const la = require('lazy-ass')
1211
const util = require(`${lib}/util`)
1312
const logger = require(`${lib}/logger`)
1413

15-
// https://github.com/cypress-io/cypress/issues/5431
16-
const expectedNodeOptions = `--max-http-header-size=${1024 * 1024}`
17-
1814
describe('util', () => {
1915
beforeEach(() => {
2016
sinon.stub(process, 'exit')
@@ -217,7 +213,6 @@ describe('util', () => {
217213
FORCE_COLOR: '1',
218214
DEBUG_COLORS: '1',
219215
MOCHA_COLORS: '1',
220-
NODE_OPTIONS: expectedNodeOptions,
221216
})
222217

223218
util.supportsColor.returns(false)
@@ -229,46 +224,7 @@ describe('util', () => {
229224
FORCE_STDERR_TTY: '0',
230225
FORCE_COLOR: '0',
231226
DEBUG_COLORS: '0',
232-
NODE_OPTIONS: expectedNodeOptions,
233-
})
234-
})
235-
})
236-
237-
context('.getNodeOptions', () => {
238-
let restoreEnv
239-
240-
afterEach(() => {
241-
if (restoreEnv) {
242-
restoreEnv()
243-
restoreEnv = null
244-
}
245-
})
246-
247-
it('adds required NODE_OPTIONS', () => {
248-
restoreEnv = mockedEnv({
249-
NODE_OPTIONS: undefined,
250227
})
251-
252-
expect(util.getNodeOptions({})).to.deep.eq({
253-
NODE_OPTIONS: expectedNodeOptions,
254-
})
255-
})
256-
257-
it('includes existing NODE_OPTIONS', () => {
258-
restoreEnv = mockedEnv({
259-
NODE_OPTIONS: '--foo --bar',
260-
})
261-
262-
expect(util.getNodeOptions({})).to.deep.eq({
263-
NODE_OPTIONS: `${expectedNodeOptions} --foo --bar`,
264-
ORIGINAL_NODE_OPTIONS: '--foo --bar',
265-
})
266-
})
267-
268-
it('does not return if dev is set and version < 12', () => {
269-
expect(util.getNodeOptions({
270-
dev: true,
271-
}, 11)).to.be.undefined
272228
})
273229
})
274230

npm/design-system/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"build": "rimraf dist && yarn rollup -c rollup.config.js",
88
"build-prod": "yarn build",
99
"cy:open": "node ../../scripts/cypress.js open-ct --project ${PWD}",
10-
"cy:open:debug": "NODE_OPTIONS=--max-http-header-size=1048576 node --inspect-brk ../../scripts/start.js --component-testing --project ${PWD}",
10+
"cy:open:debug": "node --inspect-brk ../../scripts/start.js --component-testing --project ${PWD}",
1111
"cy:run": "node ../../scripts/cypress.js run-ct --project ${PWD}",
12-
"cy:run:debug": "NODE_OPTIONS=--max-http-header-size=1048576 node --inspect-brk ../../scripts/start.js --component-testing --run-project ${PWD}",
12+
"cy:run:debug": "node --inspect-brk ../../scripts/start.js --component-testing --run-project ${PWD}",
1313
"pretest": "yarn transpile",
1414
"test": "yarn cy:run",
1515
"transpile": "tsc",
@@ -29,7 +29,7 @@
2929
"@rollup/plugin-commonjs": "^17.1.0",
3030
"@rollup/plugin-json": "^4.1.0",
3131
"@rollup/plugin-node-resolve": "^11.1.1",
32-
"@types/node": "12.12.50",
32+
"@types/node": "14.14.31",
3333
"@types/semver": "7.3.4",
3434
"babel-loader": "8.0.6",
3535
"css-loader": "2.1.1",

npm/react/cypress/component/basic/error-boundary-spec.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,20 @@ describe('Error Boundary', () => {
2929
})
3030

3131
it('on error, display fallback UI', () => {
32-
try {
33-
mount(
34-
<ErrorBoundary name="ChildWithError">
35-
<ChildWithError />
36-
</ErrorBoundary>,
37-
)
38-
} catch (e) {
39-
// do nothing
40-
}
32+
// Error boundaries do not stop an uncaught error from propagating.
33+
// Cypress will fail on uncaught exceptions by default, so we need to suppress that behavior.
34+
cy.on('uncaught:exception', (err) => {
35+
// Assert that we are only suppressing the default behavior for the error we expect.
36+
expect(err.message.includes('I crashed!')).to.be.true
37+
38+
return false
39+
})
40+
41+
mount(
42+
<ErrorBoundary name="ChildWithError">
43+
<ChildWithError />
44+
</ErrorBoundary>,
45+
)
4146

4247
cy.get('header h1').should('contain', 'Something went wrong.')
4348
cy.get('header h3').should('contain', 'ChildWithError failed to load')

npm/react/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"build": "rimraf dist && yarn rollup -c rollup.config.js",
88
"build-prod": "yarn build",
99
"cy:open": "node ../../scripts/cypress.js open-ct --project ${PWD}",
10-
"cy:open:debug": "NODE_OPTIONS=--max-http-header-size=1048576 node --inspect-brk ../../scripts/start.js --component-testing --project ${PWD}",
10+
"cy:open:debug": "node --inspect-brk ../../scripts/start.js --component-testing --project ${PWD}",
1111
"cy:run": "node ../../scripts/cypress.js run-ct --project ${PWD}",
12-
"cy:run:debug": "NODE_OPTIONS=--max-http-header-size=1048576 node --inspect-brk ../../scripts/start.js --component-testing --run-project ${PWD}",
12+
"cy:run:debug": "node --inspect-brk ../../scripts/start.js --component-testing --run-project ${PWD}",
1313
"pretest": "yarn transpile",
1414
"test": "yarn cy:run",
1515
"test-ci": "node run-tests.js",

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"@types/markdown-it": "0.0.9",
9494
"@types/mini-css-extract-plugin": "0.8.0",
9595
"@types/mocha": "8.0.3",
96-
"@types/node": "12.12.50",
96+
"@types/node": "14.14.31",
9797
"@types/prismjs": "1.16.0",
9898
"@types/ramda": "0.25.47",
9999
"@types/react": "16.9.50",
@@ -192,7 +192,7 @@
192192
"typescript": "3.7.4"
193193
},
194194
"engines": {
195-
"node": ">=12.18.3",
195+
"node": ">=14.16.0",
196196
"yarn": ">=1.17.3"
197197
},
198198
"productName": "Cypress",

packages/driver/src/cypress/cy.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const setTopOnError = function (Cypress, cy, errors) {
9393
const isSpecError = $errUtils.isSpecError(Cypress.config('spec'), err)
9494

9595
if (isSpecError) {
96-
return curCy.onSpecWindowUncaughtException(handlerType, err)
96+
return curCy.onSpecWindowUncaughtException(handlerType, err, promise)
9797
}
9898

9999
return curCy.onUncaughtException(handlerType, err, promise)
@@ -1222,13 +1222,24 @@ const create = function (specWindow, Cypress, Cookies, state, config, log) {
12221222
snapshots.onBeforeWindowLoad()
12231223
},
12241224

1225-
onSpecWindowUncaughtException (handlerType, err) {
1225+
onSpecWindowUncaughtException (handlerType, err, promise) {
12261226
err = errors.createUncaughtException('spec', handlerType, err)
12271227

12281228
const runnable = state('runnable')
12291229

12301230
if (!runnable) return err
12311231

1232+
if (config('componentTesting')) {
1233+
// in component testing, uncaught exceptions should be catchable, as there is no AUT
1234+
const results = Cypress.action('app:uncaught:exception', err, runnable, promise)
1235+
1236+
// dont do anything if any of our uncaught:exception
1237+
// listeners returned false
1238+
if (_.some(results, returnedFalse)) {
1239+
return
1240+
}
1241+
}
1242+
12321243
try {
12331244
fail(err)
12341245
} catch (failErr) {

packages/electron/lib/electron.js

-4
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ module.exports = {
128128
}
129129
}
130130

131-
// max HTTP header size 8kb -> 1mb
132-
// https://github.com/cypress-io/cypress/issues/76
133-
argv.unshift(`--max-http-header-size=${1024 * 1024}`)
134-
135131
debug('spawning %s with args', execPath, argv)
136132

137133
if (debug.enabled) {

packages/electron/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"minimist": "1.2.5"
2525
},
2626
"devDependencies": {
27-
"electron": "11.3.0",
27+
"electron": "12.0.0",
2828
"execa": "4.1.0",
2929
"mocha": "3.5.3"
3030
},

packages/https-proxy/lib/ca.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class CA {
269269
}
270270

271271
writeCAVersion () {
272-
return fs.outputFileAsync(this.getCAVersionPath(), CA_VERSION)
272+
return fs.outputFileAsync(this.getCAVersionPath(), String(CA_VERSION))
273273
}
274274

275275
assertMinimumCAVersion () {

packages/https-proxy/lib/server.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const _ = require('lodash')
2-
const { allowDestroy, connect } = require('@packages/network')
2+
const { allowDestroy, connect, httpUtils } = require('@packages/network')
33
const debug = require('debug')('cypress:https-proxy')
44
const https = require('https')
55
const net = require('net')
@@ -227,7 +227,10 @@ class Server {
227227

228228
_listenHttpsServer (data) {
229229
return new Promise((resolve, reject) => {
230-
const server = https.createServer(data)
230+
const server = https.createServer({
231+
...data,
232+
...httpUtils.lenientOptions,
233+
})
231234

232235
allowDestroy(server)
233236

packages/network/lib/agent.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import net from 'net'
66
import { getProxyForUrl } from 'proxy-from-env'
77
import url from 'url'
88
import { createRetryingSocket, getAddress } from './connect'
9+
import { lenientOptions } from './http-utils'
910

1011
const debug = debugModule('cypress:network:agent')
1112
const CRLF = '\r\n'
@@ -151,9 +152,7 @@ export class CombinedAgent {
151152

152153
// called by Node.js whenever a new request is made internally
153154
addRequest (req: http.ClientRequest, options: http.RequestOptions, port?: number, localAddress?: string) {
154-
// allow requests which contain invalid/malformed headers
155-
// https://github.com/cypress-io/cypress/issues/5602
156-
req.insecureHTTPParser = true
155+
_.merge(req, lenientOptions)
157156

158157
// Legacy API: addRequest(req, host, port, localAddress)
159158
// https://github.com/nodejs/node/blob/cb68c04ce1bc4534b2d92bc7319c6ff6dda0180d/lib/_http_agent.js#L148-L155

packages/network/lib/http-utils.ts

+15
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,18 @@ const NO_BODY_STATUS_CODES = [204, 304]
99
export function responseMustHaveEmptyBody (req: IncomingMessage, res: IncomingMessage) {
1010
return _.includes(NO_BODY_STATUS_CODES, res.statusCode) || (req.method && req.method.toLowerCase() === 'head')
1111
}
12+
13+
/**
14+
* HTTP options to make Node.js's HTTP libraries behave as leniently as possible.
15+
*
16+
* These should be used whenever Cypress is processing "real-world" HTTP requests - like when setting up a proxy
17+
* server or sending outgoing requests.
18+
*/
19+
export const lenientOptions = {
20+
// increase header buffer for incoming response (ClientRequest) request (Server) headers, from 16KB to 1MB
21+
// @see https://github.com/cypress-io/cypress/issues/76
22+
maxHeaderSize: 1024 ** 2,
23+
// allow requests which contain invalid/malformed headers
24+
// https://github.com/cypress-io/cypress/issues/5602
25+
insecureHTTPParser: true,
26+
}

0 commit comments

Comments
 (0)