Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secure cookie error crash #2685

Merged
merged 30 commits into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c1ae8d7
fix import deps
brian-mann Oct 22, 2018
f1ee2c1
merge conflicts
brian-mann Oct 23, 2018
b6914fa
add debug info
brian-mann Oct 23, 2018
08d0f90
WIP: iterating on cookies bug
brian-mann Oct 23, 2018
aac2011
add decaffeinate + tooling
brian-mann Oct 23, 2018
428eda9
don't use existential operator
brian-mann Oct 23, 2018
fb72c80
codemods
brian-mann Oct 23, 2018
9a10c24
bump eslint, add more rules
brian-mann Oct 23, 2018
ce4d694
decaff args + codemods
brian-mann Oct 23, 2018
4c1a8df
more eslint rules
brian-mann Oct 23, 2018
5451869
decaffeinate: Rename app_data.coffee and 41 other files from .coffee …
brian-mann Oct 24, 2018
0253dff
decaffeinate: Convert app_data.coffee and 41 other files to JS
brian-mann Oct 24, 2018
a79c891
decaffeinate: Run post-processing cleanups on app_data.coffee and 41 …
brian-mann Oct 24, 2018
4b2b85b
cleanup some linting, fix missing return
brian-mann Oct 24, 2018
294095d
set longStackTraces property only when dev
brian-mann Oct 24, 2018
102b972
fix for address returning null
brian-mann Oct 24, 2018
24653f4
lots of eslint fixes
brian-mann Oct 24, 2018
5ace13e
lots of linting
brian-mann Oct 24, 2018
a7f7e95
add clean-deps to more packages
brian-mann Oct 24, 2018
7194a56
add empty jsconfig file for vscode perf [skip ci]
brian-mann Oct 24, 2018
47f1abf
fix busted coerce
brian-mann Oct 25, 2018
f894e34
add package test debug script for automatic test debugging
brian-mann Oct 25, 2018
c3e8f7a
add vscode settings, tasks, terminals, and debuggers
brian-mann Oct 25, 2018
4b6b5a5
auto attach to node debug processes, add script to debug main electro…
brian-mann Oct 26, 2018
b31782d
fixes #1321 by setting url used to create cookie
brian-mann Oct 31, 2018
a205648
remove default whitelisting to prevent cookie leaking between tests
brian-mann Oct 31, 2018
bb6be7e
update linting rules for jsx exceptions, update babel-eslint
brian-mann Nov 1, 2018
f356c51
use function by ref
brian-mann Nov 1, 2018
9603a0e
lint all the things
brian-mann Nov 1, 2018
c183793
remove and ignore vscode settings.json
brian-mann Nov 1, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,67 @@
"extends": [
"plugin:cypress-dev/general"
],
"rules": {
"no-multiple-empty-lines": ["error", { "max": 1 } ],
"no-else-return": [ "error", { "allowElseIf": false } ],
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
"no-unneeded-ternary": ["error"],
"array-bracket-newline": ["error", "consistent"],
"arrow-body-style": ["error", "always"],
"padding-line-between-statements": [
"error",
{
"blankLine": "always",
"prev": "*",
"next": "return"
},
{
"blankLine": "always",
"prev": [
"const",
"let",
"var",
"if",
"while",
"export",
"cjs-export",
"import",
"cjs-import"
],
"next": "*"
},
{
"blankLine": "any",
"prev": [
"const",
"let",
"var",
"import",
"cjs-import"
],
"next": [
"const",
"let",
"var",
"import",
"cjs-import"
]
}
]
},
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"legacyDecorators": true
}
},
"overrides": {
"files": ["**/*.jsx"],
"rules": {
"arrow-body-style": "off",
}
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ dist
dist-*
build
.history
.vscode
.publish
_test-output
cypress.zip
tmp/
.nyc_output
.vscode/settings.json

# from extension
Cached Theme.pak
Expand Down
32 changes: 32 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}"
},
{
"type": "node",
"request": "launch",
"name": "test: active",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"test-debug-package",
],
"args": [
"${file}"
],
"port": 5566,
"console": "integratedTerminal"
},
{
"type": "node",
"request": "attach",
"name": "electron",
"port": 5567,
},
]
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "decaffeinate-bulk file",
"type": "shell",
"command": "npm run decaffeinate-bulk -- --file ${file} convert",
"problemMatcher": []
},
{
"label": "decaffeinate-bulk dir",
"type": "shell",
"command": "npm run decaffeinate-bulk -- --dir ${fileDirname} convert",
"problemMatcher": []
},
{
"label": "decaffeinate",
"type": "shell",
"command": "npm run decaffeinate -- ${file}"
},
{
"label": "jscodeshift",
"type": "shell",
"command": "npm run jscodeshift -- ${file}"
}
]
}
56 changes: 56 additions & 0 deletions .vscode/terminals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"autorun": false,
"terminals": [
{
"name": "cypress open",
"focus": true,
"onlySingle": true,
"execute": true,
"command": "npm run cypress:open"
},
{
"name": "cypress run",
"focus": true,
"onlySingle": true,
"execute": false,
"command": "npm run cypress:run -- --project ../project"
},
{
"name": "packages/server test-watch",
"focus": true,
"onlySingle": true,
"execute": false,
"cwd": "[workspaceFolder]/packages/server",
"command": "npm run test-watch -- [file]"
},
{
"name": "packages/server test-e2e",
"focus": true,
"onlySingle": true,
"execute": false,
"cwd": "[workspaceFolder]/packages/server",
"command": "npm run test-e2e -- --spec name"
},
{
"name": "packages/runner watch",
"focus": true,
"onlySingle": true,
"cwd": "[workspaceFolder]/packages/runner",
"command": "npm run watch"
},
{
"name": "packages/driver cypress open",
"focus": true,
"onlySingle": true,
"cwd": "[workspaceFolder]/packages/driver",
"command": "npm run cypress:open"
},
{
"name": "packages/desktop-gui cypress open",
"focus": true,
"onlySingle": true,
"cwd": "[workspaceFolder]/packages/desktop-gui",
"command": "npm run cypress:open"
}
]
}
17 changes: 17 additions & 0 deletions bulk-decaffeinate.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require('path')

module.exports = {
decaffeinateArgs: [
'--use-cs2',
'--loose',
],
jscodeshiftScripts: [
path.resolve('node_modules', 'js-codemod', 'transforms', 'arrow-function.js'),
path.resolve('node_modules', 'js-codemod', 'transforms', 'arrow-function-arguments.js'),
path.resolve('node_modules', 'js-codemod', 'transforms', 'no-vars.js'),
path.resolve('node_modules', 'jscodemods', 'transforms', 'fix-class-assign-construct.js'),
path.resolve('node_modules', 'jscodemods', 'decaffeinate', 'fix-multi-assign-class-export.js'),
path.resolve('node_modules', 'jscodemods', 'decaffeinate', 'fix-implicit-return-assignment.js'),
path.resolve('node_modules', 'jscodemods', 'decaffeinate', 'fix-existential-conditional-assignment.js'),
],
}
8 changes: 8 additions & 0 deletions cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const cache = require('./tasks/cache')
// we want to print help for the current command and exit with an error
function unknownOption (flag, type = 'option') {
if (this._allowUnknownOption) return

logger.error()
logger.error(` error: unknown ${type}:`, flag)
logger.error()
Expand Down Expand Up @@ -87,6 +88,7 @@ function includesVersion (args) {

function showVersions () {
debug('printing Cypress version')

return require('./exec/versions')
.getVersions()
.then((versions = {}) => {
Expand Down Expand Up @@ -187,6 +189,7 @@ module.exports = {
const defaultOpts = { force: true, welcomeMessage: false }
const parsedOpts = parseOpts(opts)
const options = _.extend(parsedOpts, defaultOpts)

require('./tasks/verify')
.start(options)
.catch(util.logErrorExit1)
Expand All @@ -203,6 +206,7 @@ module.exports = {
if (opts.command || !_.includes(['list', 'path', 'clear'], opts)) {
unknownOption.call(this, `cache ${opts}`, 'sub-command')
}

cache[opts]()
})

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

const firstCommand = args[2]

if (!_.includes(knownCommands, firstCommand)) {
debug('unknown command %s', firstCommand)
logger.error('Unknown command', `"${firstCommand}"`)
program.outputHelp()

return util.exit(1)
}

Expand All @@ -233,7 +239,9 @@ module.exports = {
// so we have to manually catch '-v, --version'
return showVersions()
}

debug('program parsing arguments')

return program.parse(args)
},
}
Expand Down
2 changes: 2 additions & 0 deletions cli/lib/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const util = require('./util')
const cypressModuleApi = {
open (options = {}) {
options = util.normalizeModuleOptions(options)

return open.start(options)
},

Expand All @@ -31,6 +32,7 @@ const cypressModuleApi = {
message: 'Could not find Cypress test run results',
}
}

return output
})
})
Expand Down
51 changes: 32 additions & 19 deletions cli/lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,33 @@ const failedUnzip = {
`,
}

const missingApp = (binaryDir) => ({
description: `No version of Cypress is installed in: ${chalk.cyan(binaryDir)}`,
solution: stripIndent`
const missingApp = (binaryDir) => {
return {
description: `No version of Cypress is installed in: ${chalk.cyan(binaryDir)}`,
solution: stripIndent`
\nPlease reinstall Cypress by running: ${chalk.cyan('cypress install')}
`,
})
}
}

const binaryNotExecutable = (executable) => ({
description: `Cypress cannot run because the binary does not have executable permissions: ${executable}`,
solution: stripIndent`\n
const binaryNotExecutable = (executable) => {
return {
description: `Cypress cannot run because the binary does not have executable permissions: ${executable}`,
solution: stripIndent`\n
Reasons this may happen:

- node was installed as 'root' or with 'sudo'
- the cypress npm package as 'root' or with 'sudo'

Please check that you have the appropriate user permissions.
`,
})

}
}

const notInstalledCI = (executable) => ({
description: 'The cypress npm package is installed, but the Cypress binary is missing.',
solution: stripIndent`\n
const notInstalledCI = (executable) => {
return {
description: 'The cypress npm package is installed, but the Cypress binary is missing.',
solution: stripIndent`\n
We expected the binary to be installed here: ${chalk.cyan(executable)}

Reasons it may be missing:
Expand All @@ -61,7 +65,8 @@ const notInstalledCI = (executable) => ({

https://on.cypress.io/not-installed-ci-error
`,
})
}
}

const nonZeroExitCodeXvfb = {
description: 'XVFB exited with a non zero exit code.',
Expand Down Expand Up @@ -146,6 +151,7 @@ const removed = {
const CYPRESS_RUN_BINARY = {
notValid: (value) => {
const properFormat = `**/${state.getPlatformExecutable()}`

return {
description: `Could not run binary set by environment variable CYPRESS_RUN_BINARY=${value}`,
solution: `Ensure the environment variable is a path to the Cypress binary, matching ${properFormat}`,
Expand All @@ -155,15 +161,19 @@ const CYPRESS_RUN_BINARY = {

function getPlatformInfo () {
return util.getOsVersionAsync()
.then((version) => stripIndent`
.then((version) => {
return stripIndent`
Platform: ${os.platform()} (${version})
Cypress Version: ${util.pkgVersion()}
`)
`
})
}

function addPlatformInformation (info) {
return getPlatformInfo()
.then((platform) => merge(info, { platform }))
.then((platform) => {
return merge(info, { platform })
})
}

function formErrorText (info, msg) {
Expand Down Expand Up @@ -216,13 +226,16 @@ function formErrorText (info, msg) {

const raise = (text) => {
const err = new Error(text)

err.known = true
throw err
}

const throwFormErrorText = (info) => (msg) => {
return formErrorText(info, msg)
.then(raise)
const throwFormErrorText = (info) => {
return (msg) => {
return formErrorText(info, msg)
.then(raise)
}
}

module.exports = {
Expand Down
Loading