Skip to content

Commit 080cdce

Browse files
brian-mannkuceb
authored andcommitted
secure cookie error crash (cypress-io#2685)
- fixes cypress-io#1264 - fixes cypress-io#1321 - fixes cypress-io#1799 - fixes cypress-io#2689 - fixes cypress-io#2688 - fixes cypress-io#2687 - fixes cypress-io#2686
1 parent c6ec296 commit 080cdce

File tree

183 files changed

+1947
-793
lines changed

Some content is hidden

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

183 files changed

+1947
-793
lines changed

.eslintrc

+59
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,67 @@
22
"extends": [
33
"plugin:cypress-dev/general"
44
],
5+
"rules": {
6+
"no-multiple-empty-lines": ["error", { "max": 1 } ],
7+
"no-else-return": [ "error", { "allowElseIf": false } ],
8+
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
9+
"no-unneeded-ternary": ["error"],
10+
"array-bracket-newline": ["error", "consistent"],
11+
"arrow-body-style": ["error", "always"],
12+
"padding-line-between-statements": [
13+
"error",
14+
{
15+
"blankLine": "always",
16+
"prev": "*",
17+
"next": "return"
18+
},
19+
{
20+
"blankLine": "always",
21+
"prev": [
22+
"const",
23+
"let",
24+
"var",
25+
"if",
26+
"while",
27+
"export",
28+
"cjs-export",
29+
"import",
30+
"cjs-import"
31+
],
32+
"next": "*"
33+
},
34+
{
35+
"blankLine": "any",
36+
"prev": [
37+
"const",
38+
"let",
39+
"var",
40+
"import",
41+
"cjs-import"
42+
],
43+
"next": [
44+
"const",
45+
"let",
46+
"var",
47+
"import",
48+
"cjs-import"
49+
]
50+
}
51+
]
52+
},
553
"env": {
654
"es6": true,
755
"node": true
56+
},
57+
"parserOptions": {
58+
"ecmaFeatures": {
59+
"legacyDecorators": true
60+
}
61+
},
62+
"overrides": {
63+
"files": ["**/*.jsx"],
64+
"rules": {
65+
"arrow-body-style": "off",
66+
}
867
}
968
}

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ dist
88
dist-*
99
build
1010
.history
11-
.vscode
1211
.publish
1312
_test-output
1413
cypress.zip
1514
tmp/
1615
.nyc_output
16+
.vscode/settings.json
1717

1818
# from extension
1919
Cached Theme.pak

.vscode/launch.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "attach",
7+
"name": "Attach by Process ID",
8+
"processId": "${command:PickProcess}"
9+
},
10+
{
11+
"type": "node",
12+
"request": "launch",
13+
"name": "test: active",
14+
"runtimeExecutable": "npm",
15+
"runtimeArgs": [
16+
"run",
17+
"test-debug-package",
18+
],
19+
"args": [
20+
"${file}"
21+
],
22+
"port": 5566,
23+
"console": "integratedTerminal"
24+
},
25+
{
26+
"type": "node",
27+
"request": "attach",
28+
"name": "electron",
29+
"port": 5567,
30+
},
31+
]
32+
}

.vscode/tasks.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "decaffeinate-bulk file",
8+
"type": "shell",
9+
"command": "npm run decaffeinate-bulk -- --file ${file} convert",
10+
"problemMatcher": []
11+
},
12+
{
13+
"label": "decaffeinate-bulk dir",
14+
"type": "shell",
15+
"command": "npm run decaffeinate-bulk -- --dir ${fileDirname} convert",
16+
"problemMatcher": []
17+
},
18+
{
19+
"label": "decaffeinate",
20+
"type": "shell",
21+
"command": "npm run decaffeinate -- ${file}"
22+
},
23+
{
24+
"label": "jscodeshift",
25+
"type": "shell",
26+
"command": "npm run jscodeshift -- ${file}"
27+
}
28+
]
29+
}

.vscode/terminals.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"autorun": false,
3+
"terminals": [
4+
{
5+
"name": "cypress open",
6+
"focus": true,
7+
"onlySingle": true,
8+
"execute": true,
9+
"command": "npm run cypress:open"
10+
},
11+
{
12+
"name": "cypress run",
13+
"focus": true,
14+
"onlySingle": true,
15+
"execute": false,
16+
"command": "npm run cypress:run -- --project ../project"
17+
},
18+
{
19+
"name": "packages/server test-watch",
20+
"focus": true,
21+
"onlySingle": true,
22+
"execute": false,
23+
"cwd": "[workspaceFolder]/packages/server",
24+
"command": "npm run test-watch -- [file]"
25+
},
26+
{
27+
"name": "packages/server test-e2e",
28+
"focus": true,
29+
"onlySingle": true,
30+
"execute": false,
31+
"cwd": "[workspaceFolder]/packages/server",
32+
"command": "npm run test-e2e -- --spec name"
33+
},
34+
{
35+
"name": "packages/runner watch",
36+
"focus": true,
37+
"onlySingle": true,
38+
"cwd": "[workspaceFolder]/packages/runner",
39+
"command": "npm run watch"
40+
},
41+
{
42+
"name": "packages/driver cypress open",
43+
"focus": true,
44+
"onlySingle": true,
45+
"cwd": "[workspaceFolder]/packages/driver",
46+
"command": "npm run cypress:open"
47+
},
48+
{
49+
"name": "packages/desktop-gui cypress open",
50+
"focus": true,
51+
"onlySingle": true,
52+
"cwd": "[workspaceFolder]/packages/desktop-gui",
53+
"command": "npm run cypress:open"
54+
}
55+
]
56+
}

bulk-decaffeinate.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
decaffeinateArgs: [
5+
'--use-cs2',
6+
'--loose',
7+
],
8+
jscodeshiftScripts: [
9+
path.resolve('node_modules', 'js-codemod', 'transforms', 'arrow-function.js'),
10+
path.resolve('node_modules', 'js-codemod', 'transforms', 'arrow-function-arguments.js'),
11+
path.resolve('node_modules', 'js-codemod', 'transforms', 'no-vars.js'),
12+
path.resolve('node_modules', 'jscodemods', 'transforms', 'fix-class-assign-construct.js'),
13+
path.resolve('node_modules', 'jscodemods', 'decaffeinate', 'fix-multi-assign-class-export.js'),
14+
path.resolve('node_modules', 'jscodemods', 'decaffeinate', 'fix-implicit-return-assignment.js'),
15+
path.resolve('node_modules', 'jscodemods', 'decaffeinate', 'fix-existential-conditional-assignment.js'),
16+
],
17+
}

cli/lib/cli.js

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const cache = require('./tasks/cache')
1010
// we want to print help for the current command and exit with an error
1111
function unknownOption (flag, type = 'option') {
1212
if (this._allowUnknownOption) return
13+
1314
logger.error()
1415
logger.error(` error: unknown ${type}:`, flag)
1516
logger.error()
@@ -87,6 +88,7 @@ function includesVersion (args) {
8788

8889
function showVersions () {
8990
debug('printing Cypress version')
91+
9092
return require('./exec/versions')
9193
.getVersions()
9294
.then((versions = {}) => {
@@ -187,6 +189,7 @@ module.exports = {
187189
const defaultOpts = { force: true, welcomeMessage: false }
188190
const parsedOpts = parseOpts(opts)
189191
const options = _.extend(parsedOpts, defaultOpts)
192+
190193
require('./tasks/verify')
191194
.start(options)
192195
.catch(util.logErrorExit1)
@@ -203,6 +206,7 @@ module.exports = {
203206
if (opts.command || !_.includes(['list', 'path', 'clear'], opts)) {
204207
unknownOption.call(this, `cache ${opts}`, 'sub-command')
205208
}
209+
206210
cache[opts]()
207211
})
208212

@@ -219,10 +223,12 @@ module.exports = {
219223
// Deprecated Catches
220224

221225
const firstCommand = args[2]
226+
222227
if (!_.includes(knownCommands, firstCommand)) {
223228
debug('unknown command %s', firstCommand)
224229
logger.error('Unknown command', `"${firstCommand}"`)
225230
program.outputHelp()
231+
226232
return util.exit(1)
227233
}
228234

@@ -233,7 +239,9 @@ module.exports = {
233239
// so we have to manually catch '-v, --version'
234240
return showVersions()
235241
}
242+
236243
debug('program parsing arguments')
244+
237245
return program.parse(args)
238246
},
239247
}

cli/lib/cypress.js

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const util = require('./util')
1111
const cypressModuleApi = {
1212
open (options = {}) {
1313
options = util.normalizeModuleOptions(options)
14+
1415
return open.start(options)
1516
},
1617

@@ -31,6 +32,7 @@ const cypressModuleApi = {
3132
message: 'Could not find Cypress test run results',
3233
}
3334
}
35+
3436
return output
3537
})
3638
})

cli/lib/errors.js

+32-19
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,33 @@ const failedUnzip = {
2525
`,
2626
}
2727

28-
const missingApp = (binaryDir) => ({
29-
description: `No version of Cypress is installed in: ${chalk.cyan(binaryDir)}`,
30-
solution: stripIndent`
28+
const missingApp = (binaryDir) => {
29+
return {
30+
description: `No version of Cypress is installed in: ${chalk.cyan(binaryDir)}`,
31+
solution: stripIndent`
3132
\nPlease reinstall Cypress by running: ${chalk.cyan('cypress install')}
3233
`,
33-
})
34+
}
35+
}
3436

35-
const binaryNotExecutable = (executable) => ({
36-
description: `Cypress cannot run because the binary does not have executable permissions: ${executable}`,
37-
solution: stripIndent`\n
37+
const binaryNotExecutable = (executable) => {
38+
return {
39+
description: `Cypress cannot run because the binary does not have executable permissions: ${executable}`,
40+
solution: stripIndent`\n
3841
Reasons this may happen:
3942
4043
- node was installed as 'root' or with 'sudo'
4144
- the cypress npm package as 'root' or with 'sudo'
4245
4346
Please check that you have the appropriate user permissions.
4447
`,
45-
})
46-
48+
}
49+
}
4750

48-
const notInstalledCI = (executable) => ({
49-
description: 'The cypress npm package is installed, but the Cypress binary is missing.',
50-
solution: stripIndent`\n
51+
const notInstalledCI = (executable) => {
52+
return {
53+
description: 'The cypress npm package is installed, but the Cypress binary is missing.',
54+
solution: stripIndent`\n
5155
We expected the binary to be installed here: ${chalk.cyan(executable)}
5256
5357
Reasons it may be missing:
@@ -61,7 +65,8 @@ const notInstalledCI = (executable) => ({
6165
6266
${chalk.blue('https://on.cypress.io/not-installed-ci-error')}
6367
`,
64-
})
68+
}
69+
}
6570

6671
const nonZeroExitCodeXvfb = {
6772
description: 'XVFB exited with a non zero exit code.',
@@ -146,6 +151,7 @@ const removed = {
146151
const CYPRESS_RUN_BINARY = {
147152
notValid: (value) => {
148153
const properFormat = `**/${state.getPlatformExecutable()}`
154+
149155
return {
150156
description: `Could not run binary set by environment variable CYPRESS_RUN_BINARY=${value}`,
151157
solution: `Ensure the environment variable is a path to the Cypress binary, matching ${properFormat}`,
@@ -155,15 +161,19 @@ const CYPRESS_RUN_BINARY = {
155161

156162
function getPlatformInfo () {
157163
return util.getOsVersionAsync()
158-
.then((version) => stripIndent`
164+
.then((version) => {
165+
return stripIndent`
159166
Platform: ${os.platform()} (${version})
160167
Cypress Version: ${util.pkgVersion()}
161-
`)
168+
`
169+
})
162170
}
163171

164172
function addPlatformInformation (info) {
165173
return getPlatformInfo()
166-
.then((platform) => merge(info, { platform }))
174+
.then((platform) => {
175+
return merge(info, { platform })
176+
})
167177
}
168178

169179
function formErrorText (info, msg) {
@@ -216,13 +226,16 @@ function formErrorText (info, msg) {
216226

217227
const raise = (text) => {
218228
const err = new Error(text)
229+
219230
err.known = true
220231
throw err
221232
}
222233

223-
const throwFormErrorText = (info) => (msg) => {
224-
return formErrorText(info, msg)
225-
.then(raise)
234+
const throwFormErrorText = (info) => {
235+
return (msg) => {
236+
return formErrorText(info, msg)
237+
.then(raise)
238+
}
226239
}
227240

228241
module.exports = {

0 commit comments

Comments
 (0)