Skip to content

Commit

Permalink
Merge branch 'develop' into v4.0-release
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbreiding committed May 21, 2019
2 parents 875e07f + 031ae70 commit fcdb616
Show file tree
Hide file tree
Showing 34 changed files with 916 additions and 377 deletions.
42 changes: 21 additions & 21 deletions cli/__snapshots__/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ exports['cli help command shows help 1'] = `
run [options] Runs Cypress tests from the CLI without the GUI
open [options] Opens Cypress in the interactive GUI.
install [options] Installs the Cypress executable matching this package's version
verify Verifies that Cypress is installed correctly and executable
verify [options] Verifies that Cypress is installed correctly and executable
cache [options] Manages the Cypress binary cache
-------
stderr:
-------
-------
`

exports['cli help command shows help for --help 1'] = `
Expand All @@ -79,14 +79,14 @@ exports['cli help command shows help for --help 1'] = `
run [options] Runs Cypress tests from the CLI without the GUI
open [options] Opens Cypress in the interactive GUI.
install [options] Installs the Cypress executable matching this package's version
verify Verifies that Cypress is installed correctly and executable
verify [options] Verifies that Cypress is installed correctly and executable
cache [options] Manages the Cypress binary cache
-------
stderr:
-------
-------
`

exports['cli help command shows help for -h 1'] = `
Expand All @@ -112,14 +112,14 @@ exports['cli help command shows help for -h 1'] = `
run [options] Runs Cypress tests from the CLI without the GUI
open [options] Opens Cypress in the interactive GUI.
install [options] Installs the Cypress executable matching this package's version
verify Verifies that Cypress is installed correctly and executable
verify [options] Verifies that Cypress is installed correctly and executable
cache [options] Manages the Cypress binary cache
-------
stderr:
-------
-------
`

exports['cli unknown command shows usage and exits 1'] = `
Expand Down Expand Up @@ -151,9 +151,9 @@ exports['cli unknown command shows usage and exits 1'] = `
-------
stderr:
-------
-------
`

exports['cli unknown option shows help for cache command - no sub-command 1'] = `
Expand All @@ -179,9 +179,9 @@ exports['cli unknown option shows help for cache command - no sub-command 1'] =
-------
stderr:
-------
-------
`

exports['cli unknown option shows help for cache command - unknown option --foo 1'] = `
Expand Down Expand Up @@ -209,9 +209,9 @@ exports['cli unknown option shows help for cache command - unknown option --foo
-------
stderr:
-------
-------
`

exports['cli unknown option shows help for cache command - unknown sub-command foo 1'] = `
Expand Down Expand Up @@ -239,9 +239,9 @@ exports['cli unknown option shows help for cache command - unknown sub-command f
-------
stderr:
-------
-------
`

exports['cli version and binary version 1'] = `
Expand Down Expand Up @@ -289,9 +289,9 @@ exports['shows help for open --foo 1'] = `
-------
stderr:
-------
-------
`

exports['shows help for run --foo 1'] = `
Expand Down Expand Up @@ -332,7 +332,7 @@ exports['shows help for run --foo 1'] = `
-------
stderr:
-------
-------
`
16 changes: 4 additions & 12 deletions cli/__snapshots__/errors_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports['errors individual has the following errors 1'] = [
"failedDownload",
"failedUnzip",
"invalidCacheDirectory",
"invalidDisplayError",
"invalidSmokeTestDisplayError",
"missingApp",
"missingDependency",
"missingXvfb",
Expand All @@ -45,19 +45,11 @@ exports['errors individual has the following errors 1'] = [
]

exports['invalid display error'] = `
Cypress failed to start.
Cypress verification failed.
First, we have tried to start Cypress using your DISPLAY settings
but encountered the following problem:
Cypress failed to start after spawning a new XVFB server.
----------
prev message
----------
Then we started our own XVFB and tried to start Cypress again, but
got the following error:
The error logs we received were:
----------
Expand Down
34 changes: 11 additions & 23 deletions cli/__snapshots__/verify_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Error: Cypress verification timed out.
This command failed with the following output:
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 --enable-logging
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222
----------
Expand All @@ -181,7 +181,7 @@ Error: Cypress verification failed.
This command failed with the following output:
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 --enable-logging
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222
----------
Expand All @@ -203,7 +203,7 @@ Error: Cypress verification failed.
This command failed with the following output:
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222 --enable-logging
/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress --smoke-test --ping=222
----------
Expand Down Expand Up @@ -364,19 +364,15 @@ It looks like this is your first time using Cypress: 1.2.3
✖ Verifying Cypress can run /cache/Cypress/1.2.3/Cypress.app
STRIPPED
Error: Your system is missing the dependency: XVFB
Error: XVFB exited with a non zero exit code.
Install XVFB and run Cypress again.
There was a problem spawning Xvfb.
Read our documentation on dependencies for more information:
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
This is likely a problem with your system, permissions, or installation of Xvfb.
----------
Caught error trying to run XVFB: "test without xvfb"
Error: test without xvfb
----------
Expand All @@ -386,23 +382,15 @@ Cypress Version: 1.2.3
`

exports['tried to verify twice, on the first try got the DISPLAY error'] = `
Cypress failed to start.
Cypress verification failed.
First, we have tried to start Cypress using your DISPLAY settings
but encountered the following problem:
Cypress failed to start after spawning a new XVFB server.
----------
[some noise here] Gtk: cannot open display: 987
and maybe a few other lines here with weird indent
----------
Then we started our own XVFB and tried to start Cypress again, but
got the following error:
The error logs we received were:
----------
[some noise here] Gtk: cannot open display: 987
some other error
again with
some weird indent
Expand Down
1 change: 1 addition & 0 deletions cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ module.exports = {
.command('verify')
.usage('[options]')
.description('Verifies that Cypress is installed correctly and executable')
.option('--dev', text('dev'), coerceFalse)
.action((opts) => {
const defaultOpts = { force: true, welcomeMessage: false }
const parsedOpts = parseOpts(opts)
Expand Down
37 changes: 18 additions & 19 deletions cli/lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,14 @@ const smokeTestFailure = (smokeTestCommand, timedOut) => {
}
}

const invalidDisplayError = {
description: 'Cypress failed to start.',
solution (msg, prevMessage) {
const invalidSmokeTestDisplayError = {
code: 'INVALID_SMOKE_TEST_DISPLAY_ERROR',
description: 'Cypress verification failed.',
solution (msg) {
return stripIndent`
First, we have tried to start Cypress using your DISPLAY settings
but encountered the following problem:
${hr}
Cypress failed to start after spawning a new XVFB server.
${prevMessage}
${hr}
Then we started our own XVFB and tried to start Cypress again, but
got the following error:
The error logs we received were:
${hr}
Expand Down Expand Up @@ -301,17 +294,23 @@ function formErrorText (info, msg, prevMessage) {
})
}

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

if (info.code) {
err.code = info.code
}

err.known = true
throw err
err.known = true
throw err
}
}

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

Expand All @@ -326,7 +325,7 @@ module.exports = {
missingApp,
notInstalledCI,
missingDependency,
invalidDisplayError,
invalidSmokeTestDisplayError,
versionMismatch,
binaryNotExecutable,
unexpected,
Expand Down
Loading

0 comments on commit fcdb616

Please sign in to comment.