cli: better stdout normalization

This commit is contained in:
Brian Mann
2017-09-04 13:52:38 -04:00
parent 2f142d1f4e
commit 1178c67a29
2 changed files with 28 additions and 25 deletions

View File

@@ -1,3 +1,25 @@
exports['xvfb fails 1'] = `It looks like this is your first time using Cypress: 1.2.3
[?25l ✖  Verifying Cypress can run /path/to/executable/dir
[?25hError: Your system is missing the dependency: XVFB

Install XVFB and run Cypress again.

Read our documentation on dependencies for more information:

https://on.cypress.io/required-dependencies

If you using Docker, we provide containers with all required dependencies installed.
----------

Caught error trying to run XVFB: "test without xvfb"
----------

Platform: darwin (test release)
Cypress Version: 1.2.3
`
exports['no version of Cypress installed 1'] = `Error: No version of Cypress is installed.

Please reinstall Cypress by running: cypress install
@@ -36,7 +58,7 @@ exports['verification with executable 1'] = `It looks like this is your fir
exports['fails verifying Cypress 1'] = `It looks like this is your first time using Cypress: 1.2.3
[?25l ✖  Verifying Cypress can run /path/to/executable/dir

[?25hError: Cypress failed to start.

This is usually caused by a missing library or dependency.
@@ -65,25 +87,3 @@ exports['current version has not been verified 1'] = `It looks like this is
[?25l ✔  Verified Cypress! /path/to/executable/dir
[?25h`
exports['xfvb fails 1'] = `It looks like this is your first time using Cypress: 1.2.3
[?25l ✖  Verifying Cypress can run /path/to/executable/dir

[?25hError: Your system is missing the dependency: XVFB

Install XVFB and run Cypress again.

Read our documentation on dependencies for more information:

https://on.cypress.io/required-dependencies

If you using Docker, we provide containers with all required dependencies installed.
----------

Caught error trying to run XVFB: "test without xvfb"
----------

Platform: darwin (test release)
Cypress Version: 1.2.3
`

View File

@@ -20,9 +20,12 @@ const packageVersion = '1.2.3'
const executablePath = '/path/to/executable'
const executableDir = '/path/to/executable/dir'
const installationDir = info.getInstallationDir()
const replaceRe = /(.+REPLACER)/g
const normalize = (str) => {
return str.replace('[90m→ Cypress Version: 1.2.3', '')
return str
.replace('[90m→ Cypress Version: 1.2.3', 'REPLACER')
.replace(replaceRe, '')
}
context('.verify', function () {
@@ -282,7 +285,7 @@ context('.verify', function () {
logger.error(err)
snapshot('xfvb fails', normalize(ctx.stdout.toString()))
snapshot('xvfb fails', normalize(ctx.stdout.toString()))
})
})
})