Skip to content

Commit

Permalink
update message, show first part in red
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Aug 29, 2019
1 parent 498927c commit 8a5030a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
4 changes: 3 additions & 1 deletion cli/__snapshots__/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,11 @@ exports['cli CYPRESS_ENV catches environment "foo" 1'] = `
Environment variable with reserved name "CYPRESS_ENV" was used.
Remove "CYPRESS_ENV" variable and run Cypress again.
----------
foo
CYPRESS_ENV=foo
----------
Platform: xxx
Expand Down
2 changes: 1 addition & 1 deletion cli/__snapshots__/errors_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ exports['errors individual has the following errors 1'] = [
"failedDownload",
"failedUnzip",
"invalidCacheDirectory",
"invalidCypressEnv",
"invalidSmokeTestDisplayError",
"missingApp",
"missingDependency",
Expand All @@ -41,7 +42,6 @@ exports['errors individual has the following errors 1'] = [
"removed",
"smokeTestFailure",
"unexpected",
"invalidCypressEnv",
"versionMismatch"
]

Expand Down
2 changes: 1 addition & 1 deletion cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ module.exports = {
debug('invalid CYPRESS_ENV value', process.env.CYPRESS_ENV)

return errors.exitWithError(errors.errors.invalidCypressEnv)(
process.env.CYPRESS_ENV
`CYPRESS_ENV=${process.env.CYPRESS_ENV}`
)
}

Expand Down
14 changes: 2 additions & 12 deletions cli/lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,11 @@ const unexpected = {

const invalidCypressEnv = {
description:
'Environment variable with reserved name "CYPRESS_ENV" was used.',
solution: 'Remove "CYPRESS_ENV" variable and run Cypress again.',
chalk.red('Environment variable with reserved name "CYPRESS_ENV" was used.'),
solution: chalk.red('Remove "CYPRESS_ENV" variable and run Cypress again.'),
exitCode: 11,
}

// const getOsVersion = () => {
// if (os.platform() === 'linux') {
// return getos()
// .then(osInfo => [osInfo.dist, osInfo.release].join(' - '))
// .catch(() => os.release())
// }
// return Promise.resolve(os.release())

// }

const removed = {
CYPRESS_BINARY_VERSION: {
description: stripIndent`
Expand Down
3 changes: 2 additions & 1 deletion cli/test/lib/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ describe('cli', () => {
}

const sanitizePlatform = (text) => {
return text.split(os.eol)
return text
.split(os.eol)
.map(replacePlatform)
.map(replaceCypressVersion)
.join(os.eol)
Expand Down

0 comments on commit 8a5030a

Please sign in to comment.